Skip to content

Commit d3fcf27

Browse files
kmaincentlag-linaro
authored andcommitted
mfd: tps65219: Implement LOCK register handling for TPS65214
The TPS65214 PMIC variant has a LOCK_REG register that prevents writes to nearly all registers when locked. Unlock the registers at probe time and leave them unlocked permanently. This approach is justified because: - Register locking is very uncommon in typical system operation - No code path is expected to lock the registers during runtime - Adding a custom regmap write function would add overhead to every register write, including voltage changes triggered by CPU OPP transitions from the cpufreq governor which could happen quite frequently Cc: stable@vger.kernel.org Fixes: 7947219 ("mfd: tps65219: Add support for TI TPS65214 PMIC") Reviewed-by: Andrew Davis <afd@ti.com> Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com> Link: https://patch.msgid.link/20251218-fix_tps65219-v5-1-8bb511417f3a@bootlin.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 05995af commit d3fcf27

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/mfd/tps65219.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,15 @@ static int tps65219_probe(struct i2c_client *client)
498498
return ret;
499499
}
500500

501+
if (chip_id == TPS65214) {
502+
ret = i2c_smbus_write_byte_data(client, TPS65214_REG_LOCK,
503+
TPS65214_LOCK_ACCESS_CMD);
504+
if (ret) {
505+
dev_err(tps->dev, "Failed to unlock registers %d\n", ret);
506+
return ret;
507+
}
508+
}
509+
501510
ret = devm_regmap_add_irq_chip(tps->dev, tps->regmap, client->irq,
502511
IRQF_ONESHOT, 0, pmic->irq_chip,
503512
&tps->irq_data);

include/linux/mfd/tps65219.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ enum pmic_id {
149149
#define TPS65215_ENABLE_LDO2_EN_MASK BIT(5)
150150
#define TPS65214_ENABLE_LDO1_EN_MASK BIT(5)
151151
#define TPS65219_ENABLE_LDO4_EN_MASK BIT(6)
152+
/* Register Unlock */
153+
#define TPS65214_LOCK_ACCESS_CMD 0x5a
152154
/* power ON-OFF sequence slot */
153155
#define TPS65219_BUCKS_LDOS_SEQUENCE_OFF_SLOT_MASK GENMASK(3, 0)
154156
#define TPS65219_BUCKS_LDOS_SEQUENCE_ON_SLOT_MASK GENMASK(7, 4)

0 commit comments

Comments
 (0)