diff options
| author | Ram Chandrasekar <rkumbako@codeaurora.org> | 2016-09-06 19:25:18 -0600 |
|---|---|---|
| committer | Ram Chandrasekar <rkumbako@codeaurora.org> | 2016-10-21 10:54:12 -0600 |
| commit | d14331f95b2cf5b4feb217079caab444d6c47600 (patch) | |
| tree | 4eceffaa6e65b6c1d1035044a444025367a279bb | |
| parent | b8af6bb420fdbec6e23a081fc742f2572fd3836b (diff) | |
driver: thermal: msm_lmh_dcvs: Match the hardware frequency to OPP
The hardware frequency that LMH DCVSh hardware has requested may not
match an actual frequency of CPU. The OSM hardware will aggregate and
match this request to a nearest frequency mentioned in the clock plan.
The current lmh dcvs driver exposes this request without matching to
a frequency value in the OPP table.
In order to reflect the final mitigated frequency, match the mitigation
frequency request from LMH DCVSh to a nearest CPU frequency floor
in OPP table.
Change-Id: Iffc380898eac33f6c30c3808eb38d7bb499f5769
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
| -rw-r--r-- | drivers/thermal/msm_lmh_dcvs.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/thermal/msm_lmh_dcvs.c b/drivers/thermal/msm_lmh_dcvs.c index ac62143d1e87..3758e39a1c02 100644 --- a/drivers/thermal/msm_lmh_dcvs.c +++ b/drivers/thermal/msm_lmh_dcvs.c @@ -107,13 +107,29 @@ static void msm_lmh_dcvs_get_max_freq(uint32_t cpu, uint32_t *max_freq) static uint32_t msm_lmh_mitigation_notify(struct msm_lmh_dcvs_hw *hw) { uint32_t max_limit = 0, val = 0; + struct device *cpu_dev = NULL; + unsigned long freq_val; val = readl_relaxed(hw->osm_hw_reg); dcvsh_get_frequency(val, max_limit); + cpu_dev = get_cpu_device(cpumask_first(&hw->core_map)); + if (!cpu_dev) { + pr_err("Error in get CPU%d device\n", + cpumask_first(&hw->core_map)); + goto notify_exit; + } + + freq_val = max_limit; + rcu_read_lock(); + dev_pm_opp_find_freq_floor(cpu_dev, &freq_val); + rcu_read_unlock(); + max_limit = freq_val; + sched_update_cpu_freq_min_max(&hw->core_map, 0, max_limit); trace_lmh_dcvs_freq(cpumask_first(&hw->core_map), max_limit); - hw->hw_freq_limit = max_limit; +notify_exit: + hw->hw_freq_limit = max_limit; return max_limit; } |
