Skip to content

Commit 5c4a608

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui: - Add locking for cooling device sysfs attribute in case the cooling device state is changed by userspace and thermal framework simultaneously. (Thara Gopinath) - Fix a problem that passive cooling is reset improperly after system suspend/resume. (Wei Wang) - Cleanup the driver/thermal/ directory by moving intel and qcom platform specific drivers to platform specific sub-directories. (Amit Kucheria) - Some trivial cleanups. (Lukasz Luba, Wolfram Sang) * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal/intel: fixup for Kconfig string parsing tightening up drivers: thermal: Move QCOM_SPMI_TEMP_ALARM into the qcom subdir drivers: thermal: Move various drivers for intel platforms into a subdir thermal: Fix locking in cooling device sysfs update cur_state Thermal: do not clear passive state during system sleep thermal: zx2967_thermal: simplify getting .driver_data thermal: st: st_thermal: simplify getting .driver_data thermal: spear_thermal: simplify getting .driver_data thermal: rockchip_thermal: simplify getting .driver_data thermal: int340x_thermal: int3400_thermal: simplify getting .driver_data thermal: remove unused function parameter
2 parents c280230 + 24ef9ec commit 5c4a608

32 files changed

+138
-135
lines changed

drivers/thermal/Kconfig

Lines changed: 5 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -326,84 +326,6 @@ config DA9062_THERMAL
326326
zone.
327327
Compatible with the DA9062 and DA9061 PMICs.
328328

329-
config INTEL_POWERCLAMP
330-
tristate "Intel PowerClamp idle injection driver"
331-
depends on THERMAL
332-
depends on X86
333-
depends on CPU_SUP_INTEL
334-
help
335-
Enable this to enable Intel PowerClamp idle injection driver. This
336-
enforce idle time which results in more package C-state residency. The
337-
user interface is exposed via generic thermal framework.
338-
339-
config X86_PKG_TEMP_THERMAL
340-
tristate "X86 package temperature thermal driver"
341-
depends on X86_THERMAL_VECTOR
342-
select THERMAL_GOV_USER_SPACE
343-
select THERMAL_WRITABLE_TRIPS
344-
default m
345-
help
346-
Enable this to register CPU digital sensor for package temperature as
347-
thermal zone. Each package will have its own thermal zone. There are
348-
two trip points which can be set by user to get notifications via thermal
349-
notification methods.
350-
351-
config INTEL_SOC_DTS_IOSF_CORE
352-
tristate
353-
depends on X86 && PCI
354-
select IOSF_MBI
355-
help
356-
This is becoming a common feature for Intel SoCs to expose the additional
357-
digital temperature sensors (DTSs) using side band interface (IOSF). This
358-
implements the common set of helper functions to register, get temperature
359-
and get/set thresholds on DTSs.
360-
361-
config INTEL_SOC_DTS_THERMAL
362-
tristate "Intel SoCs DTS thermal driver"
363-
depends on X86 && PCI && ACPI
364-
select INTEL_SOC_DTS_IOSF_CORE
365-
select THERMAL_WRITABLE_TRIPS
366-
help
367-
Enable this to register Intel SoCs (e.g. Bay Trail) platform digital
368-
temperature sensor (DTS). These SoCs have two additional DTSs in
369-
addition to DTSs on CPU cores. Each DTS will be registered as a
370-
thermal zone. There are two trip points. One of the trip point can
371-
be set by user mode programs to get notifications via Linux thermal
372-
notification methods.The other trip is a critical trip point, which
373-
was set by the driver based on the TJ MAX temperature.
374-
375-
config INTEL_QUARK_DTS_THERMAL
376-
tristate "Intel Quark DTS thermal driver"
377-
depends on X86_INTEL_QUARK
378-
help
379-
Enable this to register Intel Quark SoC (e.g. X1000) platform digital
380-
temperature sensor (DTS). For X1000 SoC, it has one on-die DTS.
381-
The DTS will be registered as a thermal zone. There are two trip points:
382-
hot & critical. The critical trip point default value is set by
383-
underlying BIOS/Firmware.
384-
385-
menu "ACPI INT340X thermal drivers"
386-
source "drivers/thermal/int340x_thermal/Kconfig"
387-
endmenu
388-
389-
config INTEL_BXT_PMIC_THERMAL
390-
tristate "Intel Broxton PMIC thermal driver"
391-
depends on X86 && INTEL_SOC_PMIC_BXTWC && REGMAP
392-
help
393-
Select this driver for Intel Broxton PMIC with ADC channels monitoring
394-
system temperature measurements and alerts.
395-
This driver is used for monitoring the ADC channels of PMIC and handles
396-
the alert trip point interrupts and notifies the thermal framework with
397-
the trip point and temperature details of the zone.
398-
399-
config INTEL_PCH_THERMAL
400-
tristate "Intel PCH Thermal Reporting Driver"
401-
depends on X86 && PCI
402-
help
403-
Enable this to support thermal reporting on certain intel PCHs.
404-
Thermal reporting device will provide temperature reading,
405-
programmable trip points and other information.
406-
407329
config MTK_THERMAL
408330
tristate "Temperature sensor driver for mediatek SoCs"
409331
depends on ARCH_MEDIATEK || COMPILE_TEST
@@ -415,6 +337,11 @@ config MTK_THERMAL
415337
Enable this option if you want to have support for thermal management
416338
controller present in Mediatek SoCs
417339

340+
menu "Intel thermal drivers"
341+
depends on X86 || X86_INTEL_QUARK || COMPILE_TEST
342+
source "drivers/thermal/intel/Kconfig"
343+
endmenu
344+
418345
menu "Broadcom thermal drivers"
419346
depends on ARCH_BCM || ARCH_BRCMSTB || ARCH_BCM2835 || COMPILE_TEST
420347
source "drivers/thermal/broadcom/Kconfig"
@@ -447,17 +374,6 @@ config TANGO_THERMAL
447374

448375
source "drivers/thermal/tegra/Kconfig"
449376

450-
config QCOM_SPMI_TEMP_ALARM
451-
tristate "Qualcomm SPMI PMIC Temperature Alarm"
452-
depends on OF && SPMI && IIO
453-
select REGMAP_SPMI
454-
help
455-
This enables a thermal sysfs driver for Qualcomm plug-and-play (QPNP)
456-
PMIC devices. It shows up in sysfs as a thermal sensor with multiple
457-
trip points. The temperature reported by the thermal sensor reflects the
458-
real time die temperature if an ADC is present or an estimate of the
459-
temperature based upon the over temperature stage value.
460-
461377
config GENERIC_ADC_THERMAL
462378
tristate "Generic ADC based thermal sensor"
463379
depends on IIO

drivers/thermal/Makefile

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ thermal_sys-$(CONFIG_DEVFREQ_THERMAL) += devfreq_cooling.o
2929

3030
# platform thermal drivers
3131
obj-y += broadcom/
32-
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o
3332
obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
3433
obj-$(CONFIG_ROCKCHIP_THERMAL) += rockchip_thermal.o
3534
obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
@@ -44,15 +43,8 @@ obj-$(CONFIG_IMX_THERMAL) += imx_thermal.o
4443
obj-$(CONFIG_MAX77620_THERMAL) += max77620_thermal.o
4544
obj-$(CONFIG_QORIQ_THERMAL) += qoriq_thermal.o
4645
obj-$(CONFIG_DA9062_THERMAL) += da9062-thermal.o
47-
obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
48-
obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
49-
obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o
50-
obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o
51-
obj-$(CONFIG_INTEL_QUARK_DTS_THERMAL) += intel_quark_dts_thermal.o
46+
obj-y += intel/
5247
obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal/
53-
obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/
54-
obj-$(CONFIG_INTEL_BXT_PMIC_THERMAL) += intel_bxt_pmic_thermal.o
55-
obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o
5648
obj-y += st/
5749
obj-$(CONFIG_QCOM_TSENS) += qcom/
5850
obj-y += tegra/

drivers/thermal/intel/Kconfig

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
config INTEL_POWERCLAMP
2+
tristate "Intel PowerClamp idle injection driver"
3+
depends on THERMAL
4+
depends on X86
5+
depends on CPU_SUP_INTEL
6+
help
7+
Enable this to enable Intel PowerClamp idle injection driver. This
8+
enforce idle time which results in more package C-state residency. The
9+
user interface is exposed via generic thermal framework.
10+
11+
config X86_PKG_TEMP_THERMAL
12+
tristate "X86 package temperature thermal driver"
13+
depends on X86_THERMAL_VECTOR
14+
select THERMAL_GOV_USER_SPACE
15+
select THERMAL_WRITABLE_TRIPS
16+
default m
17+
help
18+
Enable this to register CPU digital sensor for package temperature as
19+
thermal zone. Each package will have its own thermal zone. There are
20+
two trip points which can be set by user to get notifications via thermal
21+
notification methods.
22+
23+
config INTEL_SOC_DTS_IOSF_CORE
24+
tristate
25+
depends on X86 && PCI
26+
select IOSF_MBI
27+
help
28+
This is becoming a common feature for Intel SoCs to expose the additional
29+
digital temperature sensors (DTSs) using side band interface (IOSF). This
30+
implements the common set of helper functions to register, get temperature
31+
and get/set thresholds on DTSs.
32+
33+
config INTEL_SOC_DTS_THERMAL
34+
tristate "Intel SoCs DTS thermal driver"
35+
depends on X86 && PCI && ACPI
36+
select INTEL_SOC_DTS_IOSF_CORE
37+
select THERMAL_WRITABLE_TRIPS
38+
help
39+
Enable this to register Intel SoCs (e.g. Bay Trail) platform digital
40+
temperature sensor (DTS). These SoCs have two additional DTSs in
41+
addition to DTSs on CPU cores. Each DTS will be registered as a
42+
thermal zone. There are two trip points. One of the trip point can
43+
be set by user mode programs to get notifications via Linux thermal
44+
notification methods.The other trip is a critical trip point, which
45+
was set by the driver based on the TJ MAX temperature.
46+
47+
config INTEL_QUARK_DTS_THERMAL
48+
tristate "Intel Quark DTS thermal driver"
49+
depends on X86_INTEL_QUARK
50+
help
51+
Enable this to register Intel Quark SoC (e.g. X1000) platform digital
52+
temperature sensor (DTS). For X1000 SoC, it has one on-die DTS.
53+
The DTS will be registered as a thermal zone. There are two trip points:
54+
hot & critical. The critical trip point default value is set by
55+
underlying BIOS/Firmware.
56+
57+
menu "ACPI INT340X thermal drivers"
58+
source "drivers/thermal/intel/int340x_thermal/Kconfig"
59+
endmenu
60+
61+
config INTEL_BXT_PMIC_THERMAL
62+
tristate "Intel Broxton PMIC thermal driver"
63+
depends on X86 && INTEL_SOC_PMIC_BXTWC && REGMAP
64+
help
65+
Select this driver for Intel Broxton PMIC with ADC channels monitoring
66+
system temperature measurements and alerts.
67+
This driver is used for monitoring the ADC channels of PMIC and handles
68+
the alert trip point interrupts and notifies the thermal framework with
69+
the trip point and temperature details of the zone.
70+
71+
config INTEL_PCH_THERMAL
72+
tristate "Intel PCH Thermal Reporting Driver"
73+
depends on X86 && PCI
74+
help
75+
Enable this to support thermal reporting on certain intel PCHs.
76+
Thermal reporting device will provide temperature reading,
77+
programmable trip points and other information.

drivers/thermal/intel/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# Makefile for various Intel thermal drivers.
4+
5+
obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
6+
obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
7+
obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o
8+
obj-$(CONFIG_INTEL_SOC_DTS_THERMAL) += intel_soc_dts_thermal.o
9+
obj-$(CONFIG_INTEL_QUARK_DTS_THERMAL) += intel_quark_dts_thermal.o
10+
obj-$(CONFIG_INT340X_THERMAL) += int340x_thermal/
11+
obj-$(CONFIG_INTEL_BXT_PMIC_THERMAL) += intel_bxt_pmic_thermal.o
12+
obj-$(CONFIG_INTEL_PCH_THERMAL) += intel_pch_thermal.o

drivers/thermal/int340x_thermal/int3400_thermal.c renamed to drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ static ssize_t available_uuids_show(struct device *dev,
4848
struct device_attribute *attr,
4949
char *buf)
5050
{
51-
struct platform_device *pdev = to_platform_device(dev);
52-
struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
51+
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
5352
int i;
5453
int length = 0;
5554

@@ -68,8 +67,7 @@ static ssize_t available_uuids_show(struct device *dev,
6867
static ssize_t current_uuid_show(struct device *dev,
6968
struct device_attribute *devattr, char *buf)
7069
{
71-
struct platform_device *pdev = to_platform_device(dev);
72-
struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
70+
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
7371

7472
if (priv->uuid_bitmap & (1 << priv->current_uuid_index))
7573
return sprintf(buf, "%s\n",
@@ -82,8 +80,7 @@ static ssize_t current_uuid_store(struct device *dev,
8280
struct device_attribute *attr,
8381
const char *buf, size_t count)
8482
{
85-
struct platform_device *pdev = to_platform_device(dev);
86-
struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
83+
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
8784
int i;
8885

8986
for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; ++i) {

drivers/thermal/qcom/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@ config QCOM_TSENS
99
thermal zone device via the mode file results in disabling the sensor.
1010
Also able to set threshold temperature for both hot and cold and update
1111
when a threshold is reached.
12+
13+
config QCOM_SPMI_TEMP_ALARM
14+
tristate "Qualcomm SPMI PMIC Temperature Alarm"
15+
depends on OF && SPMI && IIO
16+
select REGMAP_SPMI
17+
help
18+
This enables a thermal sysfs driver for Qualcomm plug-and-play (QPNP)
19+
PMIC devices. It shows up in sysfs as a thermal sensor with multiple
20+
trip points. The temperature reported by the thermal sensor reflects the
21+
real time die temperature if an ADC is present or an estimate of the
22+
temperature based upon the over temperature stage value.

drivers/thermal/qcom/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj-$(CONFIG_QCOM_TSENS) += qcom_tsens.o
22
qcom_tsens-y += tsens.o tsens-common.o tsens-8916.o tsens-8974.o tsens-8960.o tsens-v2.o
3+
obj-$(CONFIG_QCOM_SPMI_TEMP_ALARM) += qcom-spmi-temp-alarm.o

drivers/thermal/qcom-spmi-temp-alarm.c renamed to drivers/thermal/qcom/qcom-spmi-temp-alarm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include <linux/regmap.h>
2424
#include <linux/thermal.h>
2525

26-
#include "thermal_core.h"
26+
#include "../thermal_core.h"
2727

2828
#define QPNP_TM_REG_TYPE 0x04
2929
#define QPNP_TM_REG_SUBTYPE 0x05

drivers/thermal/rockchip_thermal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,8 +1327,7 @@ static int rockchip_thermal_remove(struct platform_device *pdev)
13271327

13281328
static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
13291329
{
1330-
struct platform_device *pdev = to_platform_device(dev);
1331-
struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
1330+
struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
13321331
int i;
13331332

13341333
for (i = 0; i < thermal->chip->chn_num; i++)
@@ -1346,8 +1345,7 @@ static int __maybe_unused rockchip_thermal_suspend(struct device *dev)
13461345

13471346
static int __maybe_unused rockchip_thermal_resume(struct device *dev)
13481347
{
1349-
struct platform_device *pdev = to_platform_device(dev);
1350-
struct rockchip_thermal_data *thermal = platform_get_drvdata(pdev);
1348+
struct rockchip_thermal_data *thermal = dev_get_drvdata(dev);
13511349
int i;
13521350
int error;
13531351

@@ -1376,7 +1374,7 @@ static int __maybe_unused rockchip_thermal_resume(struct device *dev)
13761374
id, thermal->regs,
13771375
thermal->tshut_temp);
13781376
if (error)
1379-
dev_err(&pdev->dev, "%s: invalid tshut=%d, error=%d\n",
1377+
dev_err(dev, "%s: invalid tshut=%d, error=%d\n",
13801378
__func__, thermal->tshut_temp, error);
13811379
}
13821380

drivers/thermal/spear_thermal.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ static struct thermal_zone_device_ops ops = {
5656

5757
static int __maybe_unused spear_thermal_suspend(struct device *dev)
5858
{
59-
struct platform_device *pdev = to_platform_device(dev);
60-
struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
59+
struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
6160
struct spear_thermal_dev *stdev = spear_thermal->devdata;
6261
unsigned int actual_mask = 0;
6362

@@ -73,15 +72,14 @@ static int __maybe_unused spear_thermal_suspend(struct device *dev)
7372

7473
static int __maybe_unused spear_thermal_resume(struct device *dev)
7574
{
76-
struct platform_device *pdev = to_platform_device(dev);
77-
struct thermal_zone_device *spear_thermal = platform_get_drvdata(pdev);
75+
struct thermal_zone_device *spear_thermal = dev_get_drvdata(dev);
7876
struct spear_thermal_dev *stdev = spear_thermal->devdata;
7977
unsigned int actual_mask = 0;
8078
int ret = 0;
8179

8280
ret = clk_enable(stdev->clk);
8381
if (ret) {
84-
dev_err(&pdev->dev, "Can't enable clock\n");
82+
dev_err(dev, "Can't enable clock\n");
8583
return ret;
8684
}
8785

drivers/thermal/st/st_thermal.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,17 +277,15 @@ EXPORT_SYMBOL_GPL(st_thermal_unregister);
277277
#ifdef CONFIG_PM_SLEEP
278278
static int st_thermal_suspend(struct device *dev)
279279
{
280-
struct platform_device *pdev = to_platform_device(dev);
281-
struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
280+
struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
282281

283282
return st_thermal_sensor_off(sensor);
284283
}
285284

286285
static int st_thermal_resume(struct device *dev)
287286
{
288287
int ret;
289-
struct platform_device *pdev = to_platform_device(dev);
290-
struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
288+
struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
291289

292290
ret = st_thermal_sensor_on(sensor);
293291
if (ret)

0 commit comments

Comments
 (0)