From: Hyeonseong Gil Date: Mon, 13 Aug 2018 05:16:30 +0000 (+0900) Subject: [RAMEN9610-10216][COMMON] thermal: gpu_cooling: Modify GPU Frequency unit to KHz X-Git-Tag: MMI-PSA29.97-13-9~1083 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3eb888aad5aeb12907879168f11557d67e92492a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [RAMEN9610-10216][COMMON] thermal: gpu_cooling: Modify GPU Frequency unit to KHz GPU API was modified to use KHz frequency. Change-Id: I0870cccf51cffd3f7b3b42f94ce7a245e2f6cffe Signed-off-by: Hyeonseong Gil --- diff --git a/drivers/thermal/gpu_cooling.c b/drivers/thermal/gpu_cooling.c index a795d8f5a65f..fef41031919a 100644 --- a/drivers/thermal/gpu_cooling.c +++ b/drivers/thermal/gpu_cooling.c @@ -297,7 +297,7 @@ static int build_dyn_power_table(struct gpufreq_cooling_device *gpufreq_cdev, freq = gpu_dvfs_get_clock(num_opps - i - 1); - if (freq > gpu_dvfs_get_max_freq()) + if (freq > gpu_dvfs_get_max_freq() || freq == 0) continue; voltage_mv = gpu_dvfs_get_voltage(freq) / 1000; @@ -306,7 +306,7 @@ static int build_dyn_power_table(struct gpufreq_cooling_device *gpufreq_cdev, * Do the multiplication with MHz and millivolt so as * to not overflow. */ - power = (u64)capacitance * freq * voltage_mv * voltage_mv; + power = (u64)capacitance * (freq / 1000) * voltage_mv * voltage_mv; do_div(power, 1000000000); power_table[i].frequency = (unsigned int)freq; @@ -564,7 +564,6 @@ static int gpufreq_apply_cooling(struct gpufreq_cooling_device *gpufreq_cdev, return -EINVAL; } - gpu_cooling_freq = gpu_cooling_freq / 1000; blocking_notifier_call_chain(&gpu_notifier, GPU_THROTTLING, &gpu_cooling_freq); return 0; @@ -742,7 +741,7 @@ static int gpufreq_state2power(struct thermal_cooling_device *cdev, int ret; struct gpufreq_cooling_device *gpufreq_cdev = cdev->devdata; - freq = gpu_freq_table[state].frequency / 1000; + freq = gpu_freq_table[state].frequency; if (!freq) return -EINVAL; @@ -794,7 +793,7 @@ static int gpufreq_power2state(struct thermal_cooling_device *cdev, dyn_power = dyn_power > 0 ? dyn_power : 0; target_freq = gpu_power_to_freq(gpufreq_cdev, dyn_power); - *state = gpufreq_cooling_get_level(0, target_freq * 1000); + *state = gpufreq_cooling_get_level(0, target_freq); if (*state == THERMAL_CSTATE_INVALID) { pr_warn("Failed to convert %dKHz for gpu into a cdev state\n", target_freq); @@ -1041,7 +1040,7 @@ static int gpu_cooling_table_init(void) gpu_freq_table[count].flags = 0; gpu_freq_table[count].driver_data = count; - gpu_freq_table[count].frequency = (unsigned int)freq * 1000; + gpu_freq_table[count].frequency = (unsigned int)freq; pr_info("[GPU cooling] index : %d, frequency : %d\n", gpu_freq_table[count].driver_data, gpu_freq_table[count].frequency);