Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PM / devfreq: rk3399_dmc: Support new disable-freq properties

Implement the newly-defined properties to allow disabling certain
power-saving-at-idle features at higher frequencies.

This is a rewritten version of work by Lin Huang <hl@rock-chips.com>.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Brian Norris and committed by
Chanwoo Choi
e4421721 a5ca1854

+47 -4
+47 -4
drivers/devfreq/rk3399_dmc.c
··· 55 55 unsigned int ddr3_odt_dis_freq; 56 56 unsigned int lpddr3_odt_dis_freq; 57 57 unsigned int lpddr4_odt_dis_freq; 58 + 59 + unsigned int pd_idle_dis_freq; 60 + unsigned int sr_idle_dis_freq; 61 + unsigned int sr_mc_gate_idle_dis_freq; 62 + unsigned int srpd_lite_idle_dis_freq; 63 + unsigned int standby_idle_dis_freq; 58 64 }; 59 65 60 66 static int rk3399_dmcfreq_target(struct device *dev, unsigned long *freq, ··· 87 81 mutex_lock(&dmcfreq->lock); 88 82 89 83 if (dmcfreq->regmap_pmu) { 84 + unsigned int odt_pd_arg0 = dmcfreq->odt_pd_arg0; 85 + unsigned int odt_pd_arg1 = dmcfreq->odt_pd_arg1; 90 86 unsigned int odt_pd_arg2 = 0; 87 + 88 + if (target_rate >= dmcfreq->sr_idle_dis_freq) 89 + odt_pd_arg0 &= ~RK3399_SET_ODT_PD_0_SR_IDLE; 90 + 91 + if (target_rate >= dmcfreq->sr_mc_gate_idle_dis_freq) 92 + odt_pd_arg0 &= ~RK3399_SET_ODT_PD_0_SR_MC_GATE_IDLE; 93 + 94 + if (target_rate >= dmcfreq->standby_idle_dis_freq) 95 + odt_pd_arg0 &= ~RK3399_SET_ODT_PD_0_STANDBY_IDLE; 96 + 97 + if (target_rate >= dmcfreq->pd_idle_dis_freq) 98 + odt_pd_arg1 &= ~RK3399_SET_ODT_PD_1_PD_IDLE; 99 + 100 + if (target_rate >= dmcfreq->srpd_lite_idle_dis_freq) 101 + odt_pd_arg1 &= ~RK3399_SET_ODT_PD_1_SRPD_LITE_IDLE; 91 102 92 103 if (target_rate >= dmcfreq->odt_dis_freq) 93 104 odt_pd_arg2 |= RK3399_SET_ODT_PD_2_ODT_ENABLE; ··· 114 91 * (power-down) timings and to enable or disable the 115 92 * ODT (on-die termination) resistors. 116 93 */ 117 - arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, dmcfreq->odt_pd_arg0, 118 - dmcfreq->odt_pd_arg1, 119 - ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, 120 - odt_pd_arg2, 0, 0, 0, &res); 94 + arm_smccc_smc(ROCKCHIP_SIP_DRAM_FREQ, odt_pd_arg0, odt_pd_arg1, 95 + ROCKCHIP_SIP_CONFIG_DRAM_SET_ODT_PD, odt_pd_arg2, 96 + 0, 0, 0, &res); 121 97 } 122 98 123 99 /* ··· 252 230 { 253 231 int ret = 0; 254 232 233 + /* 234 + * These are all optional, and serve as minimum bounds. Give them large 235 + * (i.e., never "disabled") values if the DT doesn't specify one. 236 + */ 237 + data->pd_idle_dis_freq = 238 + data->sr_idle_dis_freq = 239 + data->sr_mc_gate_idle_dis_freq = 240 + data->srpd_lite_idle_dis_freq = 241 + data->standby_idle_dis_freq = UINT_MAX; 242 + 255 243 ret |= of_property_read_u32(np, "rockchip,pd_idle", 256 244 &data->pd_idle); 257 245 ret |= of_property_read_u32(np, "rockchip,sr_idle", ··· 278 246 &data->lpddr3_odt_dis_freq); 279 247 ret |= of_property_read_u32(np, "rockchip,lpddr4_odt_dis_freq", 280 248 &data->lpddr4_odt_dis_freq); 249 + 250 + ret |= of_property_read_u32(np, "rockchip,pd-idle-dis-freq-hz", 251 + &data->pd_idle_dis_freq); 252 + ret |= of_property_read_u32(np, "rockchip,sr-idle-dis-freq-hz", 253 + &data->sr_idle_dis_freq); 254 + ret |= of_property_read_u32(np, "rockchip,sr-mc-gate-idle-dis-freq-hz", 255 + &data->sr_mc_gate_idle_dis_freq); 256 + ret |= of_property_read_u32(np, "rockchip,srpd-lite-idle-dis-freq-hz", 257 + &data->srpd_lite_idle_dis_freq); 258 + ret |= of_property_read_u32(np, "rockchip,standby-idle-dis-freq-hz", 259 + &data->standby_idle_dis_freq); 281 260 282 261 return ret; 283 262 }