mfd: tps65219: Let a board run past the warm threshold
Subsystems (4)
cover mfd: tps65219: Let a board run past the warm threshold
The TPS65219 has four die temperature sensors, each with a warm and a hot threshold. With a sensor's warm warning unmasked, the PMIC sequences all its outputs down at the warm threshold, 110 to 130 C. With all four masked, it only reports the warning and powers off at the hot threshold, 130 to 150 C. The masks come from NVM, so a board that wants the second behaviour has to set them on every boot.
The BLIIoT ARMxy BL350, an AM6254 industrial controller rated to 85 C ambient, ships a vendor kernel that does this from a devicetree flag. This series adds a binding for it and the driver code, and corrects the MASK_EFFECT macro on the way: it named bits 2:1 of MASK_CONFIG, which are warm masks, instead of bits 6:5. Nothing used it yet.
The property is limited to the TPS65219. I have not checked the MASK_CONFIG layout of the TPS65214 and TPS65215.
This series is build-tested for arm64 with W=1, and dt_binding_check passes. It has not run on a board in this form. On a BL350, the vendor's equivalent code sets the same four bits, and the PMIC reads MASK_CONFIG = 0xef.
Chrispine Tinega (3):
mfd: tps65219: Correct the MASK_EFFECT field of MASK_CONFIG
regulator: dt-bindings: ti,tps65219: Add ti,no-warm-shutdown
mfd: tps65219: Keep running past the warm threshold when asked
.../bindings/regulator/ti,tps65219.yaml | 11 +++++++++++ drivers/mfd/tps65219.c | 15 +++++++++++++++ include/linux/mfd/tps65219.h | 8 ++++++-- 3 files changed, 32 insertions(+), 2 deletions(-)
Signature · 1 line
2.53.0
PATCH 1/3 mfd: tps65219: Correct the MASK_EFFECT field of MASK_CONFIG
MASK_EFFECT is bits 6:5 of MASK_CONFIG (0x25), per table 7-46 of the TPS65219 datasheet (SLVSGA0D). Bits 2:1 are the warm masks of sensors 1 and 2. Nothing uses the macro yet, so nothing has written the wrong bits.
--- include/linux/mfd/tps65219.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mfd/tps65219.h +1 -1
@@ -198,7 +198,7 @@ enum pmic_id {/* MASK Config */ // SENSOR_N_WARM_MASK already defined in Thermal #define TPS65219_REG_MASK_INT_FOR_RV_MASK BIT(4) -#define TPS65219_REG_MASK_EFFECT_MASK GENMASK(2, 1) +#define TPS65219_REG_MASK_EFFECT_MASK GENMASK(6, 5)#define TPS65219_REG_MASK_INT_FOR_PB_MASK BIT(7)/* UnderVoltage - Short to GND - OverCurrent*/ /* LDO3-4: only for TPS65219*/
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 1/3] mfd: tps65219: Correct the MASK_EFFECT field of MASK_CONFIG
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] mfd: tps65219: missing Fixes trailer for TPS65219_REG_MASK_EFFECT_MASK fix --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] mfd: tps65219: missing Fixes trailer for TPS65219_REG_MASK_EFFECT_MASK fix
--
commit bc69d7bd96f2d6a411ff79d868b4352a275dddc8
Author: Chrispine Tinega <[email protected]>
Quoted 7 lines
mfd: tps65219: Correct the
MASK_EFFECTfield ofMASK_CONFIG
MASK_EFFECTis bits 6:5 ofMASK_CONFIG(0x25), per table 7-46 of the TPS65219 datasheet (SLVSGA0D). Bits 2:1 are the warm masks of sensors 1 and 2. Nothing uses the macro yet, so nothing has written the wrong bits.Signed-off-by Chrispine Tinega <[email protected]>
[Severity: Low]
This fixes the TPS65219_REG_MASK_EFFECT_MASK definition. Should this include:
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/3 regulator: dt-bindings: ti,tps65219: Add ti,no-warm-shutdown
In reply to Chrispine TinegaThe TPS65219 has four die temperature sensors, each with a warm and a hot threshold. A sensor whose warm warning is not masked makes the PMIC sequence all its outputs down at the warm threshold, 110 to 130 C. Masked, the warning is only reported, and the PMIC powers off at the hot threshold, 130 to 150 C. Whether a board can run past the warm threshold depends on its thermal design, so the board's devicetree has to say so.
Add ti,no-warm-shutdown for that. It is allowed on the TPS65219 only:
the masks are not described here for the TPS65214 and TPS65215.
--- .../devicetree/bindings/regulator/ti,tps65219.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/regulator/ti,tps65219.yaml +11 -0
@@ -62,6 +62,16 @@ properties: where the board has a button wired to the pin and triggers an interrupt on pressing it. + ti,no-warm-shutdown: + type: boolean + description: | + Keep the PMIC running when one of its die temperature sensors passes + its warm threshold. By default, a sensor whose warm warning is not + masked makes the PMIC sequence all its outputs down at that + threshold. With this property the warning is only reported, and the + PMIC powers off at its hot threshold instead, so the board can run + warmer and the operating system decides how to react to the warning. + regulators: type: object description: |
@@ -111,6 +121,7 @@ allOf: - ti,tps65215 then: properties: + ti,no-warm-shutdown: false regulators: patternProperties: "^ldo[3-4]$": false
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 2/3] regulator: dt-bindings: ti,tps65219: Add ti,no-warm-shutdown
Sashiko has reviewed this patch and found no issues.
Quoted 11 lines
The TPS65219 has four die temperature sensors, each with a warm and a hot threshold. A sensor whose warm warning is not masked makes the PMIC sequence all its outputs down at the warm threshold, 110 to 130 C. Masked, the warning is only reported, and the PMIC powers off at the hot threshold, 130 to 150 C. Whether a board can run past the warm threshold depends on its thermal design, so the board's devicetree has to say so.
Add ti,no-warm-shutdown for that. It is allowed on the TPS65219 only:
the masks are not described here for the TPS65214 and TPS65215.Signed-off-by Chrispine Tinega <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 2/3] regulator: dt-bindings: ti,tps65219: Add ti,no-warm-shutdown
In reply to Chrispine TinegaQuoted 9 lines · Chrispine Tinega
The TPS65219 has four die temperature sensors, each with a warm and a hot threshold. A sensor whose warm warning is not masked makes the PMIC sequence all its outputs down at the warm threshold, 110 to 130 C. Masked, the warning is only reported, and the PMIC powers off at the hot threshold, 130 to 150 C. Whether a board can run past the warm threshold depends on its thermal design, so the board's devicetree has to say so.
Add ti,no-warm-shutdown for that. It is allowed on the TPS65219 only:
the masks are not described here for the TPS65214 and TPS65215.
though we might still want a runtime override for when the user is more cautious.
Re: [PATCH 2/3] regulator: dt-bindings: ti,tps65219: Add ti,no-warm-shutdown
Quoted 4 lines · Mark Brown
Reviewed-by Mark Brown <[email protected]>though we might still want a runtime override for when the user is more cautious.
Thank you for the review.
I agree. Looking at it again, a cautious user also has nothing to act on today. With the warm warning masked, the warm interrupt reaches the regulator driver with no regulator attached, so it only logs "Error IRQ trap warm temperature". Nothing is notified.
I would rather keep this series to the board default and add the override as a follow-up, once there is a user who needs it. I would also change the binding text in v2, so it no longer says the operating system decides how to react. Does that work for you, or would you like the override in this series?
Chrispine
PATCH 3/3 mfd: tps65219: Keep running past the warm threshold when asked
In reply to Chrispine TinegaWhen the devicetree sets ti,no-warm-shutdown on a TPS65219, set the four SENSOR_x_WARM_MASK bits in MASK_CONFIG at probe. The PMIC then reports a warm die instead of powering the board down, and powers off only at its hot threshold.
The masks are loaded from the PMIC's NVM at every power-up, so they are set on every probe.
--- drivers/mfd/tps65219.c | 15 +++++++++++++++ include/linux/mfd/tps65219.h | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/mfd/tps65219.c +15 -0
@@ -507,6 +507,21 @@ static int tps65219_probe(struct i2c_client *client) } } +/* +* The warm masks are loaded from NVM at every power-up, so they are set +* again on every probe. With a sensor unmasked, the PMIC powers down at +* the warm threshold; with all masked, only at the hot threshold. +*/ +if (chip_id ==TPS65219 && +of_property_read_bool (tps->dev->of_node,"ti,no-warm-shutdown" )) { + ret =regmap_set_bits (tps->regmap,TPS65219_REG_MASK_CONFIG , +TPS65219_REG_MASK_SENSOR_WARM_MASK ); +if (ret) { +dev_err (tps->dev,"Failed to mask warm shutdown: %d\n" , ret); +return ret; + } + } + ret =devm_regmap_add_irq_chip (tps->dev, tps->regmap, client->irq,IRQF_ONESHOT ,0 , pmic->irq_chip, &tps->irq_data);
include/linux/mfd/tps65219.h +5 -1
@@ -196,7 +196,11 @@ enum pmic_id {#define TPS65219_REG_MASK_UV_BUCK3_UV_MASK BIT(6)#define TPS65219_REG_MASK_UV_RETRY_MASK BIT(7)/* MASK Config */ -// SENSOR_N_WARM_MASK already defined in Thermal +#define TPS65219_REG_MASK_SENSOR_3_WARM_MASK BIT(0) +#define TPS65219_REG_MASK_SENSOR_2_WARM_MASK BIT(1) +#define TPS65219_REG_MASK_SENSOR_1_WARM_MASK BIT(2) +#define TPS65219_REG_MASK_SENSOR_0_WARM_MASK BIT(3) +#define TPS65219_REG_MASK_SENSOR_WARM_MASK GENMASK(3, 0)#define TPS65219_REG_MASK_INT_FOR_RV_MASK BIT(4)#define TPS65219_REG_MASK_EFFECT_MASK GENMASK(6, 5)#define TPS65219_REG_MASK_INT_FOR_PB_MASK BIT(7)
Signature · 1 line
2.53.0
[email protected]
AI reviewRe: [PATCH 3/3] mfd: tps65219: Keep running past the warm threshold when asked
Sashiko has reviewed this patch and found no issues.
Quoted 9 lines
When the devicetree sets ti,no-warm-shutdown on a TPS65219, set the four
SENSOR_x_WARM_MASKbits inMASK_CONFIGat probe. The PMIC then reports a warm die instead of powering the board down, and powers off only at its hot threshold.The masks are loaded from the PMIC's NVM at every power-up, so they are set on every probe.
Signed-off-by Chrispine Tinega <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3