Skip to content

Commit f364beb

Browse files
committed
Merge branch 'thermal-intel'
Merge changes affecting thermal control on Intel platforms for 6.3-rc1: - Consolidate code accessing the Intel TCC (Thermal Control Circuitry) MSRs by introducing library functions for that and making the TCC-related code in thermal drivers use them (Zhang Rui). - Enhance the x86_pkg_temp_thermal driver to support dynamic tjmax changes (Zhang Rui). - Address an "unsigned expression compared with zero" warning in the intel_soc_dts_iosf thermal driver (Yang Li). - Update comments regarding two functions in the Intel Menlow thermal driver (Deming Wang). - Use sysfs_emit_at() instead of scnprintf() in the int340x thermal driver (ye xingchen). - Make the intel_pch thermal driver support the Wellsburg PCH (Tim Zimmermann). - Add trip point initialization helper functions for ACPI-defined trip points and modify two thermal drivers to use them (Rafael Wysocki, Daniel Lezcano). - Modify the intel_pch and processor_thermal_device_pci thermal drivers use generic trip point tables instead of thermal zone trip point callbacks (Daniel Lezcano). - Add production mode attribute sysfs attribute to the int340x thermal driver (Srinivas Pandruvada). - Rework dynamic trip point updates handling and locking in the int340x thermal driver (Rafael Wysocki). - Make the int340x thermal driver use a generic trip points table instead of thermal zone trip point callbacks (Rafael Wysocki, Daniel Lezcano). * thermal-intel: thermal: intel: int340x: Use generic trip points table thermal: intel: int340x: Use zone lock for synchronization thermal: intel: int340x: Rework updating trip points thermal: ACPI: Initialize trips if temperature is out of range thermal: intel: processor_thermal_device_pci: Use generic trip point thermal: intel: int340x: Add production mode attribute thermal: intel: intel_pch: Use generic trip points thermal: ACPI: Add ACPI trip point routines thermal: intel: intel_pch: Add support for Wellsburg PCH thermal: int340x_thermal: Use sysfs_emit_at() instead of scnprintf() thermal: intel: menlow: Update function descriptions thermal: intel: Fix unsigned comparison with less than zero thermal/x86_pkg_temp_thermal: Add support for handling dynamic tjmax thermal/x86_pkg_temp_thermal: Use Intel TCC library thermal/intel/intel_tcc_cooling: Use Intel TCC library thermal/intel/intel_soc_dts_iosf: Use Intel TCC library thermal/int340x/processor_thermal: Use Intel TCC library thermal/intel: Introduce Intel TCC library
2 parents 79b2027 + f4118db commit f364beb

21 files changed

+597
-477
lines changed

Documentation/driver-api/thermal/intel_dptf.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ DPTF ACPI Drivers interface
8484
https:/github.com/intel/thermal_daemon for decoding
8585
thermal table.
8686

87+
``production_mode`` (RO)
88+
When different from zero, manufacturer locked thermal configuration
89+
from further changes.
8790

8891
ACPI Thermal Relationship table interface
8992
------------------------------------------

drivers/thermal/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ config THERMAL_OF
7676
Say 'Y' here if you need to build thermal infrastructure
7777
based on device tree.
7878

79+
config THERMAL_ACPI
80+
depends on ACPI
81+
bool
82+
7983
config THERMAL_WRITABLE_TRIPS
8084
bool "Enable writable trip points"
8185
help

drivers/thermal/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ thermal_sys-$(CONFIG_THERMAL_NETLINK) += thermal_netlink.o
1313
# interface to/from other layers providing sensors
1414
thermal_sys-$(CONFIG_THERMAL_HWMON) += thermal_hwmon.o
1515
thermal_sys-$(CONFIG_THERMAL_OF) += thermal_of.o
16+
thermal_sys-$(CONFIG_THERMAL_ACPI) += thermal_acpi.o
1617

1718
# governors
1819
thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE) += gov_fair_share.o

drivers/thermal/intel/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ config X86_THERMAL_VECTOR
1212
def_bool y
1313
depends on X86 && CPU_SUP_INTEL && X86_LOCAL_APIC
1414

15+
config INTEL_TCC
16+
bool
17+
depends on X86
18+
1519
config X86_PKG_TEMP_THERMAL
1620
tristate "X86 package temperature thermal driver"
1721
depends on X86_THERMAL_VECTOR
1822
select THERMAL_GOV_USER_SPACE
1923
select THERMAL_WRITABLE_TRIPS
24+
select INTEL_TCC
2025
default m
2126
help
2227
Enable this to register CPU digital sensor for package temperature as
@@ -28,6 +33,7 @@ config INTEL_SOC_DTS_IOSF_CORE
2833
tristate
2934
depends on X86 && PCI
3035
select IOSF_MBI
36+
select INTEL_TCC
3137
help
3238
This is becoming a common feature for Intel SoCs to expose the additional
3339
digital temperature sensors (DTSs) using side band interface (IOSF). This
@@ -75,6 +81,7 @@ config INTEL_BXT_PMIC_THERMAL
7581
config INTEL_PCH_THERMAL
7682
tristate "Intel PCH Thermal Reporting Driver"
7783
depends on X86 && PCI
84+
select THERMAL_ACPI if ACPI
7885
help
7986
Enable this to support thermal reporting on certain intel PCHs.
8087
Thermal reporting device will provide temperature reading,
@@ -83,6 +90,7 @@ config INTEL_PCH_THERMAL
8390
config INTEL_TCC_COOLING
8491
tristate "Intel TCC offset cooling Driver"
8592
depends on X86
93+
select INTEL_TCC
8694
help
8795
Enable this to support system cooling by adjusting the effective TCC
8896
activation temperature via the TCC Offset register, which is widely

drivers/thermal/intel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# Makefile for various Intel thermal drivers.
44

5+
obj-$(CONFIG_INTEL_TCC) += intel_tcc.o
56
obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
67
obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
78
obj-$(CONFIG_INTEL_SOC_DTS_IOSF_CORE) += intel_soc_dts_iosf.o

drivers/thermal/intel/int340x_thermal/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ config INT340X_THERMAL
99
select THERMAL_GOV_USER_SPACE
1010
select ACPI_THERMAL_REL
1111
select ACPI_FAN
12+
select THERMAL_ACPI
1213
select INTEL_SOC_DTS_IOSF_CORE
14+
select INTEL_TCC
1315
select PROC_THERMAL_MMIO_RAPL if POWERCAP
1416
help
1517
Newer laptops and tablets that use ACPI may have thermal sensors and

drivers/thermal/intel/int340x_thermal/int3400_thermal.c

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ struct int3400_thermal_priv {
6060
int odvp_count;
6161
int *odvp;
6262
u32 os_uuid_mask;
63+
int production_mode;
6364
struct odvp_attr *odvp_attrs;
6465
};
6566

@@ -130,10 +131,7 @@ static ssize_t available_uuids_show(struct device *dev,
130131

131132
for (i = 0; i < INT3400_THERMAL_MAXIMUM_UUID; i++) {
132133
if (priv->uuid_bitmap & (1 << i))
133-
length += scnprintf(&buf[length],
134-
PAGE_SIZE - length,
135-
"%s\n",
136-
int3400_thermal_uuids[i]);
134+
length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
137135
}
138136

139137
return length;
@@ -151,10 +149,7 @@ static ssize_t current_uuid_show(struct device *dev,
151149

152150
for (i = 0; i <= INT3400_THERMAL_CRITICAL; i++) {
153151
if (priv->os_uuid_mask & BIT(i))
154-
length += scnprintf(&buf[length],
155-
PAGE_SIZE - length,
156-
"%s\n",
157-
int3400_thermal_uuids[i]);
152+
length += sysfs_emit_at(buf, length, int3400_thermal_uuids[i]);
158153
}
159154

160155
if (length)
@@ -315,6 +310,44 @@ static int int3400_thermal_get_uuids(struct int3400_thermal_priv *priv)
315310
return result;
316311
}
317312

313+
static ssize_t production_mode_show(struct device *dev, struct device_attribute *attr,
314+
char *buf)
315+
{
316+
struct int3400_thermal_priv *priv = dev_get_drvdata(dev);
317+
318+
return sysfs_emit(buf, "%d\n", priv->production_mode);
319+
}
320+
321+
static DEVICE_ATTR_RO(production_mode);
322+
323+
static int production_mode_init(struct int3400_thermal_priv *priv)
324+
{
325+
unsigned long long mode;
326+
acpi_status status;
327+
int ret;
328+
329+
priv->production_mode = -1;
330+
331+
status = acpi_evaluate_integer(priv->adev->handle, "DCFG", NULL, &mode);
332+
/* If the method is not present, this is not an error */
333+
if (ACPI_FAILURE(status))
334+
return 0;
335+
336+
ret = sysfs_create_file(&priv->pdev->dev.kobj, &dev_attr_production_mode.attr);
337+
if (ret)
338+
return ret;
339+
340+
priv->production_mode = mode;
341+
342+
return 0;
343+
}
344+
345+
static void production_mode_exit(struct int3400_thermal_priv *priv)
346+
{
347+
if (priv->production_mode >= 0)
348+
sysfs_remove_file(&priv->pdev->dev.kobj, &dev_attr_production_mode.attr);
349+
}
350+
318351
static ssize_t odvp_show(struct device *dev, struct device_attribute *attr,
319352
char *buf)
320353
{
@@ -610,8 +643,15 @@ static int int3400_thermal_probe(struct platform_device *pdev)
610643
if (result)
611644
goto free_sysfs;
612645

646+
result = production_mode_init(priv);
647+
if (result)
648+
goto free_notify;
649+
613650
return 0;
614651

652+
free_notify:
653+
acpi_remove_notify_handler(priv->adev->handle, ACPI_DEVICE_NOTIFY,
654+
int3400_notify);
615655
free_sysfs:
616656
cleanup_odvp(priv);
617657
if (!ZERO_OR_NULL_PTR(priv->data_vault)) {
@@ -638,6 +678,8 @@ static int int3400_thermal_remove(struct platform_device *pdev)
638678
{
639679
struct int3400_thermal_priv *priv = platform_get_drvdata(pdev);
640680

681+
production_mode_exit(priv);
682+
641683
acpi_remove_notify_handler(
642684
priv->adev->handle, ACPI_DEVICE_NOTIFY,
643685
int3400_notify);

drivers/thermal/intel/int340x_thermal/int3403_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void int3403_notify(acpi_handle handle,
6969
THERMAL_TRIP_VIOLATED);
7070
break;
7171
case INT3403_PERF_TRIP_POINT_CHANGED:
72-
int340x_thermal_read_trips(obj->int340x_zone);
72+
int340x_thermal_update_trips(obj->int340x_zone);
7373
int340x_thermal_zone_device_update(obj->int340x_zone,
7474
THERMAL_TRIP_CHANGED);
7575
break;

0 commit comments

Comments
 (0)