thermal: allow creating hwmon for thermal zones on OF systems
Subsystems (2)
PATCH 1/1 thermal: allow creating hwmon for thermal zones on OF systems
Current implementation forcibly suppresses creation of hwmon instances for thermal zones defined in device tree data. Let's add a new property, "linux,hwmon" to allow marking certain thermal zones as needing generic hwmon interface.
--- Documentation/devicetree/bindings/thermal/thermal.txt | 4 ++++ drivers/thermal/of-thermal.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/thermal/thermal.txt +4 -0
@@ -174,6 +174,10 @@ Optional property: 2000mW, while on a 10'' tablet is around 4500mW. +- linux,hwmon: A boolean property that instructs Linux thermal core + to create an instance of hwmon device representing + this thermal zone. + Note: The delay properties are bound to the maximum dT/dt (temperature derivative over time) in two situations for a thermal zone: (i) - when passive cooling is activated (polling-delay-passive); and
drivers/thermal/of-thermal.c +5 -2
@@ -891,8 +891,11 @@ int __init of_parse_thermal_zones(void) goto exit_free; } -/* No hwmon because there might be hwmon drivers registering */ - tzp->no_hwmon = true; +/* +* Do not attach hwmon device unless explicitly requested, +* since there might be dedicated hwmon drivers registering. +*/ + tzp->no_hwmon = !of_property_read_bool (child,"linux,hwmon" );if (!of_property_read_u32 (child,"sustainable-power" , &prop)) tzp->sustainable_power = prop;
Signature · 9 lines
2.2.0.rc0.207.ga3a616c -- Dmitry -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 4 lines · Dmitry Torokhov
Current implementation forcibly suppresses creation of hwmon instances for thermal zones defined in device tree data. Let's add a new property, "linux,hwmon" to allow marking certain thermal zones as needing generic hwmon interface.
What is the decision process for deciding to add this property or not?
Quoted 43 lines
Signed-off-by Dmitry Torokhov <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 4 ++++ drivers/thermal/of-thermal.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/thermal/thermal.txt +4
-0@@ -174,6 +174,10 @@ Optional property: 2000mW, while on a 10'' tablet is around 4500mW. +- linux,hwmon: A boolean property that instructs Linux thermal core + to create an instance of hwmon device representing + this thermal zone. + Note: The delay properties are bound to the maximum dT/dt (temperature derivative over time) in two situations for a thermal zone: (i) - when passive cooling is activated (polling-delay-passive); anddrivers/thermal/of-thermal.c +5
-3@@ -891,8 +891,11 @@ int __init of_parse_thermal_zones(void) goto exit_free; } -/* No hwmon because there might be hwmon drivers registering */ - tzp->no_hwmon = true; +/* +* Do not attach hwmon device unless explicitly requested, +* since there might be dedicated hwmon drivers registering. +*/ + tzp->no_hwmon = !of_property_read_bool (child,"linux,hwmon" );if (!of_property_read_u32 (child,"sustainable-power" , &prop)) tzp->sustainable_power = prop; --2.2.0.rc0.207.ga3a616c
Quoted 2 lines
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Rob Herring
Quoted 4 lines · Dmitry Torokhov
Current implementation forcibly suppresses creation of hwmon instances for thermal zones defined in device tree data. Let's add a new property, "linux,hwmon" to allow marking certain thermal zones as needing generic hwmon interface.
What is the decision process for deciding to add this property or not?
A platform may have dedicated hwmon device/driver already covering the thermal sensor responsible for this thermal zone, in which case another hwmon instance is not needed. If there isn't such driver then we may want to create standard hwmon instance so that userspace tools can use standard interface to access the readings.
Board code has hooks to support both options, but in case of DT we don't (hence this patch).
Quoted 47 lines
Quoted 47 lines
Signed-off-by Dmitry Torokhov <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 4 ++++ drivers/thermal/of-thermal.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/thermal/thermal.txt +4
-0@@ -174,6 +174,10 @@ Optional property: 2000mW, while on a 10'' tablet is around 4500mW. +- linux,hwmon: A boolean property that instructs Linux thermal core + to create an instance of hwmon device representing + this thermal zone. + Note: The delay properties are bound to the maximum dT/dt (temperature derivative over time) in two situations for a thermal zone: (i) - when passive cooling is activated (polling-delay-passive); anddrivers/thermal/of-thermal.c +5
-3@@ -891,8 +891,11 @@ int __init of_parse_thermal_zones(void) goto exit_free; } -/* No hwmon because there might be hwmon drivers registering */ - tzp->no_hwmon = true; +/* +* Do not attach hwmon device unless explicitly requested, +* since there might be dedicated hwmon drivers registering. +*/ + tzp->no_hwmon = !of_property_read_bool (child,"linux,hwmon" );if (!of_property_read_u32 (child,"sustainable-power" , &prop)) tzp->sustainable_power = prop; --2.2.0.rc0.207.ga3a616c
--
Dmitry
Signature · 1 line
Dmitry
Quoted 8 lines · Dmitry Torokhov
Quoted 7 lines · Rob Herring
Quoted 4 lines · Dmitry Torokhov
Current implementation forcibly suppresses creation of hwmon instances for thermal zones defined in device tree data. Let's add a new property, "linux,hwmon" to allow marking certain thermal zones as needing generic hwmon interface.
Quoted 7 lines
Quoted 1 line
What is the decision process for deciding to add this property or not?
A platform may have dedicated hwmon device/driver already covering the thermal sensor responsible for this thermal zone, in which case another hwmon instance is not needed. If there isn't such driver then we may want to create standard hwmon instance so that userspace tools can use standard interface to access the readings.
This sounds similar to the general problem we have of how to have 2 drivers where one is preferred over another. Say a h/w block has 2 compatible strings (one being a generic string perhaps) and different drivers for each compatible string.
The DT can't really know what drivers the kernel may or may not have, so I don't think the DT is the right place for this. You could have a compatible match list for hardware that doesn't have a driver and you want to use the standard/generic driver. That doesn't really solve the above problem, but does allow you to statically decide. Would something like that work for you?
Quoted 2 lines
Board code has hooks to support both options, but in case of DT we don't (hence this patch).
Yes, but that doesn't mean it gets moved to DT necessarily.
Rob
Quoted 46 lines
Quoted 46 lines
Quoted 46 lines
Signed-off-by Dmitry Torokhov <[email protected]>--- Documentation/devicetree/bindings/thermal/thermal.txt | 4 ++++ drivers/thermal/of-thermal.c | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/thermal/thermal.txt +4
-0@@ -174,6 +174,10 @@ Optional property: 2000mW, while on a 10'' tablet is around 4500mW. +- linux,hwmon: A boolean property that instructs Linux thermal core + to create an instance of hwmon device representing + this thermal zone. + Note: The delay properties are bound to the maximum dT/dt (temperature derivative over time) in two situations for a thermal zone: (i) - when passive cooling is activated (polling-delay-passive); anddrivers/thermal/of-thermal.c +5
-3@@ -891,8 +891,11 @@ int __init of_parse_thermal_zones(void) goto exit_free; } -/* No hwmon because there might be hwmon drivers registering */ - tzp->no_hwmon = true; +/* +* Do not attach hwmon device unless explicitly requested, +* since there might be dedicated hwmon drivers registering. +*/ + tzp->no_hwmon = !of_property_read_bool (child,"linux,hwmon" );if (!of_property_read_u32 (child,"sustainable-power" , &prop)) tzp->sustainable_power = prop; --2.2.0.rc0.207.ga3a616c
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
--
Dmitry--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html