regulator: max8973: add support for junction thermal warning
Subsystems (2)
PATCH 1/1 regulator: max8973: add support for junction thermal warning
The driver MAX8973 supports the driver for Maxim PMIC MAX77621. MAX77621 supports the junction temp warning at 120 degC and 140 degC which is configurable. It generates alert signal when junction temperature crosses these threshold.
MAX77621 does not support the continuous temp monitoring of junction temperature. It just report whether junction temperature crossed the threshold or not.
Add support to
- Configure junction temp warning threshold via DT property to generate alert when it crosses the threshold.
- Add support to interrupt the host from this device when alert occurred.
- read the junction temp via thermal framework.
--- .../bindings/regulator/max8973-regulator.txt | 6 + drivers/regulator/max8973-regulator.c | 144 ++++++++++++++++++++- include/linux/regulator/max8973-regulator.h | 6 + 3 files changed, 154 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/regulator/max8973-regulator.txt +6 -0
@@ -31,6 +31,12 @@ Optional properties: property is available then etr will be enable default. Enhanced transient response (ETR) will affect the configuration of CKADV. +-maxim,junction-temp-warning: Junction temp warning on which device generates + warning interrupts. +-interrupt-flags: Interrupt flags for registering interrupt which can not be + passed via interrupt properties. + +Please note that thermal functionality is only supported on MAX77621. Example:
drivers/regulator/max8973-regulator.c +142 -2
225 lines not on this page · raw message
include/linux/regulator/max8973-regulator.h +6 -0
@@ -54,6 +54,10 @@* @reg_init_data: The regulator init data. * @control_flags: Control flags which are ORed value of above flags to * configure device. +* @irq_flags: Interrupt flag for registering interrupt like if it is SHARED +* or not. +* @junction_temp_warning: Junction temp in Millicelcius on which warning need +* to be set. * @enable_ext_control: Enable the voltage enable/disable through external * control signal from EN input pin. If it is false then * voltage output will be enabled/disabled through EN bit of
@@ -67,6 +71,8 @@struct max8973_regulator_platform_data {struct regulator_init_data *reg_init_data;unsigned long control_flags; +unsigned long irq_flags; +int junction_temp_warning;bool enable_ext_control;int enable_gpio;int dvs_gpio;
Signature · 1 line
2.1.4
Mark Brown
maintainerDocumentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 35
Quoted 3 lines · Laxman Dewangan
Enhanced transient response (ETR) will affect the configuration of CKADV.
+-maxim,junction-temp-warning: Junction temp warning on which device generatesDocumentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ warning interrupts.
This needs to specify what the values are - it looks like it's raw register values but I'd have expected from this that it'd be an actual temperature.
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 37
Quoted 2 lines
+-interrupt-flags: Interrupt flags for registering interrupt which can not be
Documentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ passed via interrupt properties.
Why is this being specified and what are the values? Most devices don't have this...
Quoted 10 lines · Mark Brown
* PGP Signed by an unknown key
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 35
Quoted 3 lines · Laxman Dewangan
Enhanced transient response (ETR) will affect the configuration of CKADV.
+-maxim,junction-temp-warning: Junction temp warning on which device generatesDocumentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ warning interrupts.This needs to specify what the values are - it looks like it's raw register values but I'd have expected from this that it'd be an actual temperature.
I tried to roundoff to the next higher threshold when supported value (120 or 140 degC) is not provided in driver. But it is fine to me to specify the possible value setting here and DT binding doc. Will do on next patch.
Quoted 5 lines
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 37
Quoted 2 lines
+-interrupt-flags: Interrupt flags for registering interrupt which can not be
Documentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ passed via interrupt properties.Why is this being specified and what are the values? Most devices don't have this...
I have two different design with this device:
In both design, I have main PMIC like MAX77620 and two MAX77621.
In one of design, interrupt from MAX77620, and alert from both MAX77621 shorted and going to Arm GIC controller. On this case, I need to register the interrupt as SHARED interrupt. This property can not be passed via "interrupt" properties from DT. That's why this flag is added to support this.
On other design, interrupt from all devices are going to different pins, MAX77620 to ARM GIC and MAX77621 to different gpio pins. On this case, interrupt are not SHARED.
Now, by default, if I register the interrupt as SHARED in driver then it failed on second design as GPIO does not offer to register as SHARED interrupt.
To support both design, I have added flag properties and passed from DT.
--
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
Mark Brown
maintainerQuoted 12 lines · Laxman Dewangan
Quoted 10 lines · Mark Brown
* PGP Signed by an unknown key
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 35
Quoted 3 lines · Laxman Dewangan
Enhanced transient response (ETR) will affect the configuration of CKADV.
+-maxim,junction-temp-warning: Junction temp warning on which device generatesDocumentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ warning interrupts.This needs to specify what the values are - it looks like it's raw register values but I'd have expected from this that it'd be an actual temperature.
Quoted 3 lines
I tried to roundoff to the next higher threshold when supported value (120 or 140 degC) is not provided in driver. But it is fine to me to specify the possible value setting here and DT binding doc. Will do on next patch.
I don't really mind which you use so long as the documentation is clear.
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 37
Quoted 2 lines
+-interrupt-flags: Interrupt flags for registering interrupt which can not be
Documentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ passed via interrupt properties.Why is this being specified and what are the values? Most devices don't have this...
Quoted 8 lines
I have two different design with this device:
In both design, I have main PMIC like MAX77620 and two MAX77621.In one of design, interrupt from MAX77620, and alert from both MAX77621 shorted and going to Arm GIC controller. On this case, I need to register the interrupt as SHARED interrupt. This property can not be passed via "interrupt" properties from DT.
That's why this flag is added to support this.
If the driver supports shared interrupts it should just register as a shared interrupt all the time, there is nothing about shared interrupts which requires that the pin actually be shared.
Quoted 3 lines
Now, by default, if I register the interrupt as SHARED in driver then it failed on second design as GPIO does not offer to register as SHARED interrupt.
What makes you say that this would fail?
Quoted 8 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 5 lines
In one of design, interrupt from MAX77620, and alert from both MAX77621 shorted and going to Arm GIC controller. On this case, I need to register the interrupt as SHARED interrupt. This property can not be passed via "interrupt" properties from DT.
That's why this flag is added to support this.
Quoted 8 lines
If the driver supports shared interrupts it should just register as a shared interrupt all the time, there is nothing about shared interrupts which requires that the pin actually be shared.
Quoted 3 lines
Now, by default, if I register the interrupt as SHARED in driver then it failed on second design as GPIO does not offer to register as SHARED interrupt.
What makes you say that this would fail?
The failure was due to the mismatch flags when registering interrupts. I used flag as ONESHOT, TRIGGER Type and SHARED.
I experimented as make the interrupt flag as SHARED all places (and ONESHOT always) so that all interrupt flag same for all registration on both design. This way it works fine. It success on GPIO based flag also. Now I am passing SHARED | ONESHOT on both driver interrupt registration.
I will drop the interrupt flag option from DT on next patch.
Thanks,
Laxman
--
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 11 lines · Rob Herring
Quoted 10 lines · Mark Brown
Quoted 9 lines · Laxman Dewangan
Quoted 8 lines · Mark Brown
* PGP Signed by an unknown key
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 35
Quoted 3 lines · Laxman Dewangan
Enhanced transient response (ETR) will affect the configuration of CKADV.
+-maxim,junction-temp-warning: Junction temp warning on which device generatesDocumentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ warning interrupts.This needs to specify what the values are - it looks like it's raw register values but I'd have expected from this that it'd be an actual temperature.
Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
I tried to roundoff to the next higher threshold when supported value (120 or 140 degC) is not provided in driver. But it is fine to me to specify the possible value setting here and DT binding doc. Will do on next patch.
I don't really mind which you use so long as the documentation is clear.
I prefer that degrees are used rather than register values.
From DT/platform, any values can be passed. Driver will round off to next higher side. The document details will only provide what is supported by the PMIC device. E.g. It can pass to ,<=120C and driver will set nearest threshold which is 120C. If it is >120C then it will set to 140C.
Rob Herring
maintainerQuoted 13 lines · Mark Brown
Quoted 11 lines · Laxman Dewangan
Quoted 10 lines · Mark Brown
* PGP Signed by an unknown key
Documentation/devicetree/bindings/regulator/max8973-regulator.txt Optional properties: · line 35
Quoted 3 lines · Laxman Dewangan
Enhanced transient response (ETR) will affect the configuration of CKADV.
+-maxim,junction-temp-warning: Junction temp warning on which device generatesDocumentation/devicetree/bindings/regulator/max8973-regulator.txt +1
-0+ warning interrupts.This needs to specify what the values are - it looks like it's raw register values but I'd have expected from this that it'd be an actual temperature.
Quoted 5 lines
Quoted 3 lines
I tried to roundoff to the next higher threshold when supported value (120 or 140 degC) is not provided in driver. But it is fine to me to specify the possible value setting here and DT binding doc. Will do on next patch.
I don't really mind which you use so long as the documentation is clear.
I prefer that degrees are used rather than register values.
Rob
Mark Brown
maintainerQuoted 9 lines · Rob Herring
Quoted 5 lines · Mark Brown
Quoted 3 lines
I tried to roundoff to the next higher threshold when supported value (120 or 140 degC) is not provided in driver. But it is fine to me to specify the possible value setting here and DT binding doc. Will do on next patch.
I don't really mind which you use so long as the documentation is clear.
I prefer that degrees are used rather than register values.
The downside of that is that it does mean more validation code.