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

Commit 448bfad8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull thermal fixes from Zhang Rui:
 "Specifics:

   - update Email address of Thermal subsystem maintainer Eduardo
     Valentin.

   - fix a problem that unloading thermal module results in kernel crash
     because a non-exist device file is removed on thermal unload.

   - fix a problem that critical trip point is set wrongly on latest
     i.MX6 SOC and results in system critical shutdown.

   - a couple of fixes to Tmon tool, of-thermal code and ti thermal
     driver"

* 'for-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  tmon: set umask to a reasonable value
  tmon: Check log file for common secuirty issues
  tools/thermal: tmon: fix compilation errors when building statically
  thermal: ti-soc-thermal: ti-bandgap.c: Cleaning up wrong address is checked
  Thermal: imx: correct critical trip temperature setting
  thermal: Bind cooling devices with the correct arguments
  thermal: Add braces around suspect code
  thermal: hwmon: Make the check for critical temp valid consistent
  MAINTAINERS: Update Eduardo Valentin's email address
parents 4c2f503a 4adccf9f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -8984,7 +8984,7 @@ F: drivers/media/radio/radio-raremono.c

THERMAL
M:	Zhang Rui <rui.zhang@intel.com>
M:	Eduardo Valentin <eduardo.valentin@ti.com>
M:	Eduardo Valentin <edubezval@gmail.com>
L:	linux-pm@vger.kernel.org
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal.git
@@ -9011,7 +9011,7 @@ S: Maintained
F:	drivers/platform/x86/thinkpad_acpi.c

TI BANDGAP AND THERMAL DRIVER
M:	Eduardo Valentin <eduardo.valentin@ti.com>
M:	Eduardo Valentin <edubezval@gmail.com>
L:	linux-pm@vger.kernel.org
S:	Supported
F:	drivers/thermal/ti-soc-thermal/
+7 −11
Original line number Diff line number Diff line
@@ -306,7 +306,7 @@ static int imx_get_sensor_data(struct platform_device *pdev)
{
	struct imx_thermal_data *data = platform_get_drvdata(pdev);
	struct regmap *map;
	int t1, t2, n1, n2;
	int t1, n1;
	int ret;
	u32 val;
	u64 temp64;
@@ -333,14 +333,10 @@ static int imx_get_sensor_data(struct platform_device *pdev)
	/*
	 * Sensor data layout:
	 *   [31:20] - sensor value @ 25C
	 *    [19:8] - sensor value of hot
	 *     [7:0] - hot temperature value
	 * Use universal formula now and only need sensor value @ 25C
	 * slope = 0.4297157 - (0.0015976 * 25C fuse)
	 */
	n1 = val >> 20;
	n2 = (val & 0xfff00) >> 8;
	t2 = val & 0xff;
	t1 = 25; /* t1 always 25C */

	/*
@@ -366,16 +362,16 @@ static int imx_get_sensor_data(struct platform_device *pdev)
	data->c2 = n1 * data->c1 + 1000 * t1;

	/*
	 * Set the default passive cooling trip point to 20 °C below the
	 * maximum die temperature. Can be changed from userspace.
	 * Set the default passive cooling trip point,
	 * can be changed from userspace.
	 */
	data->temp_passive = 1000 * (t2 - 20);
	data->temp_passive = IMX_TEMP_PASSIVE;

	/*
	 * The maximum die temperature is t2, let's give 5 °C cushion
	 * for noise and possible temperature rise between measurements.
	 * The maximum die temperature set to 20 C higher than
	 * IMX_TEMP_PASSIVE.
	 */
	data->temp_critical = 1000 * (t2 - 5);
	data->temp_critical = 1000 * 20 + data->temp_passive;

	return 0;
}
+4 −3
Original line number Diff line number Diff line
@@ -156,8 +156,8 @@ static int of_thermal_bind(struct thermal_zone_device *thermal,

			ret = thermal_zone_bind_cooling_device(thermal,
						tbp->trip_id, cdev,
						tbp->min,
						tbp->max);
						tbp->max,
						tbp->min);
			if (ret)
				return ret;
		}
@@ -712,11 +712,12 @@ thermal_of_build_thermal_zone(struct device_node *np)
	}

	i = 0;
	for_each_child_of_node(child, gchild)
	for_each_child_of_node(child, gchild) {
		ret = thermal_of_populate_bind_params(gchild, &tz->tbps[i++],
						      tz->trips, tz->ntrips);
		if (ret)
			goto free_tbps;
	}

finish:
	of_node_put(child);
+18 −15
Original line number Diff line number Diff line
@@ -140,6 +140,12 @@ thermal_hwmon_lookup_temp(const struct thermal_hwmon_device *hwmon,
	return NULL;
}

static bool thermal_zone_crit_temp_valid(struct thermal_zone_device *tz)
{
	unsigned long temp;
	return tz->ops->get_crit_temp && !tz->ops->get_crit_temp(tz, &temp);
}

int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
{
	struct thermal_hwmon_device *hwmon;
@@ -189,9 +195,7 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
	if (result)
		goto free_temp_mem;

	if (tz->ops->get_crit_temp) {
		unsigned long temperature;
		if (!tz->ops->get_crit_temp(tz, &temperature)) {
	if (thermal_zone_crit_temp_valid(tz)) {
		snprintf(temp->temp_crit.name,
				sizeof(temp->temp_crit.name),
				"temp%d_crit", hwmon->count);
@@ -204,7 +208,6 @@ int thermal_add_hwmon_sysfs(struct thermal_zone_device *tz)
		if (result)
			goto unregister_input;
	}
	}

	mutex_lock(&thermal_hwmon_list_lock);
	if (new_hwmon_device)
@@ -250,7 +253,7 @@ void thermal_remove_hwmon_sysfs(struct thermal_zone_device *tz)
	}

	device_remove_file(hwmon->device, &temp->temp_input.attr);
	if (tz->ops->get_crit_temp)
	if (thermal_zone_crit_temp_valid(tz))
		device_remove_file(hwmon->device, &temp->temp_crit.attr);

	mutex_lock(&thermal_hwmon_list_lock);
+1 −1
Original line number Diff line number Diff line
@@ -1155,7 +1155,7 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
	/* register shadow for context save and restore */
	bgp->regval = devm_kzalloc(&pdev->dev, sizeof(*bgp->regval) *
				   bgp->conf->sensor_count, GFP_KERNEL);
	if (!bgp) {
	if (!bgp->regval) {
		dev_err(&pdev->dev, "Unable to allocate mem for driver ref\n");
		return ERR_PTR(-ENOMEM);
	}
Loading