Commit cba3b00deab5a8564d61ec18e61ba6ba82203299
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal
Pull thermal fixes from Eduardo Valentin: "In this -rc still very minor changes: - Lee Jones fixes compilation warning in sti thermal driver - Marjus Elfring removes unnecessary checks in exynos thermal driver (as per coccinelle) - Now we always update cpufreq policies, and thus get (hopefully) always in sync with cpufreq, thanks to Yadwinder" * 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal: thermal: Exynos: Deletion of unnecessary checks before two function calls thermal: sti: Ignore suspend/resume functions when !PM_SLEEP thermal: cpu_cooling: Update always cpufreq policy with thermal constraints
Showing 3 changed files Side-by-side Diff
drivers/thermal/cpu_cooling.c
... | ... | @@ -50,15 +50,14 @@ |
50 | 50 | unsigned int cpufreq_state; |
51 | 51 | unsigned int cpufreq_val; |
52 | 52 | struct cpumask allowed_cpus; |
53 | + struct list_head node; | |
53 | 54 | }; |
54 | 55 | static DEFINE_IDR(cpufreq_idr); |
55 | 56 | static DEFINE_MUTEX(cooling_cpufreq_lock); |
56 | 57 | |
57 | 58 | static unsigned int cpufreq_dev_count; |
58 | 59 | |
59 | -/* notify_table passes value to the CPUFREQ_ADJUST callback function. */ | |
60 | -#define NOTIFY_INVALID NULL | |
61 | -static struct cpufreq_cooling_device *notify_device; | |
60 | +static LIST_HEAD(cpufreq_dev_list); | |
62 | 61 | |
63 | 62 | /** |
64 | 63 | * get_idr - function to get a unique id. |
65 | 64 | |
... | ... | @@ -287,15 +286,12 @@ |
287 | 286 | |
288 | 287 | cpufreq_device->cpufreq_state = cooling_state; |
289 | 288 | cpufreq_device->cpufreq_val = clip_freq; |
290 | - notify_device = cpufreq_device; | |
291 | 289 | |
292 | 290 | for_each_cpu(cpuid, mask) { |
293 | 291 | if (is_cpufreq_valid(cpuid)) |
294 | 292 | cpufreq_update_policy(cpuid); |
295 | 293 | } |
296 | 294 | |
297 | - notify_device = NOTIFY_INVALID; | |
298 | - | |
299 | 295 | return 0; |
300 | 296 | } |
301 | 297 | |
302 | 298 | |
303 | 299 | |
304 | 300 | |
305 | 301 | |
306 | 302 | |
... | ... | @@ -316,22 +312,29 @@ |
316 | 312 | { |
317 | 313 | struct cpufreq_policy *policy = data; |
318 | 314 | unsigned long max_freq = 0; |
315 | + struct cpufreq_cooling_device *cpufreq_dev; | |
319 | 316 | |
320 | - if (event != CPUFREQ_ADJUST || notify_device == NOTIFY_INVALID) | |
317 | + if (event != CPUFREQ_ADJUST) | |
321 | 318 | return 0; |
322 | 319 | |
323 | - if (cpumask_test_cpu(policy->cpu, ¬ify_device->allowed_cpus)) | |
324 | - max_freq = notify_device->cpufreq_val; | |
325 | - else | |
326 | - return 0; | |
320 | + mutex_lock(&cooling_cpufreq_lock); | |
321 | + list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) { | |
322 | + if (!cpumask_test_cpu(policy->cpu, | |
323 | + &cpufreq_dev->allowed_cpus)) | |
324 | + continue; | |
327 | 325 | |
328 | - /* Never exceed user_policy.max */ | |
329 | - if (max_freq > policy->user_policy.max) | |
330 | - max_freq = policy->user_policy.max; | |
326 | + if (!cpufreq_dev->cpufreq_val) | |
327 | + cpufreq_dev->cpufreq_val = get_cpu_frequency( | |
328 | + cpumask_any(&cpufreq_dev->allowed_cpus), | |
329 | + cpufreq_dev->cpufreq_state); | |
331 | 330 | |
332 | - if (policy->max != max_freq) | |
333 | - cpufreq_verify_within_limits(policy, 0, max_freq); | |
331 | + max_freq = cpufreq_dev->cpufreq_val; | |
334 | 332 | |
333 | + if (policy->max != max_freq) | |
334 | + cpufreq_verify_within_limits(policy, 0, max_freq); | |
335 | + } | |
336 | + mutex_unlock(&cooling_cpufreq_lock); | |
337 | + | |
335 | 338 | return 0; |
336 | 339 | } |
337 | 340 | |
... | ... | @@ -486,6 +489,7 @@ |
486 | 489 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, |
487 | 490 | CPUFREQ_POLICY_NOTIFIER); |
488 | 491 | cpufreq_dev_count++; |
492 | + list_add(&cpufreq_dev->node, &cpufreq_dev_list); | |
489 | 493 | |
490 | 494 | mutex_unlock(&cooling_cpufreq_lock); |
491 | 495 | |
... | ... | @@ -549,6 +553,7 @@ |
549 | 553 | |
550 | 554 | cpufreq_dev = cdev->devdata; |
551 | 555 | mutex_lock(&cooling_cpufreq_lock); |
556 | + list_del(&cpufreq_dev->node); | |
552 | 557 | cpufreq_dev_count--; |
553 | 558 | |
554 | 559 | /* Unregister the notifier for the last cpufreq cooling device */ |
drivers/thermal/samsung/exynos_thermal_common.c
... | ... | @@ -417,13 +417,10 @@ |
417 | 417 | |
418 | 418 | th_zone = sensor_conf->pzone_data; |
419 | 419 | |
420 | - if (th_zone->therm_dev) | |
421 | - thermal_zone_device_unregister(th_zone->therm_dev); | |
420 | + thermal_zone_device_unregister(th_zone->therm_dev); | |
422 | 421 | |
423 | - for (i = 0; i < th_zone->cool_dev_size; i++) { | |
424 | - if (th_zone->cool_dev[i]) | |
425 | - cpufreq_cooling_unregister(th_zone->cool_dev[i]); | |
426 | - } | |
422 | + for (i = 0; i < th_zone->cool_dev_size; ++i) | |
423 | + cpufreq_cooling_unregister(th_zone->cool_dev[i]); | |
427 | 424 | |
428 | 425 | dev_info(sensor_conf->dev, |
429 | 426 | "Exynos: Kernel Thermal management unregistered\n"); |
drivers/thermal/st/st_thermal.c
... | ... | @@ -275,6 +275,7 @@ |
275 | 275 | } |
276 | 276 | EXPORT_SYMBOL_GPL(st_thermal_unregister); |
277 | 277 | |
278 | +#ifdef CONFIG_PM_SLEEP | |
278 | 279 | static int st_thermal_suspend(struct device *dev) |
279 | 280 | { |
280 | 281 | struct platform_device *pdev = to_platform_device(dev); |
... | ... | @@ -305,6 +306,8 @@ |
305 | 306 | |
306 | 307 | return 0; |
307 | 308 | } |
309 | +#endif | |
310 | + | |
308 | 311 | SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume); |
309 | 312 | EXPORT_SYMBOL_GPL(st_thermal_pm_ops); |
310 | 313 |