[PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header

Slawomir Rosek posted 6 patches 4 months, 1 week ago
[PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Posted by Slawomir Rosek 4 months, 1 week ago
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 <srosek@google.com>
---
 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

diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
index 776914f31b9e..d7c59f016083 100644
--- a/drivers/acpi/dptf/dptf_power.c
+++ b/drivers/acpi/dptf/dptf_power.c
@@ -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);
diff --git a/drivers/acpi/dptf/int340x_thermal.c b/drivers/acpi/dptf/int340x_thermal.c
index 947fe50c2ef6..43afb6141b98 100644
--- a/drivers/acpi/dptf/int340x_thermal.c
+++ b/drivers/acpi/dptf/int340x_thermal.c
@@ -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"},
 	{""},
 };
diff --git a/drivers/acpi/fan.h b/drivers/acpi/fan.h
index 8a28a72a7c6a..4015ac56c009 100644
--- a/drivers/acpi/fan.h
+++ b/drivers/acpi/fan.h
@@ -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
diff --git a/drivers/acpi/int340x_thermal.h b/drivers/acpi/int340x_thermal.h
new file mode 100644
index 000000000000..854e4d3bb739
--- /dev/null
+++ b/drivers/acpi/int340x_thermal.h
@@ -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
diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
index 908cc1bf57f1..6311125c3ebd 100644
--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
@@ -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,
 	{}
 };
 
diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
index 96d6277a5a8c..e0603f218d2e 100644
--- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
@@ -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);
diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
index 57b90005888a..213d4535f2c1 100644
--- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
@@ -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,
 	{}
 };
 
diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
index ba63796761eb..d246c69d4872 100644
--- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
@@ -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);
diff --git a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
index e21fcbccf4ba..d05ca8bc4061 100644
--- a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
+++ b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
@@ -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
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Posted by Rafael J. Wysocki 3 months, 2 weeks ago
On Thu, Oct 2, 2025 at 1:34 PM Slawomir Rosek <srosek@google.com> wrote:
>
> 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 <srosek@google.com>

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.

> ---
>  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
>
> diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
> index 776914f31b9e..d7c59f016083 100644
> --- a/drivers/acpi/dptf/dptf_power.c
> +++ b/drivers/acpi/dptf/dptf_power.c
> @@ -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);
> diff --git a/drivers/acpi/dptf/int340x_thermal.c b/drivers/acpi/dptf/int340x_thermal.c
> index 947fe50c2ef6..43afb6141b98 100644
> --- a/drivers/acpi/dptf/int340x_thermal.c
> +++ b/drivers/acpi/dptf/int340x_thermal.c
> @@ -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"},
>         {""},
>  };
> diff --git a/drivers/acpi/fan.h b/drivers/acpi/fan.h
> index 8a28a72a7c6a..4015ac56c009 100644
> --- a/drivers/acpi/fan.h
> +++ b/drivers/acpi/fan.h
> @@ -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
> diff --git a/drivers/acpi/int340x_thermal.h b/drivers/acpi/int340x_thermal.h
> new file mode 100644
> index 000000000000..854e4d3bb739
> --- /dev/null
> +++ b/drivers/acpi/int340x_thermal.h
> @@ -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
> diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> index 908cc1bf57f1..6311125c3ebd 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> @@ -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,
>         {}
>  };
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> index 96d6277a5a8c..e0603f218d2e 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> @@ -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);
> diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> index 57b90005888a..213d4535f2c1 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> @@ -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,
>         {}
>  };
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> index ba63796761eb..d246c69d4872 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> @@ -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);
> diff --git a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> index e21fcbccf4ba..d05ca8bc4061 100644
> --- a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> +++ b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> @@ -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
>
>
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Posted by Sławomir Rosek 3 months, 2 weeks ago
On Wed, Oct 22, 2025 at 8:46 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Thu, Oct 2, 2025 at 1:34 PM Slawomir Rosek <srosek@google.com> wrote:
> >
> > 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 <srosek@google.com>
>
> 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,

That's true. It creates platform device for the given ACPI device ID,
but only if CONFIG_INT340X_THERMAL is enabled.

> but acpi_default_enumeration() would do that too with the
> caveat that it would also be done for CONFIG_INT340X_THERMAL unset.

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

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

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

Even better. If it's not required for DPTF to prevent enumeration
on the platform bus I can simply remove the scan handler.

>
> > ---
> >  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
> >
> > diff --git a/drivers/acpi/dptf/dptf_power.c b/drivers/acpi/dptf/dptf_power.c
> > index 776914f31b9e..d7c59f016083 100644
> > --- a/drivers/acpi/dptf/dptf_power.c
> > +++ b/drivers/acpi/dptf/dptf_power.c
> > @@ -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);
> > diff --git a/drivers/acpi/dptf/int340x_thermal.c b/drivers/acpi/dptf/int340x_thermal.c
> > index 947fe50c2ef6..43afb6141b98 100644
> > --- a/drivers/acpi/dptf/int340x_thermal.c
> > +++ b/drivers/acpi/dptf/int340x_thermal.c
> > @@ -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"},
> >         {""},
> >  };
> > diff --git a/drivers/acpi/fan.h b/drivers/acpi/fan.h
> > index 8a28a72a7c6a..4015ac56c009 100644
> > --- a/drivers/acpi/fan.h
> > +++ b/drivers/acpi/fan.h
> > @@ -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
> > diff --git a/drivers/acpi/int340x_thermal.h b/drivers/acpi/int340x_thermal.h
> > new file mode 100644
> > index 000000000000..854e4d3bb739
> > --- /dev/null
> > +++ b/drivers/acpi/int340x_thermal.h
> > @@ -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
> > diff --git a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > index 908cc1bf57f1..6311125c3ebd 100644
> > --- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > +++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
> > @@ -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,
> >         {}
> >  };
> >
> > diff --git a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> > index 96d6277a5a8c..e0603f218d2e 100644
> > --- a/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> > +++ b/drivers/thermal/intel/int340x_thermal/int3401_thermal.c
> > @@ -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);
> > diff --git a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> > index 57b90005888a..213d4535f2c1 100644
> > --- a/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> > +++ b/drivers/thermal/intel/int340x_thermal/int3402_thermal.c
> > @@ -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,
> >         {}
> >  };
> >
> > diff --git a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> > index ba63796761eb..d246c69d4872 100644
> > --- a/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> > +++ b/drivers/thermal/intel/int340x_thermal/int3403_thermal.c
> > @@ -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);
> > diff --git a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> > index e21fcbccf4ba..d05ca8bc4061 100644
> > --- a/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> > +++ b/drivers/thermal/intel/int340x_thermal/int3406_thermal.c
> > @@ -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
> >
> >
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Posted by Rafael J. Wysocki 3 months, 2 weeks ago
On Thu, Oct 23, 2025 at 4:41 PM Sławomir Rosek <srosek@google.com> wrote:
>
> On Wed, Oct 22, 2025 at 8:46 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Thu, Oct 2, 2025 at 1:34 PM Slawomir Rosek <srosek@google.com> wrote:
> > >
> > > 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 <srosek@google.com>
> >
> > 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,
>
> That's true. It creates platform device for the given ACPI device ID,
> but only if CONFIG_INT340X_THERMAL is enabled.
>
> > but acpi_default_enumeration() would do that too with the
> > caveat that it would also be done for CONFIG_INT340X_THERMAL unset.
>
> 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
>
> > 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.

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.

> >
> > 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.
>
> 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
Posted by Sławomir Rosek 3 months, 2 weeks ago
On Thu, Oct 23, 2025 at 5:11 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Thu, Oct 23, 2025 at 4:41 PM Sławomir Rosek <srosek@google.com> wrote:
> >
> > On Wed, Oct 22, 2025 at 8:46 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > >
> > > On Thu, Oct 2, 2025 at 1:34 PM Slawomir Rosek <srosek@google.com> wrote:
> > > >
> > > > 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 <srosek@google.com>
> > >
> > > 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,
> >
> > That's true. It creates platform device for the given ACPI device ID,
> > but only if CONFIG_INT340X_THERMAL is enabled.
> >
> > > but acpi_default_enumeration() would do that too with the
> > > caveat that it would also be done for CONFIG_INT340X_THERMAL unset.
> >
> > 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
> >
> > > 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.
>
> 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.
>
> > >
> > > 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.
> >
> > 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?
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Posted by Rafael J. Wysocki 3 months, 2 weeks ago
On Thu, Oct 23, 2025 at 6:27 PM Sławomir Rosek <srosek@google.com> wrote:
>
> On Thu, Oct 23, 2025 at 5:11 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Thu, Oct 23, 2025 at 4:41 PM Sławomir Rosek <srosek@google.com> wrote:
> > >
> > > On Wed, Oct 22, 2025 at 8:46 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > > >
> > > > On Thu, Oct 2, 2025 at 1:34 PM Slawomir Rosek <srosek@google.com> wrote:
> > > > >
> > > > > 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 <srosek@google.com>
> > > >
> > > > 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,
> > >
> > > That's true. It creates platform device for the given ACPI device ID,
> > > but only if CONFIG_INT340X_THERMAL is enabled.
> > >
> > > > but acpi_default_enumeration() would do that too with the
> > > > caveat that it would also be done for CONFIG_INT340X_THERMAL unset.
> > >
> > > 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
> > >
> > > > 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.
> >
> > 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.
> >
> > > >
> > > > 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.
> > >
> > > 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?

Yes, please!
Re: [PATCH v3 2/6] ACPI: DPTF: Move INT340X device IDs to header
Posted by Sławomir Rosek 3 months ago
On Thu, Oct 23, 2025 at 6:30 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Thu, Oct 23, 2025 at 6:27 PM Sławomir Rosek <srosek@google.com> wrote:
> >
> > On Thu, Oct 23, 2025 at 5:11 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > >
> > > On Thu, Oct 23, 2025 at 4:41 PM Sławomir Rosek <srosek@google.com> wrote:
> > > >
> > > > On Wed, Oct 22, 2025 at 8:46 PM Rafael J. Wysocki <rafael@kernel.org> wrote:
> > > > >
> > > > > On Thu, Oct 2, 2025 at 1:34 PM Slawomir Rosek <srosek@google.com> wrote:
> > > > > >
> > > > > > 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 <srosek@google.com>
> > > > >
> > > > > 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,
> > > >
> > > > That's true. It creates platform device for the given ACPI device ID,
> > > > but only if CONFIG_INT340X_THERMAL is enabled.
> > > >
> > > > > but acpi_default_enumeration() would do that too with the
> > > > > caveat that it would also be done for CONFIG_INT340X_THERMAL unset.
> > > >
> > > > 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
> > > >
> > > > > 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.
> > >
> > > 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.
> > >
> > > > >
> > > > > 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.
> > > >
> > > > 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?
>
> 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/20251103162516.2606158-1-srosek@google.com/

Thanks!