mfd: tps65219: Let a board run past the warm threshold
Subsystems (4)
v2 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.
A runtime override, for a user who wants the PMIC to shut down at the warm threshold anyway, is left for a follow-up once someone needs it.
Changes in v2:
- Patch 1: add the Fixes: tag. (Sashiko)
- Patch 2: the binding no longer says the operating system reacts to the warning, since nothing does today. Mark's Reviewed-by added.
v1: https://lore.kernel.org/all/[email protected]/
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 | 10 ++++++++++ drivers/mfd/tps65219.c | 15 +++++++++++++++ include/linux/mfd/tps65219.h | 8 ++++++-- 3 files changed, 31 insertions(+), 2 deletions(-)
base-commit: c92739a23a80f5f0a7c6f3c10aa792102d252ac4
Signature · 1 line
2.53.0
PATCH v2 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.
---
Changes in v2:
- Add the Fixes: tag. (Sashiko)
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 v2 1/3] mfd: tps65219: Correct the MASK_EFFECT field of MASK_CONFIG
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines
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.Fixes 74c17a0a49a6 ("mfd: tps65219: Add driver for TI TPS65219 PMIC")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=1
PATCH v2 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.
---
Changes in v2:
- Drop "so the board can run warmer and the operating system decides how to react to the warning" from the description. Nothing acts on the warning today. (Mark)
- Add Mark's Reviewed-by.
.../devicetree/bindings/regulator/ti,tps65219.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/regulator/ti,tps65219.yaml +10 -0
@@ -62,6 +62,15 @@ 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. + regulators: type: object description: |
@@ -111,6 +120,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 v2 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 v2 2/3] regulator: dt-bindings: ti,tps65219: Add ti,no-warm-shutdown
In reply to Chrispine TinegaDocumentation/devicetree/bindings/regulator/ti,tps65219.yaml properties: · line 67
Quoted 12 lines · Chrispine Tinega
Documentation/devicetree/bindings/regulator/ti,tps65219.yaml +3
-0@@ -62,6 +62,15 @@ 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: |
Do not need '|' unless you need to preserve formatting.
Best regards,
Krzysztof
PATCH v2 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.
---
Changes in v2:
- None.
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 v2 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