ACPI: DPTF: Move INT340X enumeration from DPTF core to thermal drivers
Subsystems (6)
v3 cover ACPI: DPTF: Move INT340X enumeration from DPTF core to thermal drivers
The Intel Dynamic Platform and Thermal Framework (DPTF) relies on the INT340X ACPI device objects. The temperature information and cooling ability are exposed to the userspace via those objects.
Since kernel v3.17 the ACPI bus scan handler is introduced to prevent enumeration of INT340X ACPI device objects on the platform bus unless related thermal drivers are enabled. However, using the IS_ENABLED() macro in the ACPI scan handler forces the kernel to be recompiled when thermal drivers are enabled or disabled, which is a significant limitation of its modularity. The IS_ENABLED() macro is particularly problematic for the Android Generic Kernel Image (GKI) project which uses unified core kernel while SoC/board support is moved to loadable vendor modules.
This patch set moves enumeration of INT340X ACPI device objects on the platform bus from DPTF core to thermal drivers. It starts with some code cleanup and reorganization to eventually remove IS_ENABLED() macro from the ACPI bus scan handler. Brief list of changes is listed below:
1) Remove SOC DTS thermal driver case from the ACPI scan handler since its dependency on INT340X driver is unrelated to DPTF
2) Move all INT340X ACPI device ids to the common header and update the DPTF core and thermal drivers accordingly
3) Move dynamic enumeration of ACPI device objects on the platform bus from the intel-hid and intel-vbtn drivers to the ACPI platform core
4) Move enumeration of INT340X ACPI device objects on the platform bus from DPTF core to thermal drivers using ACPI platform core methods
Link to v1: https://lore.kernel.org/all/[email protected]/
Link to v2: https://lore.kernel.org/all/[email protected]/
In v3 the SoC DTS thermal explicitly depends on X86_64.
Slawomir Rosek (6):
ACPI: DPTF: Ignore SoC DTS thermal while scanning
ACPI: DPTF: Move INT340X device IDs to header
ACPI: DPTF: Move PCH FIVR device IDs to header
ACPI: DPTF: Remove not supported INT340X IDs
ACPI: platform: Add macro for acpi platform driver
ACPI: DPTF: Move INT340X enumeration to modules
drivers/acpi/acpi_platform.c | 27 +++++++ drivers/acpi/dptf/dptf_pch_fivr.c | 10 +-- drivers/acpi/dptf/dptf_power.c | 20 +---- drivers/acpi/dptf/int340x_thermal.c | 76 ++++--------------- drivers/acpi/fan.h | 10 +-- drivers/acpi/fan_core.c | 2 +- drivers/acpi/int340x_thermal.h | 76 +++++++++++++++++++ drivers/platform/x86/intel/hid.c | 33 +------- drivers/platform/x86/intel/vbtn.c | 30 +------- drivers/thermal/intel/Kconfig | 3 +- .../intel/int340x_thermal/int3400_thermal.c | 12 +-- .../intel/int340x_thermal/int3401_thermal.c | 5 +- .../intel/int340x_thermal/int3402_thermal.c | 5 +- .../intel/int340x_thermal/int3403_thermal.c | 12 +-- .../intel/int340x_thermal/int3406_thermal.c | 5 +- include/linux/platform_device.h | 17 +++++ 16 files changed, 164 insertions(+), 179 deletions(-) create mode 100644 drivers/acpi/int340x_thermal.h
Signature · 1 line
2.51.0.618.g983fd99d29-goog
PATCH v3 1/6 ACPI: DPTF: Ignore SoC DTS thermal while scanning
The Intel SoC DTS thermal driver on Baytrail platform uses IRQ 86 for critical overheating notification. The IRQ 86 is described in the _CRS control method of INT3401 device, thus Intel SoC DTS thermal driver requires INT3401 device to be enumerated.
Since dependency on INT3401 device is unrelated to DPTF the IS_ENABLE() macro is removed from ACPI DPTF INT340X scan handler, instead Kconfig is updated to ensure proper enumeration of INT3401 device.
--- drivers/acpi/dptf/int340x_thermal.c | 7 +------ drivers/thermal/intel/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/acpi/dptf/int340x_thermal.c +1 -6
@@ -11,10 +11,9 @@#include "../internal.h" -#define INT3401_DEVICE 0X01static const struct acpi_device_id int340x_thermal_device_ids[] = { {"INT3400" }, - {"INT3401" ,INT3401_DEVICE }, + {"INT3401" }, {"INT3402" }, {"INT3403" }, {"INT3404" },
@@ -76,10 +75,6 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev, {if (IS_ENABLED (CONFIG_INT340X_THERMAL ))acpi_create_platform_device (adev,NULL ); -/* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ -else if (IS_ENABLED (CONFIG_INTEL_SOC_DTS_THERMAL ) && - id->driver_data ==INT3401_DEVICE ) -acpi_create_platform_device (adev,NULL );return 1 ; }
drivers/thermal/intel/Kconfig +2 -1
@@ -44,7 +44,8 @@ config INTEL_SOC_DTS_IOSF_CORE config INTEL_SOC_DTS_THERMAL tristate "Intel SoCs DTS thermal driver" - depends on X86 && PCI && ACPI + depends on X86_64 && PCI && ACPI + select INT340X_THERMAL select INTEL_SOC_DTS_IOSF_CORE help Enable this to register Intel SoCs (e.g. Bay Trail) platform digital
Signature · 1 line
2.51.0.618.g983fd99d29-goog
PATCH v3 2/6 ACPI: DPTF: Move INT340X device IDs to header
In reply to Slawomir RosekThe ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
--- drivers/acpi/dptf/dptf_power.c | 18 +---- drivers/acpi/dptf/int340x_thermal.c | 51 +++----------- drivers/acpi/fan.h | 10 +-- drivers/acpi/int340x_thermal.h | 68 +++++++++++++++++++ .../intel/int340x_thermal/int3400_thermal.c | 10 +-- .../intel/int340x_thermal/int3401_thermal.c | 3 +- .../intel/int340x_thermal/int3402_thermal.c | 3 +- .../intel/int340x_thermal/int3403_thermal.c | 10 +-- .../intel/int340x_thermal/int3406_thermal.c | 3 +- 9 files changed, 90 insertions(+), 86 deletions(-) create mode 100644 drivers/acpi/int340x_thermal.h
drivers/acpi/dptf/dptf_power.c +2 -16
@@ -8,6 +8,7 @@#include <linux/module.h> #include <linux/acpi.h> #include <linux/platform_device.h> +#include "../int340x_thermal.h" /* * Presentation of attributes which are defined for INT3407 and INT3532.
@@ -224,22 +225,7 @@ static void dptf_power_remove(struct platform_device *pdev) }static const struct acpi_device_id int3407_device_ids[] = { - {"INT3407" ,0 }, - {"INT3532" ,0 }, - {"INTC1047" ,0 }, - {"INTC1050" ,0 }, - {"INTC1060" ,0 }, - {"INTC1061" ,0 }, - {"INTC1065" ,0 }, - {"INTC1066" ,0 }, - {"INTC106C" ,0 }, - {"INTC106D" ,0 }, - {"INTC10A4" ,0 }, - {"INTC10A5" ,0 }, - {"INTC10D8" ,0 }, - {"INTC10D9" ,0 }, - {"INTC1100" ,0 }, - {"INTC1101" ,0 }, +ACPI_INT3407_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3407_device_ids);
drivers/acpi/dptf/int340x_thermal.c +8 -43
71 lines not on this page · raw message
drivers/acpi/fan.h +2 -8
@@ -11,16 +11,10 @@#define _ACPI_FAN_H_#include <linux/kconfig.h> +#include "int340x_thermal.h" #define ACPI_FAN_DEVICE_IDS \ - {"INT3404", },/* Fan */ \ - {"INTC1044", }, /* Fan for Tiger Lake generation */ \ - {"INTC1048", }, /* Fan for Alder Lake generation */ \ - {"INTC1063", }, /* Fan for Meteor Lake generation */ \ - {"INTC106A", }, /* Fan for Lunar Lake generation */ \ - {"INTC10A2", }, /* Fan for Raptor Lake generation */ \ - {"INTC10D6", }, /* Fan for Panther Lake generation */ \ - {"INTC10FE", }, /* Fan for Wildcat Lake generation */ \ + ACPI_INT3404_DEVICE_IDS, \ {"PNP0C0B", }/* Generic ACPI fan */ #define ACPI_FPS_NAME_LEN 20
drivers/acpi/int340x_thermal.h new file +68 -0
68 lines not on this page · raw message
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +2 -8
@@ -11,6 +11,7 @@#include <linux/acpi.h> #include <linux/thermal.h> #include "acpi_thermal_rel.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3400_THERMAL_TABLE_CHANGED 0x83#define INT3400_ODVP_CHANGED 0x88
@@ -683,14 +684,7 @@ static void int3400_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3400_thermal_match[] = { - {"INT3400" ,0 }, - {"INTC1040" ,0 }, - {"INTC1041" ,0 }, - {"INTC1042" ,0 }, - {"INTC1068" ,0 }, - {"INTC10A0" ,0 }, - {"INTC10D4" ,0 }, - {"INTC10FC" ,0 }, +ACPI_INT3400_DEVICE_IDS , {} };
drivers/thermal/intel/int340x_thermal/int3401_thermal.c +2 -1
@@ -11,9 +11,10 @@#include "int340x_thermal_zone.h" #include "processor_thermal_device.h" +#include "../../../../drivers/acpi/int340x_thermal.h" static const struct acpi_device_id int3401_device_ids[] = { - {"INT3401" ,0 }, +ACPI_INT3401_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3401_device_ids);
drivers/thermal/intel/int340x_thermal/int3402_thermal.c +2 -1
@@ -11,6 +11,7 @@#include <linux/acpi.h> #include <linux/thermal.h> #include "int340x_thermal_zone.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3402_PERF_CHANGED_EVENT 0x80#define INT3402_THERMAL_EVENT 0x90
@@ -84,7 +85,7 @@ static void int3402_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3402_thermal_match[] = { - {"INT3402" ,0 }, +ACPI_INT3402_DEVICE_IDS , {} };
drivers/thermal/intel/int340x_thermal/int3403_thermal.c +2 -8
@@ -12,6 +12,7 @@#include <linux/thermal.h> #include <linux/platform_device.h> #include "int340x_thermal_zone.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3403_TYPE_SENSOR 0x03#define INT3403_TYPE_CHARGER 0x0B
@@ -269,14 +270,7 @@ static void int3403_remove(struct platform_device *pdev) }static const struct acpi_device_id int3403_device_ids[] = { - {"INT3403" ,0 }, - {"INTC1043" ,0 }, - {"INTC1046" ,0 }, - {"INTC1062" ,0 }, - {"INTC1069" ,0 }, - {"INTC10A1" ,0 }, - {"INTC10D5" ,0 }, - {"INTC10FD" ,0 }, +ACPI_INT3403_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3403_device_ids);
drivers/thermal/intel/int340x_thermal/int3406_thermal.c +2 -1
@@ -12,6 +12,7 @@#include <linux/backlight.h> #include <linux/thermal.h> #include <acpi/video.h> +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3406_BRIGHTNESS_LIMITS_CHANGED 0x80
@@ -187,7 +188,7 @@ static void int3406_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3406_thermal_match[] = { - {"INT3406" ,0 }, +ACPI_INT3406_DEVICE_IDS , {} };
Signature · 1 line
2.51.0.618.g983fd99d29-goog
PATCH v3 3/6 ACPI: DPTF: Move PCH FIVR device IDs to header
In reply to Slawomir RosekThe ACPI PCH FIVR device IDs are shared between the DPTF core and PCH FIVR driver, thus they are moved to the common header.
--- drivers/acpi/dptf/dptf_pch_fivr.c | 8 ++------ drivers/acpi/dptf/int340x_thermal.c | 7 +------ drivers/acpi/int340x_thermal.h | 8 ++++++++ 3 files changed, 11 insertions(+), 12 deletions(-)
drivers/acpi/dptf/dptf_pch_fivr.c +2 -6
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> +#include "../int340x_thermal.h" struct pch_fivr_resp {u64 status;
@@ -147,12 +148,7 @@ static void pch_fivr_remove(struct platform_device *pdev) }static const struct acpi_device_id pch_fivr_device_ids[] = { - {"INTC1045" ,0 }, - {"INTC1049" ,0 }, - {"INTC1064" ,0 }, - {"INTC106B" ,0 }, - {"INTC10A3" ,0 }, - {"INTC10D7" ,0 }, +ACPI_PCH_FIVR_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, pch_fivr_device_ids);
drivers/acpi/dptf/int340x_thermal.c +1 -6
@@ -20,16 +20,11 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {ACPI_INT3404_DEVICE_IDS ,ACPI_INT3406_DEVICE_IDS ,ACPI_INT3407_DEVICE_IDS , +ACPI_PCH_FIVR_DEVICE_IDS , {"INT3408"}, {"INT3409"}, {"INT340A"}, {"INT340B"}, - {"INTC1045"}, - {"INTC1049"}, - {"INTC1064"}, - {"INTC106B"}, - {"INTC10A3"}, - {"INTC10D7"}, {"INTC10FF"}, {"INTC1102"}, {""},
drivers/acpi/int340x_thermal.h +8 -0
@@ -65,4 +65,12 @@ {"INTC1100"}, \ {"INTC1101"} +#define ACPI_PCH_FIVR_DEVICE_IDS \ + {"INTC1045"}, \ + {"INTC1049"}, \ + {"INTC1064"}, \ + {"INTC106B"}, \ + {"INTC10A3"}, \ + {"INTC10D7"} +#endif
Signature · 1 line
2.51.0.618.g983fd99d29-goog
PATCH v3 4/6 ACPI: DPTF: Remove not supported INT340X IDs
In reply to Slawomir RosekRemove not supported INT340X and Wildcat Lake ACPI device IDs from scan handler.
--- drivers/acpi/dptf/int340x_thermal.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/acpi/dptf/int340x_thermal.c +0 -6
@@ -21,12 +21,6 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {ACPI_INT3406_DEVICE_IDS ,ACPI_INT3407_DEVICE_IDS ,ACPI_PCH_FIVR_DEVICE_IDS , - {"INT3408"}, - {"INT3409"}, - {"INT340A"}, - {"INT340B"}, - {"INTC10FF"}, - {"INTC1102"}, {""}, };
Signature · 1 line
2.51.0.618.g983fd99d29-goog
PATCH v3 5/6 ACPI: platform: Add macro for acpi platform driver
In reply to Slawomir RosekIntroduce module_acpi_platform_driver() macro to simplify dynamic enumeration of ACPI device objects on the platform bus by loadable modules. Move common code from the intel-hid and intel-vbtn drivers to the ACPI platform core.
--- drivers/acpi/acpi_platform.c | 27 +++++++++++++++++++++++++ drivers/platform/x86/intel/hid.c | 33 +++---------------------------- drivers/platform/x86/intel/vbtn.c | 30 +--------------------------- include/linux/platform_device.h | 17 ++++++++++++++++ 4 files changed, 48 insertions(+), 59 deletions(-)
drivers/acpi/acpi_platform.c +27 -0
@@ -190,6 +190,33 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, }EXPORT_SYMBOL_GPL (acpi_create_platform_device); +static acpi_status +__acpi_platform_driver_register_cb (acpi_handle handle,u32 lvl, +void *context,void **rv) +{ +const struct acpi_device_id *ids = context; +struct acpi_device *dev =acpi_fetch_acpi_dev (handle); + +if (dev &&acpi_match_device_ids (dev, ids) ==0 ) +if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL ))) { +dev_info (&dev->dev, +"created platform device\n" ); + } + +return AE_OK ; +} + +int __acpi_platform_driver_register (struct platform_driver *drv, +struct module *owner) +{ +acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT ,ACPI_UINT32_MAX , + __acpi_platform_driver_register_cb,NULL , + (void *)drv->driver.acpi_match_table,NULL ); + +return __platform_driver_register (drv, owner); +} +EXPORT_SYMBOL_GPL (__acpi_platform_driver_register); +void __init acpi_platform_init (void ) {acpi_reconfig_notifier_register (&acpi_platform_notifier);
drivers/platform/x86/intel/hid.c +3 -30
@@ -775,34 +775,7 @@ static struct platform_driver intel_hid_pl_driver = {* * As a workaround until the ACPI core figures out how to handle * this corner case, manually ask the ACPI platform device code to -* claim the ACPI node. +* claim the ACPI node by using module_acpi_platform_driver() +* instead of the regular module_platform_driver(). */ -static acpi_status __init -check_acpi_dev (acpi_handle handle,u32 lvl,void *context,void **rv) -{ -const struct acpi_device_id *ids = context; -struct acpi_device *dev =acpi_fetch_acpi_dev (handle); - -if (dev &&acpi_match_device_ids (dev, ids) ==0 ) -if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL ))) -dev_info (&dev->dev, -"intel-hid: created platform device\n" ); - -return AE_OK ; -} - -static int __init intel_hid_init (void ) -{ -acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT , -ACPI_UINT32_MAX , check_acpi_dev,NULL , - (void *)intel_hid_ids,NULL ); - -return platform_driver_register (&intel_hid_pl_driver); -} -module_init (intel_hid_init); - -static void __exit intel_hid_exit(void) -{ -platform_driver_unregister (&intel_hid_pl_driver); -} -module_exit (intel_hid_exit); +module_acpi_platform_driver (intel_hid_pl_driver);
drivers/platform/x86/intel/vbtn.c +1 -29
@@ -390,32 +390,4 @@ static struct platform_driver intel_vbtn_pl_driver = { .remove = intel_vbtn_remove, }; -static acpi_status __init -check_acpi_dev (acpi_handle handle,u32 lvl,void *context,void **rv) -{ -const struct acpi_device_id *ids = context; -struct acpi_device *dev =acpi_fetch_acpi_dev (handle); - -if (dev &&acpi_match_device_ids (dev, ids) ==0 ) -if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL ))) -dev_info (&dev->dev, -"intel-vbtn: created platform device\n" ); - -return AE_OK ; -} - -static int __init intel_vbtn_init (void ) -{ -acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT , -ACPI_UINT32_MAX , check_acpi_dev,NULL , - (void *)intel_vbtn_ids,NULL ); - -return platform_driver_register (&intel_vbtn_pl_driver); -} -module_init (intel_vbtn_init); - -static void __exit intel_vbtn_exit(void) -{ -platform_driver_unregister (&intel_vbtn_pl_driver); -} -module_exit (intel_vbtn_exit); +module_acpi_platform_driver (intel_vbtn_pl_driver);
include/linux/platform_device.h +17 -0
@@ -264,6 +264,14 @@ extern int __platform_driver_register(struct platform_driver *, struct module *);extern void platform_driver_unregister (struct platform_driver *); +/* +* use a macro to avoid include chaining to get THIS_MODULE +*/ +#define acpi_platform_driver_register (drv) \ + __acpi_platform_driver_register(drv, THIS_MODULE) +extern int __acpi_platform_driver_register (struct platform_driver *, +struct module *); +/* non-hotpluggable platform devices may use this so that probe() and * its support may live in __init sections, conserving runtime memory. */
@@ -292,6 +300,15 @@ static inline void platform_set_drvdata(struct platform_device *pdev,module_driver (__platform_driver, platform_driver_register, \ platform_driver_unregister) +/* module_acpi_platform_driver() - Helper macro for drivers that don't do +* anything special in module init/exit. This eliminates a lot of +* boilerplate. Each module may only use this macro once, and +* calling it replaces module_init() and module_exit() + */ +#define module_acpi_platform_driver (__platform_driver) \ + module_driver(__platform_driver, acpi_platform_driver_register, \ + platform_driver_unregister) +/* builtin_platform_driver() - Helper macro for builtin drivers that * don't do anything special in driver init. This eliminates some * boilerplate. Each driver may only use this macro once, and
Signature · 1 line
2.51.0.618.g983fd99d29-goog
PATCH v3 6/6 ACPI: DPTF: Move INT340X enumeration to modules
In reply to Slawomir RosekMove enumeration of INT340X ACPI device objects on the platform bus from DPTF core to thermal drivers using ACPI platform core methods
--- drivers/acpi/dptf/dptf_pch_fivr.c | 2 +- drivers/acpi/dptf/dptf_power.c | 2 +- drivers/acpi/dptf/int340x_thermal.c | 7 +++++-- drivers/acpi/fan_core.c | 2 +- drivers/thermal/intel/int340x_thermal/int3400_thermal.c | 2 +- drivers/thermal/intel/int340x_thermal/int3401_thermal.c | 2 +- drivers/thermal/intel/int340x_thermal/int3402_thermal.c | 2 +- drivers/thermal/intel/int340x_thermal/int3403_thermal.c | 2 +- drivers/thermal/intel/int340x_thermal/int3406_thermal.c | 2 +- 9 files changed, 13 insertions(+), 10 deletions(-)
drivers/acpi/dptf/dptf_pch_fivr.c +1 -1
@@ -162,7 +162,7 @@ static struct platform_driver pch_fivr_driver = { }, }; -module_platform_driver (pch_fivr_driver); +module_acpi_platform_driver (pch_fivr_driver);MODULE_AUTHOR ("Srinivas Pandruvada <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/acpi/dptf/dptf_power.c +1 -1
@@ -239,7 +239,7 @@ static struct platform_driver dptf_power_driver = { }, }; -module_platform_driver (dptf_power_driver); +module_acpi_platform_driver (dptf_power_driver);MODULE_AUTHOR ("Srinivas Pandruvada <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/acpi/dptf/int340x_thermal.c +5 -2
@@ -27,8 +27,11 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {static int int340x_thermal_handler_attach (struct acpi_device *adev,const struct acpi_device_id *id) { -if (IS_ENABLED (CONFIG_INT340X_THERMAL )) -acpi_create_platform_device (adev,NULL ); +/* +* Do not attach INT340X devices until platform drivers are loaded. +* Enumeration of INT340X ACPI device objects on the platform bus +* should be done by thermal drivers. +*/ return 1 ; }
drivers/acpi/fan_core.c +1 -1
@@ -463,7 +463,7 @@ static struct platform_driver acpi_fan_driver = { }, }; -module_platform_driver (acpi_fan_driver); +module_acpi_platform_driver (acpi_fan_driver);MODULE_AUTHOR ("Paul Diefenbaugh" );MODULE_DESCRIPTION ("ACPI Fan Driver" );
drivers/thermal/intel/int340x_thermal/int3400_thermal.c +1 -1
@@ -699,7 +699,7 @@ static struct platform_driver int3400_thermal_driver = { }, }; -module_platform_driver (int3400_thermal_driver); +module_acpi_platform_driver (int3400_thermal_driver);MODULE_DESCRIPTION ("INT3400 Thermal driver" );MODULE_AUTHOR ("Zhang Rui <[email protected]>" );
drivers/thermal/intel/int340x_thermal/int3401_thermal.c +1 -1
@@ -69,7 +69,7 @@ static struct platform_driver int3401_driver = { }, }; -module_platform_driver (int3401_driver); +module_acpi_platform_driver (int3401_driver);MODULE_AUTHOR ("Srinivas Pandruvada <[email protected]>" );MODULE_DESCRIPTION ("Processor Thermal Reporting Device Driver" );
drivers/thermal/intel/int340x_thermal/int3402_thermal.c +1 -1
@@ -100,7 +100,7 @@ static struct platform_driver int3402_thermal_driver = { }, }; -module_platform_driver (int3402_thermal_driver); +module_acpi_platform_driver (int3402_thermal_driver);MODULE_DESCRIPTION ("INT3402 Thermal driver" );MODULE_LICENSE ("GPL" );
drivers/thermal/intel/int340x_thermal/int3403_thermal.c +1 -1
@@ -284,7 +284,7 @@ static struct platform_driver int3403_driver = { }, }; -module_platform_driver (int3403_driver); +module_acpi_platform_driver (int3403_driver);MODULE_AUTHOR ("Srinivas Pandruvada <[email protected]>" );MODULE_LICENSE ("GPL v2" );
drivers/thermal/intel/int340x_thermal/int3406_thermal.c +1 -1
@@ -203,7 +203,7 @@ static struct platform_driver int3406_thermal_driver = { }, }; -module_platform_driver (int3406_thermal_driver); +module_acpi_platform_driver (int3406_thermal_driver);MODULE_DESCRIPTION ("INT3406 Thermal driver" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.51.0.618.g983fd99d29-goog
Rafael J. Wysocki
maintainerQuoted 62 lines · Slawomir Rosek
The Intel Dynamic Platform and Thermal Framework (DPTF) relies on the INT340X ACPI device objects. The temperature information and cooling ability are exposed to the userspace via those objects.
Since kernel v3.17 the ACPI bus scan handler is introduced to prevent enumeration of INT340X ACPI device objects on the platform bus unless related thermal drivers are enabled. However, using the
IS_ENABLED()macro in the ACPI scan handler forces the kernel to be recompiled when thermal drivers are enabled or disabled, which is a significant limitation of its modularity. TheIS_ENABLED()macro is particularly problematic for the Android Generic Kernel Image (GKI) project which uses unified core kernel while SoC/board support is moved to loadable vendor modules.This patch set moves enumeration of INT340X ACPI device objects on the platform bus from DPTF core to thermal drivers. It starts with some code cleanup and reorganization to eventually remove
IS_ENABLED()macro from the ACPI bus scan handler. Brief list of changes is listed below:1) Remove SOC DTS thermal driver case from the ACPI scan handler since its dependency on INT340X driver is unrelated to DPTF
2) Move all INT340X ACPI device ids to the common header and update the DPTF core and thermal drivers accordingly
3) Move dynamic enumeration of ACPI device objects on the platform bus from the intel-hid and intel-vbtn drivers to the ACPI platform core
4) Move enumeration of INT340X ACPI device objects on the platform bus from DPTF core to thermal drivers using ACPI platform core methodsLink to v1: https://lore.kernel.org/all/[email protected]/
Link to v2: https://lore.kernel.org/all/[email protected]/In v3 the SoC DTS thermal explicitly depends on
X86_64.Slawomir Rosek (6):
ACPI: DPTF: Ignore SoC DTS thermal while scanning
ACPI: DPTF: Move INT340X device IDs to header
ACPI: DPTF: Move PCH FIVR device IDs to header
ACPI: DPTF: Remove not supported INT340X IDs
ACPI: platform: Add macro for acpi platform driver
ACPI: DPTF: Move INT340X enumeration to modulesdrivers/acpi/acpi_platform.c | 27 +++++++ drivers/acpi/dptf/dptf_pch_fivr.c | 10 +-- drivers/acpi/dptf/dptf_power.c | 20 +---- drivers/acpi/dptf/int340x_thermal.c | 76 ++++--------------- drivers/acpi/fan.h | 10 +-- drivers/acpi/fan_core.c | 2 +- drivers/acpi/int340x_thermal.h | 76 +++++++++++++++++++ drivers/platform/x86/intel/hid.c | 33 +------- drivers/platform/x86/intel/vbtn.c | 30 +------- drivers/thermal/intel/Kconfig | 3 +- .../intel/int340x_thermal/int3400_thermal.c | 12 +-- .../intel/int340x_thermal/int3401_thermal.c | 5 +- .../intel/int340x_thermal/int3402_thermal.c | 5 +- .../intel/int340x_thermal/int3403_thermal.c | 12 +-- .../intel/int340x_thermal/int3406_thermal.c | 5 +- include/linux/platform_device.h | 17 +++++ 16 files changed, 164 insertions(+), 179 deletions(-) create mode 100644 drivers/acpi/int340x_thermal.h
Quoted 1 line
--
Srinivas, do you have any input on this series?
Rafael J. Wysocki
maintainerRe: [PATCH v3 1/6] ACPI: DPTF: Ignore SoC DTS thermal while scanning
In reply to Slawomir RosekQuoted 5 lines · Slawomir Rosek
The Intel SoC DTS thermal driver on Baytrail platform uses IRQ 86 for critical overheating notification. The IRQ 86 is described in the
_CRScontrol method of INT3401 device, thus Intel SoC DTS thermal driver requires INT3401 device to be enumerated.
I don't think that the specific interrupt number is relevant here. It would be sufficient to say something like "The IRQ used by the Intel SoC DTS thermal device for critical overheating notification is listed in _CRS of device INT3401 which therefore needs to be enumerated for Intel SoC DTS thermal to work."
Quoted 3 lines
Since dependency on INT3401 device is unrelated to DPTF the
IS_ENABLE()macro is removed from ACPI DPTF INT340X scan handler, insteadKconfigis updated to ensure proper enumeration of INT3401 device.
It is not entirely clear what happens in this patch after reading the above paragraph.
I would rather continue the previous thought by saying that the enumeration happens by binding the int3401_thermal driver to the INT3401 platform device. Thus CONFIG_INT340X_THERMAL is in fact necessary for enumerating it, so checking CONFIG_INTEL_SOC_DTS_THERMAL in int340x_thermal_handler_attach() is pointless and INT340X_THERMAL may as well be selected by INTEL_SOC_DTS_THERMAL.
Quoted 1 line
Fixes 014d9d5d0cc1 ("ACPI/int340x_thermal: enumerate INT3401 for Intel SoC DTS thermal driver")
Why do you want this tag to be added?
Quoted 38 lines
Signed-off-by Slawomir Rosek <[email protected]>--- drivers/acpi/dptf/int340x_thermal.c | 7 +------ drivers/thermal/intel/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-)drivers/acpi/dptf/int340x_thermal.c +1
-6@@ -11,10 +11,9 @@#include "../internal.h" -#define INT3401_DEVICE 0X01static const struct acpi_device_id int340x_thermal_device_ids[] = { {"INT3400" }, - {"INT3401" ,INT3401_DEVICE }, + {"INT3401" }, {"INT3402" }, {"INT3403" }, {"INT3404" },@@ -76,10 +75,6 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev, {if (IS_ENABLED (CONFIG_INT340X_THERMAL ))acpi_create_platform_device (adev,NULL ); -/* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ -else if (IS_ENABLED (CONFIG_INTEL_SOC_DTS_THERMAL ) && - id->driver_data ==INT3401_DEVICE ) -acpi_create_platform_device (adev,NULL );return 1 ; }drivers/thermal/intel/Kconfig +0
-0
drivers/thermal/intel/Kconfig config INTEL_SOC_DTS_IOSF_CORE · line 47
Quoted 5 lines
drivers/thermal/intel/Kconfig +1
-1@@ -44,7 +44,8 @@ config INTEL_SOC_DTS_IOSF_CORE config INTEL_SOC_DTS_THERMAL tristate "Intel SoCs DTS thermal driver" - depends on X86 && PCI && ACPI + depends on X86_64 && PCI && ACPI
AFAICS NET needs to be added to the dependency list above or selecting INT340X_THERMAL below may not actually cause it to be built.
Quoted 5 lines
drivers/thermal/intel/Kconfig +1
-1+ select INT340X_THERMAL select INTEL_SOC_DTS_IOSF_CORE help Enable this to register Intel SoCs (e.g. Bay Trail) platform digital --
Rafael J. Wysocki
maintainerRe: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
In reply to Slawomir RosekQuoted 5 lines · Slawomir Rosek
The ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
Signed-off-by Slawomir Rosek <[email protected]>
I've actually started to wonder if int340x_thermal_handler is needed at all.
It just creates a platform device if the given ACPI device ID is in its list, but acpi_default_enumeration() would do that too with the caveat that it would also be done for CONFIG_INT340X_THERMAL unset. That should not be a problem though because if CONFIG_INT340X_THERMAL, there are no drivers that will bind to those platform devices, so the net outcome should be the same.
Thus I'm wondering if the way to go might be to drop int340x_thermal_handler and simply keep the device IDs in the drivers that use them for device binding.
Quoted 340 lines
--- drivers/acpi/dptf/dptf_power.c | 18 +---- drivers/acpi/dptf/int340x_thermal.c | 51 +++----------- drivers/acpi/fan.h | 10 +-- drivers/acpi/int340x_thermal.h | 68 +++++++++++++++++++ .../intel/int340x_thermal/int3400_thermal.c | 10 +-- .../intel/int340x_thermal/int3401_thermal.c | 3 +- .../intel/int340x_thermal/int3402_thermal.c | 3 +- .../intel/int340x_thermal/int3403_thermal.c | 10 +-- .../intel/int340x_thermal/int3406_thermal.c | 3 +- 9 files changed, 90 insertions(+), 86 deletions(-) create mode 100644 drivers/acpi/int340x_thermal.hdrivers/acpi/dptf/dptf_power.c +2
-16@@ -8,6 +8,7 @@#include <linux/module.h> #include <linux/acpi.h> #include <linux/platform_device.h> +#include "../int340x_thermal.h" /* * Presentation of attributes which are defined for INT3407 and INT3532. @@ -224,22 +225,7 @@ static void dptf_power_remove(struct platform_device *pdev) }static const struct acpi_device_id int3407_device_ids[] = { - {"INT3407" ,0 }, - {"INT3532" ,0 }, - {"INTC1047" ,0 }, - {"INTC1050" ,0 }, - {"INTC1060" ,0 }, - {"INTC1061" ,0 }, - {"INTC1065" ,0 }, - {"INTC1066" ,0 }, - {"INTC106C" ,0 }, - {"INTC106D" ,0 }, - {"INTC10A4" ,0 }, - {"INTC10A5" ,0 }, - {"INTC10D8" ,0 }, - {"INTC10D9" ,0 }, - {"INTC1100" ,0 }, - {"INTC1101" ,0 }, +ACPI_INT3407_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3407_device_ids);drivers/acpi/dptf/int340x_thermal.c +8
-43@@ -9,63 +9,28 @@#include <linux/acpi.h> #include <linux/module.h> +#include "../int340x_thermal.h" #include "../internal.h" static const struct acpi_device_id int340x_thermal_device_ids[] = { - {"INT3400" }, - {"INT3401" }, - {"INT3402" }, - {"INT3403" }, - {"INT3404" }, - {"INT3406" }, - {"INT3407" }, +ACPI_INT3400_DEVICE_IDS , +ACPI_INT3401_DEVICE_IDS , +ACPI_INT3402_DEVICE_IDS , +ACPI_INT3403_DEVICE_IDS , +ACPI_INT3404_DEVICE_IDS , +ACPI_INT3406_DEVICE_IDS , +ACPI_INT3407_DEVICE_IDS , {"INT3408" }, {"INT3409" }, {"INT340A" }, {"INT340B" }, - {"INT3532" }, - {"INTC1040" }, - {"INTC1041" }, - {"INTC1042" }, - {"INTC1043" }, - {"INTC1044" }, {"INTC1045" }, - {"INTC1046" }, - {"INTC1047" }, - {"INTC1048" }, {"INTC1049" }, - {"INTC1050" }, - {"INTC1060" }, - {"INTC1061" }, - {"INTC1062" }, - {"INTC1063" }, {"INTC1064" }, - {"INTC1065" }, - {"INTC1066" }, - {"INTC1068" }, - {"INTC1069" }, - {"INTC106A" }, {"INTC106B" }, - {"INTC106C" }, - {"INTC106D" }, - {"INTC10A0" }, - {"INTC10A1" }, - {"INTC10A2" }, {"INTC10A3" }, - {"INTC10A4" }, - {"INTC10A5" }, - {"INTC10D4" }, - {"INTC10D5" }, - {"INTC10D6" }, {"INTC10D7" }, - {"INTC10D8" }, - {"INTC10D9" }, - {"INTC10FC" }, - {"INTC10FD" }, - {"INTC10FE" }, {"INTC10FF" }, - {"INTC1100" }, - {"INTC1101" }, {"INTC1102" }, {"" }, };drivers/acpi/fan.h +2
-8@@ -11,16 +11,10 @@#define _ACPI_FAN_H_#include <linux/kconfig.h> +#include "int340x_thermal.h" #define ACPI_FAN_DEVICE_IDS \ - {"INT3404", },/* Fan */ \ - {"INTC1044", }, /* Fan for Tiger Lake generation */ \ - {"INTC1048", }, /* Fan for Alder Lake generation */ \ - {"INTC1063", }, /* Fan for Meteor Lake generation */ \ - {"INTC106A", }, /* Fan for Lunar Lake generation */ \ - {"INTC10A2", }, /* Fan for Raptor Lake generation */ \ - {"INTC10D6", }, /* Fan for Panther Lake generation */ \ - {"INTC10FE", }, /* Fan for Wildcat Lake generation */ \ + ACPI_INT3404_DEVICE_IDS, \ {"PNP0C0B", }/* Generic ACPI fan */ #define ACPI_FPS_NAME_LEN 20drivers/acpi/int340x_thermal.h new file +68
-0@@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* +* The ACPI INT340X device IDs are shared between the DPTF core +* and thermal drivers. +*/ + +#ifndef _ACPI_INT340X_H_ +#define _ACPI_INT340X_H_ + +#define ACPI_INT3400_DEVICE_IDS \ + {"INT3400"}, \ + {"INTC1040"}, \ + {"INTC1041"}, \ + {"INTC1042"}, \ + {"INTC1068"}, \ + {"INTC10A0"}, \ + {"INTC10D4"}, \ + {"INTC10FC"} + +#define ACPI_INT3401_DEVICE_IDS \ + {"INT3401"} + +#define ACPI_INT3402_DEVICE_IDS \ + {"INT3402"} + +#define ACPI_INT3403_DEVICE_IDS \ + {"INT3403"}, \ + {"INTC1043"}, \ + {"INTC1046"}, \ + {"INTC1062"}, \ + {"INTC1069"}, \ + {"INTC10A1"}, \ + {"INTC10D5"}, \ + {"INTC10FD"} + +#define ACPI_INT3404_DEVICE_IDS \ + {"INT3404", },/* Fan */ \ + {"INTC1044", }, /* Fan for Tiger Lake generation */ \ + {"INTC1048", }, /* Fan for Alder Lake generation */ \ + {"INTC1063", }, /* Fan for Meteor Lake generation */ \ + {"INTC106A", }, /* Fan for Lunar Lake generation */ \ + {"INTC10A2", }, /* Fan for Raptor Lake generation */ \ + {"INTC10D6", }, /* Fan for Panther Lake generation */ \ + {"INTC10FE", } /* Fan for Wildcat Lake generation */ + +#define ACPI_INT3406_DEVICE_IDS \ + {"INT3406"} + +#define ACPI_INT3407_DEVICE_IDS \ + {"INT3407"}, \ + {"INT3532"}, \ + {"INTC1047"}, \ + {"INTC1050"}, \ + {"INTC1060"}, \ + {"INTC1061"}, \ + {"INTC1065"}, \ + {"INTC1066"}, \ + {"INTC106C"}, \ + {"INTC106D"}, \ + {"INTC10A4"}, \ + {"INTC10A5"}, \ + {"INTC10D8"}, \ + {"INTC10D9"}, \ + {"INTC1100"}, \ + {"INTC1101"} + +#endif drivers/thermal/intel/int340x_thermal/int3400_thermal.c +2
-8@@ -11,6 +11,7 @@#include <linux/acpi.h> #include <linux/thermal.h> #include "acpi_thermal_rel.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3400_THERMAL_TABLE_CHANGED 0x83#define INT3400_ODVP_CHANGED 0x88@@ -683,14 +684,7 @@ static void int3400_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3400_thermal_match[] = { - {"INT3400" ,0 }, - {"INTC1040" ,0 }, - {"INTC1041" ,0 }, - {"INTC1042" ,0 }, - {"INTC1068" ,0 }, - {"INTC10A0" ,0 }, - {"INTC10D4" ,0 }, - {"INTC10FC" ,0 }, +ACPI_INT3400_DEVICE_IDS , {} };drivers/thermal/intel/int340x_thermal/int3401_thermal.c +2
-1@@ -11,9 +11,10 @@#include "int340x_thermal_zone.h" #include "processor_thermal_device.h" +#include "../../../../drivers/acpi/int340x_thermal.h" static const struct acpi_device_id int3401_device_ids[] = { - {"INT3401" ,0 }, +ACPI_INT3401_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3401_device_ids);drivers/thermal/intel/int340x_thermal/int3402_thermal.c +2
-1@@ -11,6 +11,7 @@#include <linux/acpi.h> #include <linux/thermal.h> #include "int340x_thermal_zone.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3402_PERF_CHANGED_EVENT 0x80#define INT3402_THERMAL_EVENT 0x90@@ -84,7 +85,7 @@ static void int3402_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3402_thermal_match[] = { - {"INT3402" ,0 }, +ACPI_INT3402_DEVICE_IDS , {} };drivers/thermal/intel/int340x_thermal/int3403_thermal.c +2
-8@@ -12,6 +12,7 @@#include <linux/thermal.h> #include <linux/platform_device.h> #include "int340x_thermal_zone.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3403_TYPE_SENSOR 0x03#define INT3403_TYPE_CHARGER 0x0B@@ -269,14 +270,7 @@ static void int3403_remove(struct platform_device *pdev) }static const struct acpi_device_id int3403_device_ids[] = { - {"INT3403" ,0 }, - {"INTC1043" ,0 }, - {"INTC1046" ,0 }, - {"INTC1062" ,0 }, - {"INTC1069" ,0 }, - {"INTC10A1" ,0 }, - {"INTC10D5" ,0 }, - {"INTC10FD" ,0 }, +ACPI_INT3403_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3403_device_ids);drivers/thermal/intel/int340x_thermal/int3406_thermal.c +2
-2@@ -12,6 +12,7 @@#include <linux/backlight.h> #include <linux/thermal.h> #include <acpi/video.h> +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3406_BRIGHTNESS_LIMITS_CHANGED 0x80@@ -187,7 +188,7 @@ static void int3406_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3406_thermal_match[] = { - {"INT3406" ,0 }, +ACPI_INT3406_DEVICE_IDS , {} }; --2.51.0.618.g983fd99d29-goog
Rafael J. Wysocki
maintainerRe: [PATCH v3 4/6] ACPI: DPTF: Remove not supported INT340X IDs
In reply to Slawomir RosekQuoted 3 lines · Slawomir Rosek
Remove not supported INT340X and Wildcat Lake ACPI device IDs from scan handler.
I guess "not supported" means "no driver binds to them".
Quoted 27 lines
Fixes 3230bbfce8a9 ("ACPI: introduce ACPI int340x thermal scan handler")Fixes 9cf45756a4b9 ("ACPI: DPTF: Support for Wildcat Lake")Signed-off-by Slawomir Rosek <[email protected]>--- drivers/acpi/dptf/int340x_thermal.c | 6 ------ 1 file changed, 6 deletions(-)drivers/acpi/dptf/int340x_thermal.c +0
-7@@ -21,12 +21,6 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {ACPI_INT3406_DEVICE_IDS ,ACPI_INT3407_DEVICE_IDS ,ACPI_PCH_FIVR_DEVICE_IDS , - {"INT3408"}, - {"INT3409"}, - {"INT340A"}, - {"INT340B"}, - {"INTC10FF"}, - {"INTC1102"}, {""}, }; --2.51.0.618.g983fd99d29-goog
Rafael J. Wysocki
maintainerRe: [PATCH v3 5/6] ACPI: platform: Add macro for acpi platform driver
In reply to Slawomir RosekQuoted 5 lines · Slawomir Rosek
Introduce
module_acpi_platform_driver()macro to simplify dynamic enumeration of ACPI device objects on the platform bus by loadable modules. Move common code from the intel-hid and intel-vbtn drivers to the ACPI platform core.
I think that this goes the other way around: common code is moved from intel-hid and intel-vbtn to acpi_platform and the new macro is introduced as a way for the drivers to invoke that code.
Quoted 1 line
Signed-off-by Slawomir Rosek <[email protected]>
Overall, it looks like this patch does not depend on the [1-4/6] in this series.
Quoted 27 lines
--- drivers/acpi/acpi_platform.c | 27 +++++++++++++++++++++++++ drivers/platform/x86/intel/hid.c | 33 +++---------------------------- drivers/platform/x86/intel/vbtn.c | 30 +--------------------------- include/linux/platform_device.h | 17 ++++++++++++++++ 4 files changed, 48 insertions(+), 59 deletions(-)drivers/acpi/acpi_platform.c +12
-0@@ -190,6 +190,33 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, }EXPORT_SYMBOL_GPL (acpi_create_platform_device); +static acpi_status +__acpi_platform_driver_register_cb (acpi_handle handle,u32 lvl, +void *context,void **rv) +{ +const struct acpi_device_id *ids = context; +struct acpi_device *dev =acpi_fetch_acpi_dev (handle); + +if (dev &&acpi_match_device_ids (dev, ids) ==0 ) +if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL ))) { +dev_info (&dev->dev, +"created platform device\n" ); + }
drivers/acpi/acpi_platform.c struct platform_device *acpi_create_platform_device(struct acpi_device *adev, · line 214
Quoted 10 lines
drivers/acpi/acpi_platform.c +10
-0+ +return AE_OK ; +} + +int __acpi_platform_driver_register (struct platform_driver *drv, +struct module *owner) +{ +acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT ,ACPI_UINT32_MAX , + __acpi_platform_driver_register_cb,NULL , + (void *)drv->driver.acpi_match_table,NULL );
Why is this needed here?
Quoted 29 lines
drivers/acpi/acpi_platform.c +5
-0+ +return __platform_driver_register (drv, owner); +} +EXPORT_SYMBOL_GPL (__acpi_platform_driver_register); +void __init acpi_platform_init (void ) {acpi_reconfig_notifier_register (&acpi_platform_notifier);drivers/platform/x86/intel/hid.c +2
-10@@ -775,34 +775,7 @@ static struct platform_driver intel_hid_pl_driver = {* * As a workaround until the ACPI core figures out how to handle * this corner case, manually ask the ACPI platform device code to -* claim the ACPI node. +* claim the ACPI node by using module_acpi_platform_driver() +* instead of the regular module_platform_driver(). */ -static acpi_status __init -check_acpi_dev (acpi_handle handle,u32 lvl,void *context,void **rv) -{ -const struct acpi_device_id *ids = context; -struct acpi_device *dev =acpi_fetch_acpi_dev (handle); - -if (dev &&acpi_match_device_ids (dev, ids) ==0 ) -if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL ))) - dev_info(&dev->dev,
drivers/platform/x86/intel/hid.c static struct platform_driver intel_hid_pl_driver = { · line 798
Quoted 10 lines
drivers/platform/x86/intel/hid.c +0
-10- "intel-hid: created platform device\n"); - -return AE_OK ; -} - -static int __init intel_hid_init (void ) -{ -acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT , -ACPI_UINT32_MAX , check_acpi_dev,NULL , - (void *)intel_hid_ids,NULL );
This actually isn't right and should not be perpetuated.
Platform devices are created for ACPI device objects with ACPI device IDs by acpi_default_enumeration(), so it should not be necessary to do that from a driver.
Quoted 28 lines
drivers/platform/x86/intel/hid.c +1
-10- -return platform_driver_register (&intel_hid_pl_driver); -} -module_init (intel_hid_init); - -static void __exit intel_hid_exit(void) -{ -platform_driver_unregister (&intel_hid_pl_driver); -} -module_exit (intel_hid_exit); +module_acpi_platform_driver (intel_hid_pl_driver);drivers/platform/x86/intel/vbtn.c +0
-9@@ -390,32 +390,4 @@ static struct platform_driver intel_vbtn_pl_driver = { .remove = intel_vbtn_remove, }; -static acpi_status __init -check_acpi_dev (acpi_handle handle,u32 lvl,void *context,void **rv) -{ -const struct acpi_device_id *ids = context; -struct acpi_device *dev =acpi_fetch_acpi_dev (handle); - -if (dev &&acpi_match_device_ids (dev, ids) ==0 ) -if (!IS_ERR_OR_NULL (acpi_create_platform_device (dev,NULL ))) - dev_info(&dev->dev,
drivers/platform/x86/intel/vbtn.c static struct platform_driver intel_vbtn_pl_driver = { · line 411
Quoted 10 lines
drivers/platform/x86/intel/vbtn.c +0
-10- "intel-vbtn: created platform device\n"); - -return AE_OK ; -} - -static int __init intel_vbtn_init (void ) -{ -acpi_walk_namespace (ACPI_TYPE_DEVICE ,ACPI_ROOT_OBJECT , -ACPI_UINT32_MAX , check_acpi_dev,NULL , - (void *)intel_vbtn_ids,NULL );
Same thing here.
Quoted 16 lines
drivers/platform/x86/intel/vbtn.c +1
-10- -return platform_driver_register (&intel_vbtn_pl_driver); -} -module_init (intel_vbtn_init); - -static void __exit intel_vbtn_exit(void) -{ -platform_driver_unregister (&intel_vbtn_pl_driver); -} -module_exit (intel_vbtn_exit); +module_acpi_platform_driver (intel_vbtn_pl_driver);include/linux/platform_device.h +0
-0
include/linux/platform_device.h extern int __platform_driver_register(struct platform_driver *, · line 273
Quoted 10 lines
include/linux/platform_device.h +7
-0@@ -264,6 +264,14 @@ extern int __platform_driver_register(struct platform_driver *, struct module *);extern void platform_driver_unregister (struct platform_driver *); +/* +* use a macro to avoid include chaining to get THIS_MODULE +*/ +#define acpi_platform_driver_register (drv) \ + __acpi_platform_driver_register(drv, THIS_MODULE) +extern int __acpi_platform_driver_register (struct platform_driver *, +struct module *);
If "extern" is not necessary above, please remove it.
Quoted 21 lines
include/linux/platform_device.h +10
-1+/* non-hotpluggable platform devices may use this so that probe() and * its support may live in __init sections, conserving runtime memory. */ @@ -292,6 +300,15 @@ static inline void platform_set_drvdata(struct platform_device *pdev,module_driver (__platform_driver, platform_driver_register, \ platform_driver_unregister) +/* module_acpi_platform_driver() - Helper macro for drivers that don't do +* anything special in module init/exit. This eliminates a lot of +* boilerplate. Each module may only use this macro once, and +* calling it replaces module_init() and module_exit() + */ +#define module_acpi_platform_driver (__platform_driver) \ + module_driver(__platform_driver, acpi_platform_driver_register, \ + platform_driver_unregister) +/* builtin_platform_driver() - Helper macro for builtin drivers that * don't do anything special in driver init. This eliminates some * boilerplate. Each driver may only use this macro once, and --
Re: [PATCH v3 1/6] ACPI: DPTF: Ignore SoC DTS thermal while scanning
In reply to Rafael J. WysockiQuoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Slawomir Rosek
The Intel SoC DTS thermal driver on Baytrail platform uses IRQ 86 for critical overheating notification. The IRQ 86 is described in the
_CRScontrol method of INT3401 device, thus Intel SoC DTS thermal driver requires INT3401 device to be enumerated.
Quoted 5 lines
I don't think that the specific interrupt number is relevant here. It would be sufficient to say something like "The IRQ used by the Intel SoC DTS thermal device for critical overheating notification is listed in
_CRSof device INT3401 which therefore needs to be enumerated for Intel SoC DTS thermal to work."
Above text is copied from the original change which is linked below. I will rephrase it as you suggested.
Quoted 8 lines
Quoted 4 lines
Since dependency on INT3401 device is unrelated to DPTF the
IS_ENABLE()macro is removed from ACPI DPTF INT340X scan handler, insteadKconfigis updated to ensure proper enumeration of INT3401 device.It is not entirely clear what happens in this patch after reading the above paragraph.
Quoted 6 lines
I would rather continue the previous thought by saying that the enumeration happens by binding the
int3401_thermaldriver to the INT3401 platform device. ThusCONFIG_INT340X_THERMALis in fact necessary for enumerating it, so checkingCONFIG_INTEL_SOC_DTS_THERMALinint340x_thermal_handler_attach()is pointless andINT340X_THERMALmay as well be selected byINTEL_SOC_DTS_THERMAL.
Sure, I will rephrase it to clearly describe what happens here.
Quoted 4 lines
Quoted 2 lines
Fixes 014d9d5d0cc1 ("ACPI/int340x_thermal: enumerate INT3401 for Intel SoC DTS thermal driver")Why do you want this tag to be added?
Just for context. The IS_ENABLE is added to the scan handler in 014d9d5d0cc1 and this change is about to fix that. I can remove the tag if it's not needed.
Quoted 40 lines
Quoted 40 lines
Signed-off-by Slawomir Rosek <[email protected]>--- drivers/acpi/dptf/int340x_thermal.c | 7 +------ drivers/thermal/intel/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-)drivers/acpi/dptf/int340x_thermal.c +1
-6@@ -11,10 +11,9 @@#include "../internal.h" -#define INT3401_DEVICE 0X01static const struct acpi_device_id int340x_thermal_device_ids[] = { {"INT3400" }, - {"INT3401" ,INT3401_DEVICE }, + {"INT3401" }, {"INT3402" }, {"INT3403" }, {"INT3404" },@@ -76,10 +75,6 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev, {if (IS_ENABLED (CONFIG_INT340X_THERMAL ))acpi_create_platform_device (adev,NULL ); -/* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ -else if (IS_ENABLED (CONFIG_INTEL_SOC_DTS_THERMAL ) && - id->driver_data ==INT3401_DEVICE ) -acpi_create_platform_device (adev,NULL );return 1 ; }drivers/thermal/intel/Kconfig +0
-0@@ -44,7 +44,8 @@ config INTEL_SOC_DTS_IOSF_CORE
Quoted 7 lines
drivers/thermal/intel/Kconfig config INTEL_SOC_DTS_IOSF_CORE · line 47
Quoted 4 lines
drivers/thermal/intel/Kconfig +1
-1config INTEL_SOC_DTS_THERMAL tristate "Intel SoCs DTS thermal driver" - depends on X86 && PCI && ACPI + depends on X86_64 && PCI && ACPIAFAICS NET needs to be added to the dependency list above or selecting
INT340X_THERMALbelow may not actually cause it to be built.
Right. Previously I tried to "select NET" (INTEL_SOC_DTS_THERMAL does not depend on NET directly so it seemed to be more appropriate to me) but got circular dependency error so I assumed it is ensured somehow. Now I checked again and you are right, I was able to disable NET and get unmet dependencies. I will add dependency on NET. Thanks
Quoted 6 lines
Quoted 6 lines
drivers/thermal/intel/Kconfig +1
-1+ select INT340X_THERMAL select INTEL_SOC_DTS_IOSF_CORE help Enable this to register Intel SoCs (e.g. Bay Trail) platform digital --
Re: [PATCH v3 4/6] ACPI: DPTF: Remove not supported INT340X IDs
In reply to Rafael J. WysockiQuoted 7 lines · Rafael J. Wysocki
Quoted 3 lines · Slawomir Rosek
Remove not supported INT340X and Wildcat Lake ACPI device IDs from scan handler.
I guess "not supported" means "no driver binds to them".
Right, I will clarify this.
Quoted 28 lines
Quoted 28 lines
Fixes 3230bbfce8a9 ("ACPI: introduce ACPI int340x thermal scan handler")Fixes 9cf45756a4b9 ("ACPI: DPTF: Support for Wildcat Lake")Signed-off-by Slawomir Rosek <[email protected]>--- drivers/acpi/dptf/int340x_thermal.c | 6 ------ 1 file changed, 6 deletions(-)drivers/acpi/dptf/int340x_thermal.c +0
-7@@ -21,12 +21,6 @@ static const struct acpi_device_id int340x_thermal_device_ids[] = {ACPI_INT3406_DEVICE_IDS ,ACPI_INT3407_DEVICE_IDS ,ACPI_PCH_FIVR_DEVICE_IDS , - {"INT3408"}, - {"INT3409"}, - {"INT340A"}, - {"INT340B"}, - {"INTC10FF"}, - {"INTC1102"}, {""}, }; --2.51.0.618.g983fd99d29-goog
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
In reply to Rafael J. WysockiQuoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Slawomir Rosek
The ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
Quoted 6 lines
Quoted 1 line
Signed-off-by Slawomir Rosek <[email protected]>I've actually started to wonder if
int340x_thermal_handleris needed at all.It just creates a platform device if the given ACPI device ID is in its list,
That's true. It creates platform device for the given ACPI device ID, but only if CONFIG_INT340X_THERMAL is enabled.
Quoted 2 lines
but
acpi_default_enumeration()would do that too with the caveat that it would also be done forCONFIG_INT340X_THERMALunset.
Not exactly. scan handler returns ret=1, so device is marked as enumerated
https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/acpi/scan.c#L2314
Quoted 3 lines
That should not be a problem though because if
CONFIG_INT340X_THERMAL, there are no drivers that will bind to those platform devices, so the net outcome should be the same.
If CONFIG_INT340X_THERMAL is not set and there are no drivers to attach to platform devices and int340x_thermal_handler is removed then you are right, acpi_default_enumeration() will enumerate ACPI bus anyway and create platform devices for all ACPI device IDs. However, for me it looks like it was intentional to prevent this behaviour unless INT340X drivers are "present" in the system (were enabled for build so should be). I am not sure how DPTF works and what may happen if platform devices are visible in sysfs while drivers are not loaded.
Quoted 4 lines
Thus I'm wondering if the way to go might be to drop
int340x_thermal_handlerand simply keep the device IDs in the drivers that use them for device binding.
Even better. If it's not required for DPTF to prevent enumeration on the platform bus I can simply remove the scan handler.
Quoted 341 lines
Quoted 341 lines
--- drivers/acpi/dptf/dptf_power.c | 18 +---- drivers/acpi/dptf/int340x_thermal.c | 51 +++----------- drivers/acpi/fan.h | 10 +-- drivers/acpi/int340x_thermal.h | 68 +++++++++++++++++++ .../intel/int340x_thermal/int3400_thermal.c | 10 +-- .../intel/int340x_thermal/int3401_thermal.c | 3 +- .../intel/int340x_thermal/int3402_thermal.c | 3 +- .../intel/int340x_thermal/int3403_thermal.c | 10 +-- .../intel/int340x_thermal/int3406_thermal.c | 3 +- 9 files changed, 90 insertions(+), 86 deletions(-) create mode 100644 drivers/acpi/int340x_thermal.hdrivers/acpi/dptf/dptf_power.c +2
-16@@ -8,6 +8,7 @@#include <linux/module.h> #include <linux/acpi.h> #include <linux/platform_device.h> +#include "../int340x_thermal.h" /* * Presentation of attributes which are defined for INT3407 and INT3532. @@ -224,22 +225,7 @@ static void dptf_power_remove(struct platform_device *pdev) }static const struct acpi_device_id int3407_device_ids[] = { - {"INT3407" ,0 }, - {"INT3532" ,0 }, - {"INTC1047" ,0 }, - {"INTC1050" ,0 }, - {"INTC1060" ,0 }, - {"INTC1061" ,0 }, - {"INTC1065" ,0 }, - {"INTC1066" ,0 }, - {"INTC106C" ,0 }, - {"INTC106D" ,0 }, - {"INTC10A4" ,0 }, - {"INTC10A5" ,0 }, - {"INTC10D8" ,0 }, - {"INTC10D9" ,0 }, - {"INTC1100" ,0 }, - {"INTC1101" ,0 }, +ACPI_INT3407_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3407_device_ids);drivers/acpi/dptf/int340x_thermal.c +8
-43@@ -9,63 +9,28 @@#include <linux/acpi.h> #include <linux/module.h> +#include "../int340x_thermal.h" #include "../internal.h" static const struct acpi_device_id int340x_thermal_device_ids[] = { - {"INT3400" }, - {"INT3401" }, - {"INT3402" }, - {"INT3403" }, - {"INT3404" }, - {"INT3406" }, - {"INT3407" }, +ACPI_INT3400_DEVICE_IDS , +ACPI_INT3401_DEVICE_IDS , +ACPI_INT3402_DEVICE_IDS , +ACPI_INT3403_DEVICE_IDS , +ACPI_INT3404_DEVICE_IDS , +ACPI_INT3406_DEVICE_IDS , +ACPI_INT3407_DEVICE_IDS , {"INT3408" }, {"INT3409" }, {"INT340A" }, {"INT340B" }, - {"INT3532" }, - {"INTC1040" }, - {"INTC1041" }, - {"INTC1042" }, - {"INTC1043" }, - {"INTC1044" }, {"INTC1045" }, - {"INTC1046" }, - {"INTC1047" }, - {"INTC1048" }, {"INTC1049" }, - {"INTC1050" }, - {"INTC1060" }, - {"INTC1061" }, - {"INTC1062" }, - {"INTC1063" }, {"INTC1064" }, - {"INTC1065" }, - {"INTC1066" }, - {"INTC1068" }, - {"INTC1069" }, - {"INTC106A" }, {"INTC106B" }, - {"INTC106C" }, - {"INTC106D" }, - {"INTC10A0" }, - {"INTC10A1" }, - {"INTC10A2" }, {"INTC10A3" }, - {"INTC10A4" }, - {"INTC10A5" }, - {"INTC10D4" }, - {"INTC10D5" }, - {"INTC10D6" }, {"INTC10D7" }, - {"INTC10D8" }, - {"INTC10D9" }, - {"INTC10FC" }, - {"INTC10FD" }, - {"INTC10FE" }, {"INTC10FF" }, - {"INTC1100" }, - {"INTC1101" }, {"INTC1102" }, {"" }, };drivers/acpi/fan.h +2
-8@@ -11,16 +11,10 @@#define _ACPI_FAN_H_#include <linux/kconfig.h> +#include "int340x_thermal.h" #define ACPI_FAN_DEVICE_IDS \ - {"INT3404", },/* Fan */ \ - {"INTC1044", }, /* Fan for Tiger Lake generation */ \ - {"INTC1048", }, /* Fan for Alder Lake generation */ \ - {"INTC1063", }, /* Fan for Meteor Lake generation */ \ - {"INTC106A", }, /* Fan for Lunar Lake generation */ \ - {"INTC10A2", }, /* Fan for Raptor Lake generation */ \ - {"INTC10D6", }, /* Fan for Panther Lake generation */ \ - {"INTC10FE", }, /* Fan for Wildcat Lake generation */ \ + ACPI_INT3404_DEVICE_IDS, \ {"PNP0C0B", }/* Generic ACPI fan */ #define ACPI_FPS_NAME_LEN 20drivers/acpi/int340x_thermal.h new file +68
-0@@ -0,0 +1,68 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +/* +* The ACPI INT340X device IDs are shared between the DPTF core +* and thermal drivers. +*/ + +#ifndef _ACPI_INT340X_H_ +#define _ACPI_INT340X_H_ + +#define ACPI_INT3400_DEVICE_IDS \ + {"INT3400"}, \ + {"INTC1040"}, \ + {"INTC1041"}, \ + {"INTC1042"}, \ + {"INTC1068"}, \ + {"INTC10A0"}, \ + {"INTC10D4"}, \ + {"INTC10FC"} + +#define ACPI_INT3401_DEVICE_IDS \ + {"INT3401"} + +#define ACPI_INT3402_DEVICE_IDS \ + {"INT3402"} + +#define ACPI_INT3403_DEVICE_IDS \ + {"INT3403"}, \ + {"INTC1043"}, \ + {"INTC1046"}, \ + {"INTC1062"}, \ + {"INTC1069"}, \ + {"INTC10A1"}, \ + {"INTC10D5"}, \ + {"INTC10FD"} + +#define ACPI_INT3404_DEVICE_IDS \ + {"INT3404", },/* Fan */ \ + {"INTC1044", }, /* Fan for Tiger Lake generation */ \ + {"INTC1048", }, /* Fan for Alder Lake generation */ \ + {"INTC1063", }, /* Fan for Meteor Lake generation */ \ + {"INTC106A", }, /* Fan for Lunar Lake generation */ \ + {"INTC10A2", }, /* Fan for Raptor Lake generation */ \ + {"INTC10D6", }, /* Fan for Panther Lake generation */ \ + {"INTC10FE", } /* Fan for Wildcat Lake generation */ + +#define ACPI_INT3406_DEVICE_IDS \ + {"INT3406"} + +#define ACPI_INT3407_DEVICE_IDS \ + {"INT3407"}, \ + {"INT3532"}, \ + {"INTC1047"}, \ + {"INTC1050"}, \ + {"INTC1060"}, \ + {"INTC1061"}, \ + {"INTC1065"}, \ + {"INTC1066"}, \ + {"INTC106C"}, \ + {"INTC106D"}, \ + {"INTC10A4"}, \ + {"INTC10A5"}, \ + {"INTC10D8"}, \ + {"INTC10D9"}, \ + {"INTC1100"}, \ + {"INTC1101"} + +#endif drivers/thermal/intel/int340x_thermal/int3400_thermal.c +2
-8@@ -11,6 +11,7 @@#include <linux/acpi.h> #include <linux/thermal.h> #include "acpi_thermal_rel.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3400_THERMAL_TABLE_CHANGED 0x83#define INT3400_ODVP_CHANGED 0x88@@ -683,14 +684,7 @@ static void int3400_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3400_thermal_match[] = { - {"INT3400" ,0 }, - {"INTC1040" ,0 }, - {"INTC1041" ,0 }, - {"INTC1042" ,0 }, - {"INTC1068" ,0 }, - {"INTC10A0" ,0 }, - {"INTC10D4" ,0 }, - {"INTC10FC" ,0 }, +ACPI_INT3400_DEVICE_IDS , {} };drivers/thermal/intel/int340x_thermal/int3401_thermal.c +2
-1@@ -11,9 +11,10 @@#include "int340x_thermal_zone.h" #include "processor_thermal_device.h" +#include "../../../../drivers/acpi/int340x_thermal.h" static const struct acpi_device_id int3401_device_ids[] = { - {"INT3401" ,0 }, +ACPI_INT3401_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3401_device_ids);drivers/thermal/intel/int340x_thermal/int3402_thermal.c +2
-1@@ -11,6 +11,7 @@#include <linux/acpi.h> #include <linux/thermal.h> #include "int340x_thermal_zone.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3402_PERF_CHANGED_EVENT 0x80#define INT3402_THERMAL_EVENT 0x90@@ -84,7 +85,7 @@ static void int3402_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3402_thermal_match[] = { - {"INT3402" ,0 }, +ACPI_INT3402_DEVICE_IDS , {} };drivers/thermal/intel/int340x_thermal/int3403_thermal.c +2
-8@@ -12,6 +12,7 @@#include <linux/thermal.h> #include <linux/platform_device.h> #include "int340x_thermal_zone.h" +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3403_TYPE_SENSOR 0x03#define INT3403_TYPE_CHARGER 0x0B@@ -269,14 +270,7 @@ static void int3403_remove(struct platform_device *pdev) }static const struct acpi_device_id int3403_device_ids[] = { - {"INT3403" ,0 }, - {"INTC1043" ,0 }, - {"INTC1046" ,0 }, - {"INTC1062" ,0 }, - {"INTC1069" ,0 }, - {"INTC10A1" ,0 }, - {"INTC10D5" ,0 }, - {"INTC10FD" ,0 }, +ACPI_INT3403_DEVICE_IDS , {"" ,0 }, };MODULE_DEVICE_TABLE (acpi, int3403_device_ids);drivers/thermal/intel/int340x_thermal/int3406_thermal.c +2
-2@@ -12,6 +12,7 @@#include <linux/backlight.h> #include <linux/thermal.h> #include <acpi/video.h> +#include "../../../../drivers/acpi/int340x_thermal.h" #define INT3406_BRIGHTNESS_LIMITS_CHANGED 0x80@@ -187,7 +188,7 @@ static void int3406_thermal_remove(struct platform_device *pdev) }static const struct acpi_device_id int3406_thermal_match[] = { - {"INT3406" ,0 }, +ACPI_INT3406_DEVICE_IDS , {} }; --2.51.0.618.g983fd99d29-goog
Rafael J. Wysocki
maintainerRe: [PATCH v3 1/6] ACPI: DPTF: Ignore SoC DTS thermal while scanning
In reply to Sławomir RosekQuoted 37 lines · Sławomir Rosek
Quoted 8 lines · Rafael J. Wysocki
Quoted 5 lines · Slawomir Rosek
The Intel SoC DTS thermal driver on Baytrail platform uses IRQ 86 for critical overheating notification. The IRQ 86 is described in the
_CRScontrol method of INT3401 device, thus Intel SoC DTS thermal driver requires INT3401 device to be enumerated.Quoted 5 lines
I don't think that the specific interrupt number is relevant here. It would be sufficient to say something like "The IRQ used by the Intel SoC DTS thermal device for critical overheating notification is listed in
_CRSof device INT3401 which therefore needs to be enumerated for Intel SoC DTS thermal to work."Above text is copied from the original change which is linked below. I will rephrase it as you suggested.
Quoted 8 lines
Quoted 4 lines
Since dependency on INT3401 device is unrelated to DPTF the
IS_ENABLE()macro is removed from ACPI DPTF INT340X scan handler, insteadKconfigis updated to ensure proper enumeration of INT3401 device.It is not entirely clear what happens in this patch after reading the above paragraph.
Quoted 6 lines
I would rather continue the previous thought by saying that the enumeration happens by binding the
int3401_thermaldriver to the INT3401 platform device. ThusCONFIG_INT340X_THERMALis in fact necessary for enumerating it, so checkingCONFIG_INTEL_SOC_DTS_THERMALinint340x_thermal_handler_attach()is pointless andINT340X_THERMALmay as well be selected byINTEL_SOC_DTS_THERMAL.Sure, I will rephrase it to clearly describe what happens here.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Fixes 014d9d5d0cc1 ("ACPI/int340x_thermal: enumerate INT3401 for Intel SoC DTS thermal driver")Why do you want this tag to be added?
Just for context. The
IS_ENABLEis added to the scan handler in014d9d5d0cc1and this change is about to fix that. I can remove the tag if it's not needed.
I don't see a functional issue with this, it is just dead code AFAICS. As a rule, Fixes: tags are not added to patches removing dead code.
Quoted 48 lines
Quoted 40 lines
Quoted 40 lines
Signed-off-by Slawomir Rosek <[email protected]>--- drivers/acpi/dptf/int340x_thermal.c | 7 +------ drivers/thermal/intel/Kconfig | 3 ++- 2 files changed, 3 insertions(+), 7 deletions(-)drivers/acpi/dptf/int340x_thermal.c +1
-6@@ -11,10 +11,9 @@#include "../internal.h" -#define INT3401_DEVICE 0X01static const struct acpi_device_id int340x_thermal_device_ids[] = { {"INT3400" }, - {"INT3401" ,INT3401_DEVICE }, + {"INT3401" }, {"INT3402" }, {"INT3403" }, {"INT3404" },@@ -76,10 +75,6 @@ static int int340x_thermal_handler_attach(struct acpi_device *adev, {if (IS_ENABLED (CONFIG_INT340X_THERMAL ))acpi_create_platform_device (adev,NULL ); -/* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */ -else if (IS_ENABLED (CONFIG_INTEL_SOC_DTS_THERMAL ) && - id->driver_data ==INT3401_DEVICE ) -acpi_create_platform_device (adev,NULL );return 1 ; }drivers/thermal/intel/Kconfig +0
-0@@ -44,7 +44,8 @@ config INTEL_SOC_DTS_IOSF_COREQuoted 7 lines
drivers/thermal/intel/Kconfig config INTEL_SOC_DTS_IOSF_CORE · line 47
Quoted 4 lines
drivers/thermal/intel/Kconfig +1
-1config INTEL_SOC_DTS_THERMAL tristate "Intel SoCs DTS thermal driver" - depends on X86 && PCI && ACPI + depends on X86_64 && PCI && ACPIAFAICS NET needs to be added to the dependency list above or selecting
INT340X_THERMALbelow may not actually cause it to be built.
Quoted 5 lines
Right. Previously I tried to "select NET" (
INTEL_SOC_DTS_THERMALdoes not depend on NET directly so it seemed to be more appropriate to me) but got circular dependency error so I assumed it is ensured somehow. Now I checked again and you are right, I was able to disable NET and get unmet dependencies. I will add dependency on NET. Thanks
The rule of thumb is that if you want A to select B, then they both need to depend on the same things.
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines
drivers/thermal/intel/Kconfig +1
-1+ select INT340X_THERMAL select INTEL_SOC_DTS_IOSF_CORE help Enable this to register Intel SoCs (e.g. Bay Trail) platform digital --
Rafael J. Wysocki
maintainerRe: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
In reply to Sławomir RosekQuoted 28 lines · Sławomir Rosek
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Slawomir Rosek
The ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
Quoted 6 lines
Quoted 1 line
Signed-off-by Slawomir Rosek <[email protected]>I've actually started to wonder if
int340x_thermal_handleris needed at all.It just creates a platform device if the given ACPI device ID is in its list,
That's true. It creates platform device for the given ACPI device ID, but only if
CONFIG_INT340X_THERMALis enabled.Quoted 2 lines
but
acpi_default_enumeration()would do that too with the caveat that it would also be done forCONFIG_INT340X_THERMALunset.Not exactly. scan handler returns ret=1, so device is marked as enumerated
https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/acpi/scan.c#L2314Quoted 3 lines
That should not be a problem though because if
CONFIG_INT340X_THERMAL, there are no drivers that will bind to those platform devices, so the net outcome should be the same.
Quoted 8 lines
If
CONFIG_INT340X_THERMALis not set and there are no drivers to attach to platform devices andint340x_thermal_handleris removed then you are right,acpi_default_enumeration()will enumerate ACPI bus anyway and create platform devices for all ACPI device IDs. However, for me it looks like it was intentional to prevent this behaviour unless INT340X drivers are "present" in the system (were enabled for build so should be). I am not sure how DPTF works and what may happen if platform devices are visible in sysfs while drivers are not loaded.
Such a dependency would be unexpected and confusing.
Also, I'm not sure why it would be useful because the lack of drivers means that the devices in question are not handled, so no functionality related to them is provided by the kernel.
Quoted 7 lines
Quoted 4 lines
Thus I'm wondering if the way to go might be to drop
int340x_thermal_handlerand simply keep the device IDs in the drivers that use them for device binding.Even better. If it's not required for DPTF to prevent enumeration on the platform bus I can simply remove the scan handler.
I would at least try to do that.
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Quoted 46 lines · Rafael J. Wysocki
Quoted 28 lines · Sławomir Rosek
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Slawomir Rosek
The ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
Quoted 6 lines
Quoted 1 line
Signed-off-by Slawomir Rosek <[email protected]>I've actually started to wonder if
int340x_thermal_handleris needed at all.It just creates a platform device if the given ACPI device ID is in its list,
That's true. It creates platform device for the given ACPI device ID, but only if
CONFIG_INT340X_THERMALis enabled.Quoted 2 lines
but
acpi_default_enumeration()would do that too with the caveat that it would also be done forCONFIG_INT340X_THERMALunset.Not exactly. scan handler returns ret=1, so device is marked as enumerated
https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/acpi/scan.c#L2314Quoted 3 lines
That should not be a problem though because if
CONFIG_INT340X_THERMAL, there are no drivers that will bind to those platform devices, so the net outcome should be the same.Quoted 8 lines
If
CONFIG_INT340X_THERMALis not set and there are no drivers to attach to platform devices andint340x_thermal_handleris removed then you are right,acpi_default_enumeration()will enumerate ACPI bus anyway and create platform devices for all ACPI device IDs. However, for me it looks like it was intentional to prevent this behaviour unless INT340X drivers are "present" in the system (were enabled for build so should be). I am not sure how DPTF works and what may happen if platform devices are visible in sysfs while drivers are not loaded.Such a dependency would be unexpected and confusing.
Also, I'm not sure why it would be useful because the lack of drivers means that the devices in question are not handled, so no functionality related to them is provided by the kernel.
Quoted 1 line
Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Thus I'm wondering if the way to go might be to drop
int340x_thermal_handlerand simply keep the device IDs in the drivers that use them for device binding.Even better. If it's not required for DPTF to prevent enumeration on the platform bus I can simply remove the scan handler.
I would at least try to do that.
Makes sense, so I'll give it a try. Removing handler will result with only two patches, one to update dts_doc_thermal kconfig and second to remove the dptf scan handler, the rest won't be needed for a new patchset. Should I send it as v4?
Rafael J. Wysocki
maintainerRe: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Quoted 55 lines · Sławomir Rosek
Quoted 53 lines · Rafael J. Wysocki
Quoted 28 lines · Sławomir Rosek
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Slawomir Rosek
The ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
Quoted 6 lines
Quoted 1 line
Signed-off-by Slawomir Rosek <[email protected]>I've actually started to wonder if
int340x_thermal_handleris needed at all.It just creates a platform device if the given ACPI device ID is in its list,
That's true. It creates platform device for the given ACPI device ID, but only if
CONFIG_INT340X_THERMALis enabled.Quoted 2 lines
but
acpi_default_enumeration()would do that too with the caveat that it would also be done forCONFIG_INT340X_THERMALunset.Not exactly. scan handler returns ret=1, so device is marked as enumerated
https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/acpi/scan.c#L2314Quoted 3 lines
That should not be a problem though because if
CONFIG_INT340X_THERMAL, there are no drivers that will bind to those platform devices, so the net outcome should be the same.Quoted 8 lines
If
CONFIG_INT340X_THERMALis not set and there are no drivers to attach to platform devices andint340x_thermal_handleris removed then you are right,acpi_default_enumeration()will enumerate ACPI bus anyway and create platform devices for all ACPI device IDs. However, for me it looks like it was intentional to prevent this behaviour unless INT340X drivers are "present" in the system (were enabled for build so should be). I am not sure how DPTF works and what may happen if platform devices are visible in sysfs while drivers are not loaded.Such a dependency would be unexpected and confusing.
Also, I'm not sure why it would be useful because the lack of drivers means that the devices in question are not handled, so no functionality related to them is provided by the kernel.
Quoted 7 lines
Quoted 4 lines
Thus I'm wondering if the way to go might be to drop
int340x_thermal_handlerand simply keep the device IDs in the drivers that use them for device binding.Even better. If it's not required for DPTF to prevent enumeration on the platform bus I can simply remove the scan handler.
Quoted 6 lines
Quoted 1 line
I would at least try to do that.
Makes sense, so I'll give it a try. Removing handler will result with only two patches, one to update
dts_doc_thermalkconfig and second to remove the dptf scan handler, the rest won't be needed for a new patchset. Should I send it as v4?
Yes, please!
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Quoted 57 lines · Rafael J. Wysocki
Quoted 55 lines · Sławomir Rosek
Quoted 53 lines · Rafael J. Wysocki
Quoted 28 lines · Sławomir Rosek
Quoted 6 lines · Rafael J. Wysocki
Quoted 4 lines · Slawomir Rosek
The ACPI INT340X device IDs are shared between the DPTF core and thermal drivers, thus they are moved to the common header.
Quoted 6 lines
Quoted 1 line
Signed-off-by Slawomir Rosek <[email protected]>I've actually started to wonder if
int340x_thermal_handleris needed at all.It just creates a platform device if the given ACPI device ID is in its list,
That's true. It creates platform device for the given ACPI device ID, but only if
CONFIG_INT340X_THERMALis enabled.Quoted 2 lines
but
acpi_default_enumeration()would do that too with the caveat that it would also be done forCONFIG_INT340X_THERMALunset.Not exactly. scan handler returns ret=1, so device is marked as enumerated
https://elixir.bootlin.com/linux/v6.18-rc2/source/drivers/acpi/scan.c#L2314Quoted 3 lines
That should not be a problem though because if
CONFIG_INT340X_THERMAL, there are no drivers that will bind to those platform devices, so the net outcome should be the same.Quoted 8 lines
If
CONFIG_INT340X_THERMALis not set and there are no drivers to attach to platform devices andint340x_thermal_handleris removed then you are right,acpi_default_enumeration()will enumerate ACPI bus anyway and create platform devices for all ACPI device IDs. However, for me it looks like it was intentional to prevent this behaviour unless INT340X drivers are "present" in the system (were enabled for build so should be). I am not sure how DPTF works and what may happen if platform devices are visible in sysfs while drivers are not loaded.Such a dependency would be unexpected and confusing.
Also, I'm not sure why it would be useful because the lack of drivers means that the devices in question are not handled, so no functionality related to them is provided by the kernel.
Quoted 7 lines
Quoted 4 lines
Thus I'm wondering if the way to go might be to drop
int340x_thermal_handlerand simply keep the device IDs in the drivers that use them for device binding.Even better. If it's not required for DPTF to prevent enumeration on the platform bus I can simply remove the scan handler.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I would at least try to do that.
Makes sense, so I'll give it a try. Removing handler will result with only two patches, one to update
dts_doc_thermalkconfig and second to remove the dptf scan handler, the rest won't be needed for a new patchset. Should I send it as v4?Yes, please!
I removed the scan handler and tested it on i7-9750H using Ubuntu 24.04, Linux 6.12.56
and DPTF 9.0.11402. With CONFIG_INT340X_THERMAL enabled DPTF daemon starts without
errors, with CONFIG_INT340X_THERMAL disabled the int340x devices are enumerated on the platform bus and DPTF fails to retrieve TCC Offset on initialization:
2025-11-03T09:03:07.108038+01:00 localhost kernel: Consider using thermal netlink events interface 2025-11-03T09:03:07.109139+01:00 localhost DPTF[4098]:
ERROR:[<ACTION>ActionSysfsGet@esif_uf_action_sysfs_os_lin.c#1205]<1762156987108 ms>: Error retrieving TCC Offset value from sysfs.
For comparison, with CONFIG_INT340X_THERMAL disabled on the pure Linux 6.12.56 the int340x are not enumerated on the platform bus and DPTF initialization fails as follow:
2025-11-03T08:43:31.725514+01:00 localhost kernel: Consider using thermal netlink events interface 2025-11-03T08:43:31.727119+01:00 localhost DPTF[4046]: ERROR:[<LINUX>GetManagerSysfsPath@esif_uf_sysfs_enumerate_os_lin.c#1004]<1762155811726 ms>: GetManagerSysfsPathFromAcpiId failed 2025-11-03T08:43:31.727934+01:00 localhost DPTF[4046]: ERROR:[<ACTION>ActionSysfsGet@esif_uf_action_sysfs_os_lin.c#1205]<1762155811727 ms>: Error retrieving TCC Offset value from sysfs. 2025-11-03T08:43:31.729027+01:00 localhost DPTF[4046]:
ERROR:[<ACTION>GetGddvData@esif_uf_action_sysfs_os_lin.c#2818]<1762155811728 ms>: g_ManagerSysfsPath Invalid
Link to v4: https://lore.kernel.org/all/[email protected]/
Thanks!