Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ced255c0 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 4401555a 97584d18
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+10 −0
Original line number Diff line number Diff line
@@ -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
+9 −8
Original line number Diff line number Diff line
@@ -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
@@ -182,7 +182,7 @@ 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
@@ -190,7 +190,7 @@ config SPEAR_THERMAL

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
@@ -208,7 +208,7 @@ 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
@@ -216,7 +216,7 @@ config KIRKWOOD_THERMAL

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
@@ -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
@@ -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

@@ -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)
+31 −21
Original line number Diff line number Diff line
@@ -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)
@@ -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) {
@@ -284,24 +284,20 @@ 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);
@@ -309,6 +305,12 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
		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;

@@ -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;
}

@@ -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",
@@ -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:
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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 = {
Loading