public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* Regression after recent changes to drivers/thermal/thermal_of.c
@ 2022-10-25 21:13 Linus Walleij
  2022-10-25 21:22 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Linus Walleij @ 2022-10-25 21:13 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano, Rob Herring; +Cc: Linux PM list

Hi Folks,

I have this in my dmesg in v6.1-rc1:

[    3.879229] ab8500-fg ab8500-fg.0: line impedance: 36000 uOhm
[    3.892793] power_supply ab8500_usb: Samsung SDI EB-L1M7FLU battery 1500 mAh
[    3.901663] thermal_sys: Failed to find 'trips' node
[    3.906635] thermal_sys: Failed to find trip points for thermistor id=0
[    3.913427] ntc-thermistor thermistor: unable to register as hwmon device.
[    3.920350] ntc-thermistor: probe of thermistor failed with error -22

The device tree looks like this
(arch/arm/boot/dts/ste-ux500-samsung-golden.dts):

        thermal-zones {
                battery-thermal {
                        /* This zone will be polled by the battery
temperature code */
                        polling-delay = <0>;
                        polling-delay-passive = <0>;
                        thermal-sensors = <&bat_therm>;
                };
        };

This is a thermal zone without trip points, which it seems like the new
code does not allow, also the bindings were patched to not allow this,
in commit 8c596324232d22e19f8df59ba03410b9b5b0f3d7
"dt-bindings: thermal: Fix missing required property"
but this broke my systems. The requirement to have trip points also
broke my device trees.

The reason why I have this is that the thermal zone is not managed
by the OF thermal core, but by the battery charging algorithm which
just retrieves the thermal zone and use it to read the temperature, see
commit 2b0e7ac0841b3906aeecf432567b02af683a596c
"power: supply: ab8500: Integrate thermal zone".

The code is using
thermal_zone_get_zone_by_name()
thermal_zone_get_temp()
and applying its own policy on the thermal zone in order to not
dulicate code.

I understand from the code and changes to the bindings that the
authors assume that no zones without trips exist but... well they
exist.

I understand that the bindings always said that trips are required
but ... thermal zones without trip points make a bit of sense.
It's just a zone without a policy. It can be observed even if it can't
be acted on.

How do you want to solve this? Can we make trips non-compulsory
again or shall I add dummy trip points to the device trees?

This:

diff --git a/arch/arm/boot/dts/ste-ux500-samsung-golden.dts
b/arch/arm/boot/dts/ste-ux500-samsung-golden.dts
index b0dce91aff4b..d00e9e6ebbf7 100644
--- a/arch/arm/boot/dts/ste-ux500-samsung-golden.dts
+++ b/arch/arm/boot/dts/ste-ux500-samsung-golden.dts
@@ -35,6 +35,15 @@ battery-thermal {
                        polling-delay = <0>;
                        polling-delay-passive = <0>;
                        thermal-sensors = <&bat_therm>;
+
+                       trips {
+                               /* Unused trip point to please the framework */
+                               dummy {
+                                       temperature = <700000>;
+                                       hysteresis = <2000>;
+                                       type = "passive";
+                               };
+                       };
                };
        };


Makes the thermal zone probe again. I can't see if that really solves
it because there are other possibly unrelated bugs.

There are some other users of thermal_zone_get_temp() and they
may be broken too, I haven't' looked close.

Yours,
Linus Walleij

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

end of thread, other threads:[~2022-11-09 15:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-25 21:13 Regression after recent changes to drivers/thermal/thermal_of.c Linus Walleij
2022-10-25 21:22 ` Linus Walleij
2022-10-26  9:29 ` Regression after recent changes to drivers/thermal/thermal_of.c #forregzbot Thorsten Leemhuis
2022-11-09 15:55   ` Thorsten Leemhuis
2022-10-26 15:47 ` Regression after recent changes to drivers/thermal/thermal_of.c Rob Herring
2022-10-26 17:06   ` Rafael J. Wysocki
2022-10-26 21:40     ` Daniel Lezcano
2022-10-28  8:04       ` Linus Walleij
2022-10-28  9:31         ` Daniel Lezcano
2022-10-28  9:42           ` Linus Walleij
2022-10-28 12:26         ` Rob Herring
2022-11-01  8:52   ` Cristian Marussi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox