]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
power: regulator: tps65941: Enable FPWM bits
authorNeha Malcom Francis <n-francis@ti.com>
Tue, 21 Apr 2026 08:21:45 +0000 (13:51 +0530)
committerPeng Fan <peng.fan@nxp.com>
Wed, 6 May 2026 02:20:29 +0000 (10:20 +0800)
Depending on the phase selection (single or multi), the FPWM bits
configured forces the regulator to operate in PWM mode. In case of
multi-phase selection, the FPWM_MP bits enforce the regulator to also
operate in multi-phase. This fixes correct multi-phase operation.

While at this, correct incorrect macro alignment as well.

Fixes: 065a452ae6a1 ("power: regulator: tps65941: add regulator support")
Link: https://www.ti.com/lit/ds/symlink/tps6594-q1.pdf
Signed-off-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Takuma Fujiwara <t-fujiwara1@ti.com>
Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/power/regulator/tps65941_regulator.c
include/power/tps65941.h

index 2561d6f4c6cc69c091b6dc6c8efcf62931cd0936..209968b571886fe38b6faf5fa689d5bb0b22ae35 100644 (file)
@@ -63,13 +63,14 @@ static inline int tps65941_get_chip_id(struct udevice *dev)
 
 static int tps65941_buck_enable(struct udevice *dev, int op, bool *enable)
 {
-       int ret;
+       int ret, idx;
        unsigned int adr;
        struct dm_regulator_uclass_plat *uc_pdata;
 
        uc_pdata = dev_get_uclass_plat(dev);
        adr = uc_pdata->ctrl_reg;
 
+       idx = dev->driver_data;
        ret = pmic_reg_read(dev->parent, adr);
        if (ret < 0)
                return ret;
@@ -84,10 +85,18 @@ static int tps65941_buck_enable(struct udevice *dev, int op, bool *enable)
 
                return 0;
        } else if (op == PMIC_OP_SET) {
-               if (*enable)
+               if (*enable) {
                        ret |= TPS65941_BUCK_MODE_MASK;
-               else
+                       /* Enable FPWM */
+                       ret |= TPS65941_BUCK_FPWM_MASK;
+                       /* If Multiphase enable FPWM_MP */
+                       if (idx == TPS65941_BUCK_ID_12 ||
+                           idx == TPS65941_BUCK_ID_123 ||
+                           idx == TPS65941_BUCK_ID_1234)
+                               ret |= TPS65941_BUCK_FPWM_MP_MASK;
+               } else {
                        ret &= ~TPS65941_BUCK_MODE_MASK;
+               }
                ret = pmic_reg_write(dev->parent, adr, ret);
                if (ret)
                        return ret;
index a026ec56958502e46f25d664d3fb29b0df38141a..78e48a159720992cf10e84c22a5c831681c8897d 100644 (file)
@@ -19,7 +19,9 @@
 #define TPS65941_BUCK_VOLT_MASK                0xFF
 #define TPS65941_BUCK_VOLT_MAX_HEX     0xFF
 #define TPS65941_BUCK_VOLT_MAX         3340000
-#define TPS65941_BUCK_MODE_MASK                0x1
+#define TPS65941_BUCK_MODE_MASK        0x1
+#define TPS65941_BUCK_FPWM_MASK        0x2
+#define TPS65941_BUCK_FPWM_MP_MASK     0x4
 
 #define TPS65941_LDO_VOLT_MASK         0x7E
 #define TPS65941_LDO_VOLT_MAX_HEX      0x3A