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;
* 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;
return -EINVAL;
}
- gpu_cooling_freq = gpu_cooling_freq / 1000;
blocking_notifier_call_chain(&gpu_notifier, GPU_THROTTLING, &gpu_cooling_freq);
return 0;
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;
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);
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);