devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Add thermal management support for STi platform
@ 2024-06-25 21:32 Raphael Gallais-Pou
  2024-06-25 21:32 ` [PATCH v2 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Raphael Gallais-Pou @ 2024-06-25 21:32 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Maxime Coquelin, Alexandre Torgue, Patrice Chotard, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, linux-kernel, linux-stm32, linux-arm-kernel, devicetree

This patch series enhances the st_thermal driver in order to enable
support for thermal zones. The changes include:

1. Replace deprecated PM runtime macros with their updated counterparts.
2. Implementing devm_* based thermal of zone functions within the driver.
3. Updating the stih418 device-tree.

The device-tree patch depends on an earlier patch sent to the mailing
list [1].

As it is currently implemented, an alert threshold of 85°C is set to
trigger the CPU throttling, and when the temperature exceeds the
critical threshold of 95°C, the system shuts down. There is for now no
active cooling device on the platform, which explains the use of the
cpufreq framework.

[1] https://lore.kernel.org/lkml/20240320-thermal-v3-2-700296694c4a@gmail.com

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
Changes in v2:
- Add Patrice's R-b
- Edit patch [2/3] to remove unused struct
- Link to v1: https://lore.kernel.org/r/20240518-thermal-v1-0-7dfca3ed454b@gmail.com

---
Raphael Gallais-Pou (3):
      thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
      thermal: sti: depend on THERMAL_OF subsystem
      ARM: dts: sti: add thermal-zones support on stih418

 arch/arm/boot/dts/st/stih407-family.dtsi |  6 +++--
 arch/arm/boot/dts/st/stih418.dtsi        | 41 +++++++++++++++++++++++++++++---
 drivers/thermal/st/Kconfig               |  1 +
 drivers/thermal/st/st_thermal.c          | 29 +++++++++-------------
 drivers/thermal/st/st_thermal_memmap.c   |  2 +-
 drivers/thermal/st/stm_thermal.c         |  8 +++----
 6 files changed, 58 insertions(+), 29 deletions(-)
---
base-commit: 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
change-id: 20240518-thermal-8f625428acf9

Best regards,
-- 
Raphael Gallais-Pou <rgallaispou@gmail.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
  2024-06-25 21:32 [PATCH v2 0/3] Add thermal management support for STi platform Raphael Gallais-Pou
@ 2024-06-25 21:32 ` Raphael Gallais-Pou
  2024-06-25 21:32 ` [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem Raphael Gallais-Pou
  2024-06-25 21:32 ` [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418 Raphael Gallais-Pou
  2 siblings, 0 replies; 7+ messages in thread
From: Raphael Gallais-Pou @ 2024-06-25 21:32 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Maxime Coquelin, Alexandre Torgue, Patrice Chotard, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, linux-kernel, linux-stm32, linux-arm-kernel, devicetree

Letting the compiler remove these functions when the kernel is built
without CONFIG_PM_SLEEP support is simpler and less error prone than the
use of #ifdef based kernel configuration guards.

Remove those guards on every ST thermal related drivers.

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 drivers/thermal/st/st_thermal.c        | 4 +---
 drivers/thermal/st/st_thermal_memmap.c | 2 +-
 drivers/thermal/st/stm_thermal.c       | 8 +++-----
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
index 2a105409864e..5f33543a3a54 100644
--- a/drivers/thermal/st/st_thermal.c
+++ b/drivers/thermal/st/st_thermal.c
@@ -236,7 +236,6 @@ void st_thermal_unregister(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(st_thermal_unregister);
 
-#ifdef CONFIG_PM_SLEEP
 static int st_thermal_suspend(struct device *dev)
 {
 	struct st_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -265,9 +264,8 @@ static int st_thermal_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
-SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
+DEFINE_SIMPLE_DEV_PM_OPS(st_thermal_pm_ops, st_thermal_suspend, st_thermal_resume);
 EXPORT_SYMBOL_GPL(st_thermal_pm_ops);
 
 MODULE_AUTHOR("STMicroelectronics (R&D) Limited <ajitpal.singh@st.com>");
diff --git a/drivers/thermal/st/st_thermal_memmap.c b/drivers/thermal/st/st_thermal_memmap.c
index 29c2269b0fb3..28b380013956 100644
--- a/drivers/thermal/st/st_thermal_memmap.c
+++ b/drivers/thermal/st/st_thermal_memmap.c
@@ -180,7 +180,7 @@ static void st_mmap_remove(struct platform_device *pdev)
 static struct platform_driver st_mmap_thermal_driver = {
 	.driver = {
 		.name	= "st_thermal_mmap",
-		.pm     = &st_thermal_pm_ops,
+		.pm     = pm_sleep_ptr(&st_thermal_pm_ops),
 		.of_match_table = st_mmap_thermal_of_match,
 	},
 	.probe		= st_mmap_probe,
diff --git a/drivers/thermal/st/stm_thermal.c b/drivers/thermal/st/stm_thermal.c
index 34785b9276fc..ffd988600ed6 100644
--- a/drivers/thermal/st/stm_thermal.c
+++ b/drivers/thermal/st/stm_thermal.c
@@ -440,7 +440,6 @@ static int stm_thermal_prepare(struct stm_thermal_sensor *sensor)
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int stm_thermal_suspend(struct device *dev)
 {
 	struct stm_thermal_sensor *sensor = dev_get_drvdata(dev);
@@ -466,10 +465,9 @@ static int stm_thermal_resume(struct device *dev)
 
 	return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
-			 stm_thermal_suspend, stm_thermal_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stm_thermal_pm_ops,
+				stm_thermal_suspend, stm_thermal_resume);
 
 static const struct thermal_zone_device_ops stm_tz_ops = {
 	.get_temp	= stm_thermal_get_temp,
@@ -580,7 +578,7 @@ static void stm_thermal_remove(struct platform_device *pdev)
 static struct platform_driver stm_thermal_driver = {
 	.driver = {
 		.name	= "stm_thermal",
-		.pm     = &stm_thermal_pm_ops,
+		.pm     = pm_sleep_ptr(&stm_thermal_pm_ops),
 		.of_match_table = stm_thermal_of_match,
 	},
 	.probe		= stm_thermal_probe,

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem
  2024-06-25 21:32 [PATCH v2 0/3] Add thermal management support for STi platform Raphael Gallais-Pou
  2024-06-25 21:32 ` [PATCH v2 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
@ 2024-06-25 21:32 ` Raphael Gallais-Pou
  2024-06-26 21:58   ` kernel test robot
  2024-06-26 23:06   ` kernel test robot
  2024-06-25 21:32 ` [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418 Raphael Gallais-Pou
  2 siblings, 2 replies; 7+ messages in thread
From: Raphael Gallais-Pou @ 2024-06-25 21:32 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Maxime Coquelin, Alexandre Torgue, Patrice Chotard, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, linux-kernel, linux-stm32, linux-arm-kernel, devicetree

Switch to thermal_of_zone to handle thermal-zones. Replace
thermal_zone_device_register() by devm_thermal_of_zone_register() and
remove ops st_thermal_get_trip_type, st_thermal_get_trip_temp.

Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
Changes in v2:
- Remove unused struct thermal_trip trip
---
 drivers/thermal/st/Kconfig      |  1 +
 drivers/thermal/st/st_thermal.c | 25 ++++++++++---------------
 2 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/thermal/st/Kconfig b/drivers/thermal/st/Kconfig
index ecbdf4ef00f4..2d08147876ee 100644
--- a/drivers/thermal/st/Kconfig
+++ b/drivers/thermal/st/Kconfig
@@ -5,6 +5,7 @@
 
 config ST_THERMAL
 	tristate "Thermal sensors on STMicroelectronics STi series of SoCs"
+	depends on THERMAL_OF
 	help
 	  Support for thermal sensors on STMicroelectronics STi series of SoCs.
 
diff --git a/drivers/thermal/st/st_thermal.c b/drivers/thermal/st/st_thermal.c
index 5f33543a3a54..1f2ba5c88cbc 100644
--- a/drivers/thermal/st/st_thermal.c
+++ b/drivers/thermal/st/st_thermal.c
@@ -12,6 +12,7 @@
 #include <linux/of_device.h>
 
 #include "st_thermal.h"
+#include "../thermal_hwmon.h"
 
 /* The Thermal Framework expects millidegrees */
 #define mcelsius(temp)			((temp) * 1000)
@@ -135,8 +136,6 @@ static struct thermal_zone_device_ops st_tz_ops = {
 	.get_temp	= st_thermal_get_temp,
 };
 
-static struct thermal_trip trip;
-
 int st_thermal_register(struct platform_device *pdev,
 			const struct of_device_id *st_thermal_of_match)
 {
@@ -199,27 +198,22 @@ int st_thermal_register(struct platform_device *pdev,
 
 	polling_delay = sensor->ops->register_enable_irq ? 0 : 1000;
 
-	trip.temperature = sensor->cdata->crit_temp;
-	trip.type = THERMAL_TRIP_CRITICAL;
-
 	sensor->thermal_dev =
-		thermal_zone_device_register_with_trips(dev_name(dev), &trip, 1, sensor,
-							&st_tz_ops, NULL, 0, polling_delay);
+		devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops);
 	if (IS_ERR(sensor->thermal_dev)) {
-		dev_err(dev, "failed to register thermal zone device\n");
+		dev_err(dev, "failed to register thermal of zone\n");
 		ret = PTR_ERR(sensor->thermal_dev);
 		goto sensor_off;
 	}
-	ret = thermal_zone_device_enable(sensor->thermal_dev);
-	if (ret)
-		goto tzd_unregister;
 
 	platform_set_drvdata(pdev, sensor);
 
-	return 0;
+	/*
+	 * devm_thermal_of_zone_register() doesn't enable hwmon by default
+	 * Enable it here
+	 */
+	return devm_thermal_add_hwmon_sysfs(dev, sensor->thermal_dev);
 
-tzd_unregister:
-	thermal_zone_device_unregister(sensor->thermal_dev);
 sensor_off:
 	st_thermal_sensor_off(sensor);
 
@@ -232,7 +226,8 @@ void st_thermal_unregister(struct platform_device *pdev)
 	struct st_thermal_sensor *sensor = platform_get_drvdata(pdev);
 
 	st_thermal_sensor_off(sensor);
-	thermal_zone_device_unregister(sensor->thermal_dev);
+	thermal_remove_hwmon_sysfs(sensor->thermal_dev);
+	devm_thermal_of_zone_unregister(sensor->dev, sensor->thermal_dev);
 }
 EXPORT_SYMBOL_GPL(st_thermal_unregister);
 

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418
  2024-06-25 21:32 [PATCH v2 0/3] Add thermal management support for STi platform Raphael Gallais-Pou
  2024-06-25 21:32 ` [PATCH v2 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
  2024-06-25 21:32 ` [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem Raphael Gallais-Pou
@ 2024-06-25 21:32 ` Raphael Gallais-Pou
  2024-06-27  8:23   ` kernel test robot
  2 siblings, 1 reply; 7+ messages in thread
From: Raphael Gallais-Pou @ 2024-06-25 21:32 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Zhang Rui, Lukasz Luba,
	Maxime Coquelin, Alexandre Torgue, Patrice Chotard, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, linux-kernel, linux-stm32, linux-arm-kernel, devicetree

Add a 'thermal-zones' node for stih418.

A thermal-zone needs three components:
  - thermal sensors, described in an earlier commit[1]
  - cooling devices, specified for each CPU
  - a thermal zone, describing the overall behavior.

The thermal zone needs references to both CPUs and thermal sensors,
which phandle are also added. The thermal management will then be
achieved on CPUs using the cpufreq framework.

[1] https://lore.kernel.org/lkml/20240320-thermal-v3-2-700296694c4a@gmail.com/

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com>
---
 arch/arm/boot/dts/st/stih407-family.dtsi |  6 +++--
 arch/arm/boot/dts/st/stih418.dtsi        | 41 +++++++++++++++++++++++++++++---
 2 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/st/stih407-family.dtsi b/arch/arm/boot/dts/st/stih407-family.dtsi
index 29302e74aa1d..35a55aef7f4b 100644
--- a/arch/arm/boot/dts/st/stih407-family.dtsi
+++ b/arch/arm/boot/dts/st/stih407-family.dtsi
@@ -33,7 +33,7 @@ delta_reserved: rproc@44000000 {
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		cpu@0 {
+		cpu0: cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <0>;
@@ -52,8 +52,9 @@ cpu@0 {
 			clock-latency = <100000>;
 			cpu0-supply = <&pwm_regulator>;
 			st,syscfg = <&syscfg_core 0x8e0>;
+			#cooling-cells = <2>;
 		};
-		cpu@1 {
+		cpu1: cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <1>;
@@ -66,6 +67,7 @@ cpu@1 {
 					    1200000 0
 					    800000  0
 					    500000  0>;
+			#cooling-cells = <2>;
 		};
 	};
 
diff --git a/arch/arm/boot/dts/st/stih418.dtsi b/arch/arm/boot/dts/st/stih418.dtsi
index b35b9b7a7ccc..6622ffa8ecfa 100644
--- a/arch/arm/boot/dts/st/stih418.dtsi
+++ b/arch/arm/boot/dts/st/stih418.dtsi
@@ -6,23 +6,26 @@
 #include "stih418-clock.dtsi"
 #include "stih407-family.dtsi"
 #include "stih410-pinctrl.dtsi"
+#include <dt-bindings/thermal/thermal.h>
 / {
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		cpu@2 {
+		cpu2: cpu@2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <2>;
 			/* u-boot puts hpen in SBC dmem at 0xa4 offset */
 			cpu-release-addr = <0x94100A4>;
+			#cooling-cells = <2>;
 		};
-		cpu@3 {
+		cpu3: cpu@3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a9";
 			reg = <3>;
 			/* u-boot puts hpen in SBC dmem at 0xa4 offset */
 			cpu-release-addr = <0x94100A4>;
+			#cooling-cells = <2>;
 		};
 	};
 
@@ -44,6 +47,38 @@ usb2_picophy2: phy3 {
 		reset-names = "global", "port";
 	};
 
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive = <250>;  /* 250ms */
+			polling-delay = <1000>;         /* 1000ms */
+
+			thermal-sensors = <&thermal>;
+
+			trips {
+				cpu_crit: cpu-crit {
+					temperature = <95000>;  /* 95C */
+					hysteresis = <2000>;
+					type = "critical";
+				};
+				cpu_alert: cpu-alert {
+					temperature = <85000>;  /* 85C */
+					hysteresis = <2000>;
+					type = "passive";
+				};
+			};
+
+			cooling-maps {
+				map {
+					trip = <&cpu_alert>;
+					cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
+							 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+				};
+			};
+		};
+	};
+
 	soc {
 		rng11: rng@8a8a000 {
 			status = "disabled";
@@ -107,7 +142,7 @@ mmc0: sdhci@9060000 {
 			assigned-clock-rates = <200000000>;
 		};
 
-		thermal@91a0000 {
+		thermal: thermal@91a0000 {
 			compatible = "st,stih407-thermal";
 			reg = <0x91a0000 0x28>;
 			clock-names = "thermal";

-- 
2.45.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem
  2024-06-25 21:32 ` [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem Raphael Gallais-Pou
@ 2024-06-26 21:58   ` kernel test robot
  2024-06-26 23:06   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2024-06-26 21:58 UTC (permalink / raw)
  To: Raphael Gallais-Pou, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Maxime Coquelin, Alexandre Torgue, Patrice Chotard,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: oe-kbuild-all, linux-pm, linux-kernel, linux-stm32,
	linux-arm-kernel, devicetree

Hi Raphael,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/thermal-st-switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20240626-090203
base:   0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
patch link:    https://lore.kernel.org/r/20240625-thermal-v2-2-bf8354ed51ee%40gmail.com
patch subject: [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20240627/202406270530.kN5wIswi-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240627/202406270530.kN5wIswi-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406270530.kN5wIswi-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/thermal/st/st_thermal.c: In function 'st_thermal_register':
>> drivers/thermal/st/st_thermal.c:147:13: warning: variable 'polling_delay' set but not used [-Wunused-but-set-variable]
     147 |         int polling_delay;
         |             ^~~~~~~~~~~~~


vim +/polling_delay +147 drivers/thermal/st/st_thermal.c

60aef7ce455653 Lee Jones           2014-06-05  138  
60aef7ce455653 Lee Jones           2014-06-05  139  int st_thermal_register(struct platform_device *pdev,
60aef7ce455653 Lee Jones           2014-06-05  140  			const struct of_device_id *st_thermal_of_match)
60aef7ce455653 Lee Jones           2014-06-05  141  {
60aef7ce455653 Lee Jones           2014-06-05  142  	struct st_thermal_sensor *sensor;
60aef7ce455653 Lee Jones           2014-06-05  143  	struct device *dev = &pdev->dev;
60aef7ce455653 Lee Jones           2014-06-05  144  	struct device_node *np = dev->of_node;
60aef7ce455653 Lee Jones           2014-06-05  145  	const struct of_device_id *match;
60aef7ce455653 Lee Jones           2014-06-05  146  
60aef7ce455653 Lee Jones           2014-06-05 @147  	int polling_delay;
60aef7ce455653 Lee Jones           2014-06-05  148  	int ret;
60aef7ce455653 Lee Jones           2014-06-05  149  
60aef7ce455653 Lee Jones           2014-06-05  150  	if (!np) {
60aef7ce455653 Lee Jones           2014-06-05  151  		dev_err(dev, "device tree node not found\n");
60aef7ce455653 Lee Jones           2014-06-05  152  		return -EINVAL;
60aef7ce455653 Lee Jones           2014-06-05  153  	}
60aef7ce455653 Lee Jones           2014-06-05  154  
60aef7ce455653 Lee Jones           2014-06-05  155  	sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
60aef7ce455653 Lee Jones           2014-06-05  156  	if (!sensor)
60aef7ce455653 Lee Jones           2014-06-05  157  		return -ENOMEM;
60aef7ce455653 Lee Jones           2014-06-05  158  
60aef7ce455653 Lee Jones           2014-06-05  159  	sensor->dev = dev;
60aef7ce455653 Lee Jones           2014-06-05  160  
60aef7ce455653 Lee Jones           2014-06-05  161  	match = of_match_device(st_thermal_of_match, dev);
60aef7ce455653 Lee Jones           2014-06-05  162  	if (!(match && match->data))
60aef7ce455653 Lee Jones           2014-06-05  163  		return -EINVAL;
60aef7ce455653 Lee Jones           2014-06-05  164  
60aef7ce455653 Lee Jones           2014-06-05  165  	sensor->cdata = match->data;
60aef7ce455653 Lee Jones           2014-06-05  166  	if (!sensor->cdata->ops)
60aef7ce455653 Lee Jones           2014-06-05  167  		return -EINVAL;
60aef7ce455653 Lee Jones           2014-06-05  168  
60aef7ce455653 Lee Jones           2014-06-05  169  	sensor->ops = sensor->cdata->ops;
60aef7ce455653 Lee Jones           2014-06-05  170  
331a5fc9f2ed28 Nicolas Boichat     2015-07-08  171  	ret = (sensor->ops->regmap_init)(sensor);
60aef7ce455653 Lee Jones           2014-06-05  172  	if (ret)
60aef7ce455653 Lee Jones           2014-06-05  173  		return ret;
60aef7ce455653 Lee Jones           2014-06-05  174  
60aef7ce455653 Lee Jones           2014-06-05  175  	ret = st_thermal_alloc_regfields(sensor);
60aef7ce455653 Lee Jones           2014-06-05  176  	if (ret)
60aef7ce455653 Lee Jones           2014-06-05  177  		return ret;
60aef7ce455653 Lee Jones           2014-06-05  178  
60aef7ce455653 Lee Jones           2014-06-05  179  	sensor->clk = devm_clk_get(dev, "thermal");
60aef7ce455653 Lee Jones           2014-06-05  180  	if (IS_ERR(sensor->clk)) {
60aef7ce455653 Lee Jones           2014-06-05  181  		dev_err(dev, "failed to fetch clock\n");
60aef7ce455653 Lee Jones           2014-06-05  182  		return PTR_ERR(sensor->clk);
60aef7ce455653 Lee Jones           2014-06-05  183  	}
60aef7ce455653 Lee Jones           2014-06-05  184  
60aef7ce455653 Lee Jones           2014-06-05  185  	if (sensor->ops->register_enable_irq) {
60aef7ce455653 Lee Jones           2014-06-05  186  		ret = sensor->ops->register_enable_irq(sensor);
60aef7ce455653 Lee Jones           2014-06-05  187  		if (ret)
60aef7ce455653 Lee Jones           2014-06-05  188  			return ret;
60aef7ce455653 Lee Jones           2014-06-05  189  	}
60aef7ce455653 Lee Jones           2014-06-05  190  
60aef7ce455653 Lee Jones           2014-06-05  191  	ret = st_thermal_sensor_on(sensor);
60aef7ce455653 Lee Jones           2014-06-05  192  	if (ret)
60aef7ce455653 Lee Jones           2014-06-05  193  		return ret;
60aef7ce455653 Lee Jones           2014-06-05  194  
60aef7ce455653 Lee Jones           2014-06-05  195  	ret = st_thermal_calibration(sensor);
60aef7ce455653 Lee Jones           2014-06-05  196  	if (ret)
60aef7ce455653 Lee Jones           2014-06-05  197  		goto sensor_off;
60aef7ce455653 Lee Jones           2014-06-05  198  
60aef7ce455653 Lee Jones           2014-06-05  199  	polling_delay = sensor->ops->register_enable_irq ? 0 : 1000;
60aef7ce455653 Lee Jones           2014-06-05  200  
60aef7ce455653 Lee Jones           2014-06-05  201  	sensor->thermal_dev =
9819ef601045bf Raphael Gallais-Pou 2024-06-25  202  		devm_thermal_of_zone_register(dev, 0, sensor, &st_tz_ops);
60aef7ce455653 Lee Jones           2014-06-05  203  	if (IS_ERR(sensor->thermal_dev)) {
9819ef601045bf Raphael Gallais-Pou 2024-06-25  204  		dev_err(dev, "failed to register thermal of zone\n");
60aef7ce455653 Lee Jones           2014-06-05  205  		ret = PTR_ERR(sensor->thermal_dev);
60aef7ce455653 Lee Jones           2014-06-05  206  		goto sensor_off;
60aef7ce455653 Lee Jones           2014-06-05  207  	}
60aef7ce455653 Lee Jones           2014-06-05  208  
60aef7ce455653 Lee Jones           2014-06-05  209  	platform_set_drvdata(pdev, sensor);
60aef7ce455653 Lee Jones           2014-06-05  210  
9819ef601045bf Raphael Gallais-Pou 2024-06-25  211  	/*
9819ef601045bf Raphael Gallais-Pou 2024-06-25  212  	 * devm_thermal_of_zone_register() doesn't enable hwmon by default
9819ef601045bf Raphael Gallais-Pou 2024-06-25  213  	 * Enable it here
9819ef601045bf Raphael Gallais-Pou 2024-06-25  214  	 */
9819ef601045bf Raphael Gallais-Pou 2024-06-25  215  	return devm_thermal_add_hwmon_sysfs(dev, sensor->thermal_dev);
60aef7ce455653 Lee Jones           2014-06-05  216  
60aef7ce455653 Lee Jones           2014-06-05  217  sensor_off:
60aef7ce455653 Lee Jones           2014-06-05  218  	st_thermal_sensor_off(sensor);
60aef7ce455653 Lee Jones           2014-06-05  219  
60aef7ce455653 Lee Jones           2014-06-05  220  	return ret;
60aef7ce455653 Lee Jones           2014-06-05  221  }
60aef7ce455653 Lee Jones           2014-06-05  222  EXPORT_SYMBOL_GPL(st_thermal_register);
60aef7ce455653 Lee Jones           2014-06-05  223  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem
  2024-06-25 21:32 ` [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem Raphael Gallais-Pou
  2024-06-26 21:58   ` kernel test robot
@ 2024-06-26 23:06   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2024-06-26 23:06 UTC (permalink / raw)
  To: Raphael Gallais-Pou, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Maxime Coquelin, Alexandre Torgue, Patrice Chotard,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Paul Gazzillo, Necip Fazil Yildiran, oe-kbuild-all, linux-pm,
	linux-kernel, linux-stm32, linux-arm-kernel, devicetree

Hi Raphael,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/thermal-st-switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20240626-090203
base:   0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
patch link:    https://lore.kernel.org/r/20240625-thermal-v2-2-bf8354ed51ee%40gmail.com
patch subject: [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem
config: arm64-kismet-CONFIG_ST_THERMAL-CONFIG_ST_THERMAL_MEMMAP-0-0 (https://download.01.org/0day-ci/archive/20240627/202406270605.qodaWd4n-lkp@intel.com/config)
reproduce: (https://download.01.org/0day-ci/archive/20240627/202406270605.qodaWd4n-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406270605.qodaWd4n-lkp@intel.com/

kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for ST_THERMAL when selected by ST_THERMAL_MEMMAP
   WARNING: unmet direct dependencies detected for ST_THERMAL
     Depends on [n]: THERMAL [=y] && (ARCH_STI || ARCH_STM32 [=y]) && OF [=y] && THERMAL_OF [=n]
     Selected by [y]:
     - ST_THERMAL_MEMMAP [=y] && THERMAL [=y] && (ARCH_STI || ARCH_STM32 [=y]) && OF [=y]

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418
  2024-06-25 21:32 ` [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418 Raphael Gallais-Pou
@ 2024-06-27  8:23   ` kernel test robot
  0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2024-06-27  8:23 UTC (permalink / raw)
  To: Raphael Gallais-Pou, Rafael J. Wysocki, Daniel Lezcano, Zhang Rui,
	Lukasz Luba, Maxime Coquelin, Alexandre Torgue, Patrice Chotard,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: oe-kbuild-all, linux-pm, linux-kernel, linux-stm32,
	linux-arm-kernel, devicetree

Hi Raphael,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0fc4bfab2cd45f9acb86c4f04b5191e114e901ed]

url:    https://github.com/intel-lab-lkp/linux/commits/Raphael-Gallais-Pou/thermal-st-switch-from-CONFIG_PM_SLEEP-guards-to-pm_sleep_ptr/20240626-090203
base:   0fc4bfab2cd45f9acb86c4f04b5191e114e901ed
patch link:    https://lore.kernel.org/r/20240625-thermal-v2-3-bf8354ed51ee%40gmail.com
patch subject: [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418
config: arm-randconfig-051-20240627 (https://download.01.org/0day-ci/archive/20240627/202406271638.0fz7OuJT-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project ad79a14c9e5ec4a369eed4adf567c22cc029863f)
dtschema version: 2024.6.dev1+g833054f
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240627/202406271638.0fz7OuJT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406271638.0fz7OuJT-lkp@intel.com/

dtcheck warnings: (new ones prefixed by >>)
>> arch/arm/boot/dts/st/stih418.dtsi:51.28-79.5: Warning (thermal_sensors_property): /thermal-zones/cpu-thermal: Missing property '#thermal-sensor-cells' in node /soc/thermal@91a0000 or bad phandle (referred from thermal-sensors[0])
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks: failed to match any schema with compatible: ['st,stih418-clk', 'simple-bus']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a9@92b0000: failed to match any schema with compatible: ['st,clkgen-c32']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a9@92b0000/clockgen-a9-pll: failed to match any schema with compatible: ['st,stih418-clkgen-plla9']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a9@92b0000/clk-m-a9: failed to match any schema with compatible: ['st,stih407-clkgen-a9-mux', 'st,clkgen-mux']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a9@92b0000/clk-m-a9: failed to match any schema with compatible: ['st,stih407-clkgen-a9-mux', 'st,clkgen-mux']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a@90ff000: failed to match any schema with compatible: ['st,clkgen-c32']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a@90ff000/clk-s-a0-pll: failed to match any schema with compatible: ['st,clkgen-pll0-a0']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a@90ff000/clk-s-a0-flexgen: failed to match any schema with compatible: ['st,flexgen', 'st,flexgen-stih410-a0']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-a@90ff000/clk-s-a0-flexgen: failed to match any schema with compatible: ['st,flexgen', 'st,flexgen-stih410-a0']
   arch/arm/boot/dts/st/stih418-b2199.dtb: /clocks/clockgen-c@9103000: failed to match any schema with compatible: ['st,clkgen-c32']
--
>> arch/arm/boot/dts/st/stih418.dtsi:51.28-79.5: Warning (thermal_sensors_property): /thermal-zones/cpu-thermal: Missing property '#thermal-sensor-cells' in node /soc/thermal@91a0000 or bad phandle (referred from thermal-sensors[0])
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks: failed to match any schema with compatible: ['st,stih418-clk', 'simple-bus']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a9@92b0000: failed to match any schema with compatible: ['st,clkgen-c32']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a9@92b0000/clockgen-a9-pll: failed to match any schema with compatible: ['st,stih418-clkgen-plla9']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a9@92b0000/clk-m-a9: failed to match any schema with compatible: ['st,stih407-clkgen-a9-mux', 'st,clkgen-mux']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a9@92b0000/clk-m-a9: failed to match any schema with compatible: ['st,stih407-clkgen-a9-mux', 'st,clkgen-mux']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a@90ff000: failed to match any schema with compatible: ['st,clkgen-c32']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a@90ff000/clk-s-a0-pll: failed to match any schema with compatible: ['st,clkgen-pll0-a0']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a@90ff000/clk-s-a0-flexgen: failed to match any schema with compatible: ['st,flexgen', 'st,flexgen-stih410-a0']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-a@90ff000/clk-s-a0-flexgen: failed to match any schema with compatible: ['st,flexgen', 'st,flexgen-stih410-a0']
   arch/arm/boot/dts/st/stih418-b2264.dtb: /clocks/clockgen-c@9103000: failed to match any schema with compatible: ['st,clkgen-c32']

vim +51 arch/arm/boot/dts/st/stih418.dtsi

  > 51			cpu_thermal: cpu-thermal {

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-06-27  8:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 21:32 [PATCH v2 0/3] Add thermal management support for STi platform Raphael Gallais-Pou
2024-06-25 21:32 ` [PATCH v2 1/3] thermal: st: switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Raphael Gallais-Pou
2024-06-25 21:32 ` [PATCH v2 2/3] thermal: sti: depend on THERMAL_OF subsystem Raphael Gallais-Pou
2024-06-26 21:58   ` kernel test robot
2024-06-26 23:06   ` kernel test robot
2024-06-25 21:32 ` [PATCH v2 3/3] ARM: dts: sti: add thermal-zones support on stih418 Raphael Gallais-Pou
2024-06-27  8:23   ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).