]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mfd: tps65219: Implement LOCK register handling for TPS65214
authorKory Maincent (TI.com) <kory.maincent@bootlin.com>
Thu, 18 Dec 2025 15:06:28 +0000 (16:06 +0100)
committerLee Jones <lee@kernel.org>
Thu, 22 Jan 2026 14:22:54 +0000 (14:22 +0000)
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: 7947219ab1a2d ("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>
drivers/mfd/tps65219.c
include/linux/mfd/tps65219.h

index 65a952555218dc3a0dcfd3ab9dfae79f0122b0fc..7275dcdb7c44fcaefd7ffdec7e46108d29a687d8 100644 (file)
@@ -498,6 +498,15 @@ static int tps65219_probe(struct i2c_client *client)
                return ret;
        }
 
+       if (chip_id == TPS65214) {
+               ret = i2c_smbus_write_byte_data(client, TPS65214_REG_LOCK,
+                                               TPS65214_LOCK_ACCESS_CMD);
+               if (ret) {
+                       dev_err(tps->dev, "Failed to unlock registers %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);
index 55234e771ba735a0c091f123073262e039cf0c1b..3abf937191d0c2194422f95c0cdf402e2ceae9d1 100644 (file)
@@ -149,6 +149,8 @@ enum pmic_id {
 #define TPS65215_ENABLE_LDO2_EN_MASK                    BIT(5)
 #define TPS65214_ENABLE_LDO1_EN_MASK                   BIT(5)
 #define TPS65219_ENABLE_LDO4_EN_MASK                   BIT(6)
+/* Register Unlock */
+#define TPS65214_LOCK_ACCESS_CMD                       0x5a
 /* power ON-OFF sequence slot */
 #define TPS65219_BUCKS_LDOS_SEQUENCE_OFF_SLOT_MASK     GENMASK(3, 0)
 #define TPS65219_BUCKS_LDOS_SEQUENCE_ON_SLOT_MASK      GENMASK(7, 4)