regulator: Fixes for v6.3

Two fixes here, one driver fix for incorrect error codes and a fix in
 the core to use ktime_get_boottime() in order to fix accounting of the
 time regulators have been powered down over suspend, ktime_get()
 pauses over suspend which is not what we want.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmP/tZ4ACgkQJNaLcl1U
 h9C0Wwf/XZb6kH1Ar70cVJPBxifze0PgsfwMxP6Pfi6PUuZkWldggZqt3SEBicyg
 7aaoTavPg9XRbVBfMS9AYjnGe+AjWcltCzF8im4OGMFrbRWdyDX27iJOCacPJn6A
 B7D3waWHiO811zArqf/Xy6hCOJRHtXE29mDruW2K1q4vYpc3mUsrd0C0s6k1575B
 AxaZxbndsCKsFfZMZ0ruPl9lt8ziEQiW6uBk9TXSThoAtCOaydDWFJF0EbQykX9q
 ks/Oh6ge5gXBoiEQX4bpd1BxRYx/enMK2LwMm86Imbg9dGPJa5YAfZkXIfQSAXfy
 F4HVlQVhcUaFvTM44G+bdiyowppFCw==
 =PSq9
 -----END PGP SIGNATURE-----

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

Pull regulator fixes from Mark Brown:
 "Two fixes here, one driver fix for incorrect error codes and a fix in
  the core to use ktime_get_boottime() in order to fix accounting of the
  time regulators have been powered down over suspend. ktime_get()
  pauses over suspend which is not what we want"

* tag 'regulator-fix-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: core: Use ktime_get_boottime() to determine how long a regulator was off
  regulator: max597x: Fix error return code in max597x_get_status
This commit is contained in:
Linus Torvalds 2023-03-02 09:21:25 -08:00
commit fd7ee8de98
2 changed files with 4 additions and 4 deletions

View file

@ -1584,7 +1584,7 @@ static int set_machine_constraints(struct regulator_dev *rdev)
}
if (rdev->desc->off_on_delay)
rdev->last_off = ktime_get();
rdev->last_off = ktime_get_boottime();
/* If the constraints say the regulator should be on at this point
* and we have control then make sure it is enabled.
@ -2673,7 +2673,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
* this regulator was disabled.
*/
ktime_t end = ktime_add_us(rdev->last_off, rdev->desc->off_on_delay);
s64 remaining = ktime_us_delta(end, ktime_get());
s64 remaining = ktime_us_delta(end, ktime_get_boottime());
if (remaining > 0)
_regulator_delay_helper(remaining);
@ -2912,7 +2912,7 @@ static int _regulator_do_disable(struct regulator_dev *rdev)
}
if (rdev->desc->off_on_delay)
rdev->last_off = ktime_get();
rdev->last_off = ktime_get_boottime();
trace_regulator_disable_complete(rdev_get_name(rdev));

View file

@ -193,7 +193,7 @@ static int max597x_get_status(struct regulator_dev *rdev)
ret = regmap_read(rdev->regmap, MAX5970_REG_STATUS3, &val);
if (ret)
return REGULATOR_FAILED_RETRY;
return ret;
if (val & MAX5970_STATUS3_ALERT)
return REGULATOR_STATUS_ERROR;