From 354584ddce4f32563c41c5623f4b92f26713e3ae Mon Sep 17 00:00:00 2001 From: YouMin Chen Date: Tue, 5 Mar 2019 19:38:11 +0800 Subject: [PATCH] PM / devfreq: rockchip-dfi: fix lpddr4 calculation error Fix lpddr4 calculation error about access. LPDDR4 BL(burst length) = 16,other DDR type BL(burst length) = 8. Change-Id: Icc1b4f6764fa0b23ec1f7722bda8ffeff1da4ab7 Signed-off-by: YouMin Chen --- drivers/devfreq/event/rockchip-dfi.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/devfreq/event/rockchip-dfi.c +++ b/drivers/devfreq/event/rockchip-dfi.c @@ -374,11 +374,19 @@ static int rockchip_dfi_get_busier_ch(st for (i = 0; i < MAX_DMC_NUM_CH; i++) { if (!(info->ch_msk & BIT(i))) continue; - info->ch_usage[i].access = readl_relaxed(dfi_regs + - DDRMON_CH0_DFI_ACCESS_NUM + i * 20) * 4; + info->ch_usage[i].total = readl_relaxed(dfi_regs + DDRMON_CH0_COUNT_NUM + i * 20); - tmp = info->ch_usage[i].access; + + /* LPDDR4 BL = 16,other DDR type BL = 8 */ + tmp = readl_relaxed(dfi_regs + + DDRMON_CH0_DFI_ACCESS_NUM + i * 20); + if (info->dram_type == LPDDR4) + tmp *= 8; + else + tmp *= 4; + info->ch_usage[i].access = tmp; + if (tmp > max) { busier_ch = i; max = tmp;