From 7595f50ff82260b6dd95af9e339f1d47f45ce753 Mon Sep 17 00:00:00 2001 From: Joy Zou Date: Fri, 31 Jul 2026 18:21:44 +0800 Subject: [PATCH] regulator: pfuze100: add set_suspend_disable for LDO ops Add a set_suspend_disable callback to pfuze100_ldo_regulator_ops to support the regulator-off-in-suspend DTS property for the VGEN LDO regulators. This allows unused LDO regulators to be properly disabled during system suspend, reducing power consumption. The callback is only used by the LDO ops, so name it accordingly: pfuze100_ldo_set_suspend_disable. It uses the per-regulator stby_reg/stby_mask that already describe the standby control for each LDO, so it works for every LDO covered by these ops. Signed-off-by: Joy Zou Reviewed-by: Frank Li Link: https://patch.msgid.link/20260731-b4-regulator-pf01-v2-2-a406c8737fdb@oss.nxp.com Signed-off-by: Mark Brown --- drivers/regulator/pfuze100-regulator.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index 7d56c22b5e40..d3a0e2505524 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c @@ -158,6 +158,25 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) return ret; } +static int pfuze100_ldo_set_suspend_disable(struct regulator_dev *rdev) +{ + struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev); + int id = rdev_get_id(rdev); + struct pfuze_regulator *desc = &pfuze100->regulator_descs[id]; + + /* + * Set the standby bit so the LDO output is turned off when the PMIC + * receives a STANDBY event, using the per-regulator stby_reg/stby_mask + * that describe the standby control for each LDO. + * + * The stby_mask only covers the VGENxSTBY bit. The VGENxLPWR stays at + * its reset value of 0, so the LDO is switched off rather than put + * into low-power mode. + */ + return regmap_update_bits(pfuze100->regmap, desc->stby_reg, + desc->stby_mask, desc->stby_mask); +} + static const struct regulator_ops pfuze100_ldo_regulator_ops = { .enable = regulator_enable_regmap, .disable = regulator_disable_regmap, @@ -165,6 +184,7 @@ static const struct regulator_ops pfuze100_ldo_regulator_ops = { .list_voltage = regulator_list_voltage_linear, .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap, + .set_suspend_disable = pfuze100_ldo_set_suspend_disable, }; static const struct regulator_ops pfuze100_fixed_regulator_ops = {