diff options
Diffstat (limited to 'drivers/thermal')
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 11 | ||||
-rw-r--r-- | drivers/thermal/exynos_thermal.c | 24 |
2 files changed, 13 insertions, 22 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 9e208d300647..e03891b03c9b 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -196,6 +196,17 @@ static int get_property(unsigned int cpu, unsigned long input, | |||
196 | return -EINVAL; | 196 | return -EINVAL; |
197 | } | 197 | } |
198 | 198 | ||
199 | unsigned long cpufreq_cooling_get_level(unsigned int cpu, unsigned int freq) | ||
200 | { | ||
201 | unsigned int val; | ||
202 | |||
203 | if (get_property(cpu, (unsigned long)freq, &val, GET_LEVEL)) | ||
204 | return THERMAL_CSTATE_INVALID; | ||
205 | return (unsigned long)val; | ||
206 | } | ||
207 | |||
208 | EXPORT_SYMBOL(cpufreq_cooling_get_level); | ||
209 | |||
199 | /** | 210 | /** |
200 | * get_cpu_frequency - get the absolute value of frequency from level. | 211 | * get_cpu_frequency - get the absolute value of frequency from level. |
201 | * @cpu: cpu for which frequency is fetched. | 212 | * @cpu: cpu for which frequency is fetched. |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index 46568c078dee..541257888c3e 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -242,26 +242,6 @@ static int exynos_get_crit_temp(struct thermal_zone_device *thermal, | |||
242 | return ret; | 242 | return ret; |
243 | } | 243 | } |
244 | 244 | ||
245 | static int exynos_get_frequency_level(unsigned int cpu, unsigned int freq) | ||
246 | { | ||
247 | int i = 0, ret = -EINVAL; | ||
248 | struct cpufreq_frequency_table *table = NULL; | ||
249 | #ifdef CONFIG_CPU_FREQ | ||
250 | table = cpufreq_frequency_get_table(cpu); | ||
251 | #endif | ||
252 | if (!table) | ||
253 | return ret; | ||
254 | |||
255 | while (table[i].frequency != CPUFREQ_TABLE_END) { | ||
256 | if (table[i].frequency == CPUFREQ_ENTRY_INVALID) | ||
257 | continue; | ||
258 | if (table[i].frequency == freq) | ||
259 | return i; | ||
260 | i++; | ||
261 | } | ||
262 | return ret; | ||
263 | } | ||
264 | |||
265 | /* Bind callback functions for thermal zone */ | 245 | /* Bind callback functions for thermal zone */ |
266 | static int exynos_bind(struct thermal_zone_device *thermal, | 246 | static int exynos_bind(struct thermal_zone_device *thermal, |
267 | struct thermal_cooling_device *cdev) | 247 | struct thermal_cooling_device *cdev) |
@@ -288,8 +268,8 @@ static int exynos_bind(struct thermal_zone_device *thermal, | |||
288 | /* Bind the thermal zone to the cpufreq cooling device */ | 268 | /* Bind the thermal zone to the cpufreq cooling device */ |
289 | for (i = 0; i < tab_size; i++) { | 269 | for (i = 0; i < tab_size; i++) { |
290 | clip_data = (struct freq_clip_table *)&(tab_ptr[i]); | 270 | clip_data = (struct freq_clip_table *)&(tab_ptr[i]); |
291 | level = exynos_get_frequency_level(0, clip_data->freq_clip_max); | 271 | level = cpufreq_cooling_get_level(0, clip_data->freq_clip_max); |
292 | if (level < 0) | 272 | if (level == THERMAL_CSTATE_INVALID) |
293 | return 0; | 273 | return 0; |
294 | switch (GET_ZONE(i)) { | 274 | switch (GET_ZONE(i)) { |
295 | case MONITOR_ZONE: | 275 | case MONITOR_ZONE: |