regulator: Fixes for v6.19

A few fixes that came in during the merge window, nothing too exciting -
 the one core fix improves error propagation from gpiolib which hopefully
 shouldn't actually happen but is safer.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmk6FNQACgkQJNaLcl1U
 h9C3qgf9E7YZXR3nfhg/VgK7kqo5Q+5Wpn3FUF9WvZWcvHqAMf1muCUzq+KaA0yB
 AGPEspSH+YmC1fYAVCDagBFp/cT/NSdzyP7GwtN75V88V4qbu28wpMAFNjSnoP7w
 N3T4VhJQCqnHCyBbYUFcOemT3H6lzEsqAsnDvSJsSxOiH7w8H/0dYvbpv+X8wiWZ
 R0DWolVBgqM3zjn7Dt2n4VM6jSpeDzg3zM+xWD9svVDVoRrcL0dWIaJLQMTcbu4e
 63sHWn9148oza10dNMPXuMN78pNBpZRBE/aTu3uD1N9+8qJMCMu29UKokCbEsVfR
 mbQ+AzymoRprRe78m2dfKvxi023mBQ==
 =Zpyb
 -----END PGP SIGNATURE-----

Merge tag 'regulator-fix-v6.19-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A few fixes that came in during the merge window, nothing too
  exciting - the one core fix improves error propagation from gpiolib
  which hopefully shouldn't actually happen but is safer"

* tag 'regulator-fix-v6.19-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: spacemit: Align input supply name with the DT binding
  regulator: fixed: Rely on the core freeing the enable GPIO
  regulator: check the return value of gpiod_set_value_cansleep()
master
Linus Torvalds 2025-12-11 09:54:59 +09:00
commit 31ca9ff64a
3 changed files with 16 additions and 12 deletions

View File

@ -2823,14 +2823,18 @@ static void regulator_ena_gpio_free(struct regulator_dev *rdev)
static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
{
struct regulator_enable_gpio *pin = rdev->ena_pin;
int ret;
if (!pin)
return -EINVAL;
if (enable) {
/* Enable GPIO at initial use */
if (pin->enable_count == 0)
gpiod_set_value_cansleep(pin->gpiod, 1);
if (pin->enable_count == 0) {
ret = gpiod_set_value_cansleep(pin->gpiod, 1);
if (ret)
return ret;
}
pin->enable_count++;
} else {
@ -2841,7 +2845,10 @@ static int regulator_ena_gpio_ctrl(struct regulator_dev *rdev, bool enable)
/* Disable GPIO if not used */
if (pin->enable_count <= 1) {
gpiod_set_value_cansleep(pin->gpiod, 0);
ret = gpiod_set_value_cansleep(pin->gpiod, 0);
if (ret)
return ret;
pin->enable_count = 0;
}
}

View File

@ -330,13 +330,10 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev)
drvdata->dev = devm_regulator_register(&pdev->dev, &drvdata->desc,
&cfg);
if (IS_ERR(drvdata->dev)) {
ret = dev_err_probe(&pdev->dev, PTR_ERR(drvdata->dev),
"Failed to register regulator: %ld\n",
PTR_ERR(drvdata->dev));
gpiod_put(cfg.ena_gpiod);
return ret;
}
if (IS_ERR(drvdata->dev))
return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->dev),
"Failed to register regulator: %ld\n",
PTR_ERR(drvdata->dev));
platform_set_drvdata(pdev, drvdata);

View File

@ -87,10 +87,10 @@ static const struct linear_range p1_ldo_ranges[] = {
}
#define P1_BUCK_DESC(_n) \
P1_REG_DESC(BUCK, buck, _n, "vcc", 0x47, BUCK_MASK, 254, p1_buck_ranges)
P1_REG_DESC(BUCK, buck, _n, "vin", 0x47, BUCK_MASK, 254, p1_buck_ranges)
#define P1_ALDO_DESC(_n) \
P1_REG_DESC(ALDO, aldo, _n, "vcc", 0x5b, LDO_MASK, 117, p1_ldo_ranges)
P1_REG_DESC(ALDO, aldo, _n, "vin", 0x5b, LDO_MASK, 117, p1_ldo_ranges)
#define P1_DLDO_DESC(_n) \
P1_REG_DESC(DLDO, dldo, _n, "buck5", 0x67, LDO_MASK, 117, p1_ldo_ranges)