X-Git-Url: http://plrg.eecs.uci.edu/git/?p=firefly-linux-kernel-4.4.55.git;a=blobdiff_plain;f=drivers%2Fdevfreq%2Fddr_rk3368.c;h=7cd74af535c164a82d7acbf6921483565bef7560;hp=56d3b679475f0c3359bb18aa0530a5b5d3a15338;hb=6b68cd05dfa49f42f51843686c8304170b92ce94;hpb=862e9c8a8450d10b199c038d28697f6163558b03 diff --git a/drivers/devfreq/ddr_rk3368.c b/drivers/devfreq/ddr_rk3368.c index 56d3b679475f..7cd74af535c1 100644 --- a/drivers/devfreq/ddr_rk3368.c +++ b/drivers/devfreq/ddr_rk3368.c @@ -64,6 +64,16 @@ struct rockchip_ddr { static struct rockchip_ddr *ddr_data = NULL; +static int _ddr_recalc_rate(void) +{ + int ddr_freq; + + regmap_read(ddr_data->ddrpctl_regs, DDR_PCTL_TOGCNT_1U, + &ddr_freq); + ddr_freq = ddr_freq * 2 * 1000000; + return ddr_freq; +} + static int _ddr_change_freq(u32 n_mhz) { u32 ret; @@ -71,7 +81,7 @@ static int _ddr_change_freq(u32 n_mhz) printk(KERN_DEBUG pr_fmt("In func %s,freq=%dMHz\n"), __func__, n_mhz); if (scpi_ddr_set_clk_rate(n_mhz)) pr_info("set ddr freq timeout\n"); - ret = scpi_ddr_get_clk_rate(); + ret = _ddr_recalc_rate() / 1000000; printk(KERN_DEBUG pr_fmt("Func %s out,freq=%dMHz\n"), __func__, ret); return ret; } @@ -81,11 +91,6 @@ static long _ddr_round_rate(u32 n_mhz) return (n_mhz / 12) * 12; } -static int _ddr_recalc_rate(void) -{ - return (1000000 * scpi_ddr_get_clk_rate()); -} - static void _ddr_set_auto_self_refresh(bool en) { if (scpi_ddr_set_auto_self_refresh(en))