Skip to content

Commit

Permalink
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…rzhang/linux

Pull thermal management fixes from Zhang Rui:

 - Power allocator governor changes to allow binding on thermal zones
   with missing power estimates information.  From Javi Merino.

 - Add compile test flags on thermal drivers that allow it without
   producing compilation errors.  From Eduardo Valentin.

 - Fixes around memory allocation on cpu_cooling.  From Javi Merino.

 - Fix on db8500 cpufreq code to allow autoload.  From Luis de
   Bethencourt.

 - Maintainer entries for cpu cooling device

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  thermal: power_allocator: exit early if there are no cooling devices
  thermal: power_allocator: don't require tzp to be present for the thermal zone
  thermal: power_allocator: relax the requirement of two passive trip points
  thermal: power_allocator: relax the requirement of a sustainable_power in tzp
  thermal: Add a function to get the minimum power
  thermal: cpu_cooling: free power table on error or when unregistering
  thermal: cpu_cooling: don't call kcalloc() under rcu_read_lock
  thermal: db8500_cpufreq_cooling: Fix module autoload for OF platform driver
  thermal: cpu_cooling: Add MAINTAINERS entry
  thermal: ti-soc: Kconfig fix to avoid menu showing wrongly
  thermal: ti-soc: allow compile test
  thermal: qcom_spmi: allow compile test
  thermal: exynos: allow compile test
  thermal: armada: allow compile test
  thermal: dove: allow compile test
  thermal: kirkwood: allow compile test
  thermal: rockchip: allow compile test
  thermal: spear: allow compile test
  thermal: hisi: allow compile test
  thermal: Fix thermal_zone_of_sensor_register to match documentation
  • Loading branch information
Linus Torvalds committed Sep 25, 2015
2 parents 4401555 + 97584d1 commit ced255c
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Documentation/thermal/power_allocator.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Power allocator governor tunables
Trip points
-----------

The governor requires the following two passive trip points:
The governor works optimally with the following two passive trip points:

1. "switch on" trip point: temperature above which the governor
control loop starts operating. This is the first passive trip
Expand Down
10 changes: 10 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -10338,6 +10338,16 @@ F: include/uapi/linux/thermal.h
F: include/linux/cpu_cooling.h
F: Documentation/devicetree/bindings/thermal/

THERMAL/CPU_COOLING
M: Amit Daniel Kachhap <amit.kachhap@gmail.com>
M: Viresh Kumar <viresh.kumar@linaro.org>
M: Javi Merino <javi.merino@arm.com>
L: linux-pm@vger.kernel.org
S: Supported
F: Documentation/thermal/cpu-cooling-api.txt
F: drivers/thermal/cpu_cooling.c
F: include/linux/cpu_cooling.h

THINGM BLINK(1) USB RGB LED DRIVER
M: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
S: Maintained
Expand Down
17 changes: 9 additions & 8 deletions drivers/thermal/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ config THERMAL_EMULATION

config HISI_THERMAL
tristate "Hisilicon thermal driver"
depends on ARCH_HISI && CPU_THERMAL && OF
depends on (ARCH_HISI && CPU_THERMAL && OF) || COMPILE_TEST
help
Enable this to plug hisilicon's thermal sensor driver into the Linux
thermal framework. cpufreq is used as the cooling device to throttle
Expand All @@ -182,15 +182,15 @@ config IMX_THERMAL

config SPEAR_THERMAL
bool "SPEAr thermal sensor driver"
depends on PLAT_SPEAR
depends on PLAT_SPEAR || COMPILE_TEST
depends on OF
help
Enable this to plug the SPEAr thermal sensor driver into the Linux
thermal framework.

config ROCKCHIP_THERMAL
tristate "Rockchip thermal driver"
depends on ARCH_ROCKCHIP
depends on ARCH_ROCKCHIP || COMPILE_TEST
depends on RESET_CONTROLLER
help
Rockchip thermal driver provides support for Temperature sensor
Expand All @@ -208,15 +208,15 @@ config RCAR_THERMAL

config KIRKWOOD_THERMAL
tristate "Temperature sensor on Marvell Kirkwood SoCs"
depends on MACH_KIRKWOOD
depends on MACH_KIRKWOOD || COMPILE_TEST
depends on OF
help
Support for the Kirkwood thermal sensor driver into the Linux thermal
framework. Only kirkwood 88F6282 and 88F6283 have this sensor.

config DOVE_THERMAL
tristate "Temperature sensor on Marvell Dove SoCs"
depends on ARCH_DOVE || MACH_DOVE
depends on ARCH_DOVE || MACH_DOVE || COMPILE_TEST
depends on OF
help
Support for the Dove thermal sensor driver in the Linux thermal
Expand All @@ -234,7 +234,7 @@ config DB8500_THERMAL

config ARMADA_THERMAL
tristate "Armada 370/XP thermal management"
depends on ARCH_MVEBU
depends on ARCH_MVEBU || COMPILE_TEST
depends on OF
help
Enable this option if you want to have support for thermal management
Expand Down Expand Up @@ -349,11 +349,12 @@ config INTEL_PCH_THERMAL
programmable trip points and other information.

menu "Texas Instruments thermal drivers"
depends on ARCH_HAS_BANDGAP || COMPILE_TEST
source "drivers/thermal/ti-soc-thermal/Kconfig"
endmenu

menu "Samsung thermal drivers"
depends on ARCH_EXYNOS
depends on ARCH_EXYNOS || COMPILE_TEST
source "drivers/thermal/samsung/Kconfig"
endmenu

Expand All @@ -364,7 +365,7 @@ endmenu

config QCOM_SPMI_TEMP_ALARM
tristate "Qualcomm SPMI PMIC Temperature Alarm"
depends on OF && SPMI && IIO
depends on OF && (SPMI || COMPILE_TEST) && IIO
select REGMAP_SPMI
help
This enables a thermal sysfs driver for Qualcomm plug-and-play (QPNP)
Expand Down
52 changes: 31 additions & 21 deletions drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
* efficiently. Power is stored in mW, frequency in KHz. The
* resulting table is in ascending order.
*
* Return: 0 on success, -E* on error.
* Return: 0 on success, -EINVAL if there are no OPPs for any CPUs,
* -ENOMEM if we run out of memory or -EAGAIN if an OPP was
* added/enabled while the function was executing.
*/
static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
u32 capacitance)
Expand All @@ -273,8 +275,6 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
int num_opps = 0, cpu, i, ret = 0;
unsigned long freq;

rcu_read_lock();

for_each_cpu(cpu, &cpufreq_device->allowed_cpus) {
dev = get_cpu_device(cpu);
if (!dev) {
Expand All @@ -284,31 +284,33 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
}

num_opps = dev_pm_opp_get_opp_count(dev);
if (num_opps > 0) {
if (num_opps > 0)
break;
} else if (num_opps < 0) {
ret = num_opps;
goto unlock;
}
else if (num_opps < 0)
return num_opps;
}

if (num_opps == 0) {
ret = -EINVAL;
goto unlock;
}
if (num_opps == 0)
return -EINVAL;

power_table = kcalloc(num_opps, sizeof(*power_table), GFP_KERNEL);
if (!power_table) {
ret = -ENOMEM;
goto unlock;
}
if (!power_table)
return -ENOMEM;

rcu_read_lock();

for (freq = 0, i = 0;
opp = dev_pm_opp_find_freq_ceil(dev, &freq), !IS_ERR(opp);
freq++, i++) {
u32 freq_mhz, voltage_mv;
u64 power;

if (i >= num_opps) {
rcu_read_unlock();
ret = -EAGAIN;
goto free_power_table;
}

freq_mhz = freq / 1000000;
voltage_mv = dev_pm_opp_get_voltage(opp) / 1000;

Expand All @@ -326,17 +328,22 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
power_table[i].power = power;
}

if (i == 0) {
rcu_read_unlock();

if (i != num_opps) {
ret = PTR_ERR(opp);
goto unlock;
goto free_power_table;
}

cpufreq_device->cpu_dev = dev;
cpufreq_device->dyn_power_table = power_table;
cpufreq_device->dyn_power_table_entries = i;

unlock:
rcu_read_unlock();
return 0;

free_power_table:
kfree(power_table);

return ret;
}

Expand Down Expand Up @@ -847,7 +854,7 @@ __cpufreq_cooling_register(struct device_node *np,
ret = get_idr(&cpufreq_idr, &cpufreq_dev->id);
if (ret) {
cool_dev = ERR_PTR(ret);
goto free_table;
goto free_power_table;
}

snprintf(dev_name, sizeof(dev_name), "thermal-cpufreq-%d",
Expand Down Expand Up @@ -889,6 +896,8 @@ __cpufreq_cooling_register(struct device_node *np,

remove_idr:
release_idr(&cpufreq_idr, cpufreq_dev->id);
free_power_table:
kfree(cpufreq_dev->dyn_power_table);
free_table:
kfree(cpufreq_dev->freq_table);
free_time_in_idle_timestamp:
Expand Down Expand Up @@ -1039,6 +1048,7 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)

thermal_cooling_device_unregister(cpufreq_dev->cool_dev);
release_idr(&cpufreq_idr, cpufreq_dev->id);
kfree(cpufreq_dev->dyn_power_table);
kfree(cpufreq_dev->time_in_idle_timestamp);
kfree(cpufreq_dev->time_in_idle);
kfree(cpufreq_dev->freq_table);
Expand Down
1 change: 1 addition & 0 deletions drivers/thermal/db8500_cpufreq_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static const struct of_device_id db8500_cpufreq_cooling_match[] = {
{ .compatible = "stericsson,db8500-cpufreq-cooling" },
{},
};
MODULE_DEVICE_TABLE(of, db8500_cpufreq_cooling_match);
#endif

static struct platform_driver db8500_cpufreq_cooling_driver = {
Expand Down
Loading

0 comments on commit ced255c

Please sign in to comment.