linux/drivers/regulator
Mark Brown f70e472d69
Merge series "regulator_sync_state() support" from Saravana Kannan <saravanak@google.com>:
Consider the following example:
- regulator-X is provided by device-X.
- regulator-X is a supplier to device-A, device-B and device-C.
- device-A is off/inactive from boot.
- device-B and device-C are left on/active by the bootloader
- regulator-X is left on boot by the bootloader at 2000 mV to supply
  device-B and device-C.

Example boot sequence 1:
1. device-X is probed successfully.
2. device-A is probed by driver-A
   a. driver-A gets regulator-X
   b. driver-A votes on regulator-X
   c. driver-A initializes device-A
   d. driver-A votes off regulator-X
   e. regulator-X is turned off.
3. System crashes or device-B and device-C become unreliable because
   regulator-X was turned off without following the proper quiescing
   steps for device-B and device-C.

Example boot sequence 2:
1. device-X is probed successfully.
2. device-B is probed by driver-B
   a. driver-B gets regulator-X
   b. driver-B votes on regulator-X
   c. driver-B lowers device-B performance point.
   d. driver-B lowers voltage vote to 1000 mV.
   e. regulator-X voltage is lowered to 1000 mV.
3. System crashes or device-C becomes unreliable because regulator-X
   voltage was lowered to 1000 mV when device-C still needed it at 2000 mV

This patch series makes sure these examples are handled correctly and
system crash or device instability is avoided and the system remains
usable.

More details provided in the commit texts.

v2->v3:
Patch 2/4 - No functional change. Simple refactor.
Patch 3/4
- Was Patch 2/2 in v2.
- Rewrote commit text to hopefully address all previous points.
- Renamed variable/functions. Hope it's clearer.
- Added more comments.
- Added logging
- Fixed timeout functionality.
- Handle exclusive consumers properly
- Handle coupled regulators properly
Patch 4/4 - Prevents voltage from going too low during boot.

v1->v2:
Patch 1/2
- New patch
Patch 2/2
- This was the only patch in v1
- Made the late_initcall_sync timeout a commandline param
- If timeout is set, we also give up waiting for all consumers after
  the timeout expires.
- Made every regulator driver add sync_state() support

Saravana Kannan (4):
  driver core: Add dev_set_drv_sync_state()
  regulator: core: Add destroy_regulator()
  regulator: core: Add basic enable/disable support for sync_state()
    callbacks
  regulator: core: Add voltage support for sync_state() callbacks

 drivers/regulator/core.c         | 200 ++++++++++++++++++++++++++++---
 include/linux/device.h           |  12 ++
 include/linux/regulator/driver.h |   2 +
 3 files changed, 198 insertions(+), 16 deletions(-)

--
2.28.0.rc0.105.gf9edc3c819-goog
2020-07-20 16:31:55 +01:00
..
88pg86x.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
88pm800-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
88pm8607.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
aat2870-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 336 2019-06-05 17:37:07 +02:00
ab3100.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
ab8500-ext.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 197 2019-05-30 11:29:22 -07:00
ab8500.c regulator: ab8500: Remove unused embedded struct expand_register 2020-06-25 20:11:13 +01:00
act8865-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
act8945a-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
ad5398.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 149 2019-05-30 11:25:18 -07:00
anatop-regulator.c regulator: anatop: Constify anatop_core_rops 2020-06-18 13:47:31 +01:00
arizona-ldo1.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
arizona-micsupp.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
as3711-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
as3722-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
axp20x-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
bcm590xx-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
bd718x7-regulator.c regulator: bd718x7: remove voltage change restriction from BD71847 LDOs 2020-05-14 18:26:11 +01:00
bd9571mwv-regulator.c regulator: bd9571mwv: Constify regulator_ops 2019-01-24 17:53:12 +00:00
bd70528-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
bd71828-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
core.c regulator: core: Add destroy_regulator() 2020-07-20 16:22:45 +01:00
cpcap-regulator.c regulator: cpcap-regulator: Demote kerneldoc header to standard comment 2020-06-25 20:11:16 +01:00
cros-ec-regulator.c regulator: cros-ec: Constify cros_ec_regulator_voltage_ops 2020-07-13 18:08:41 +01:00
da903x.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
da9052-regulator.c regulator: da9xxx: Switch to SPDX identifier 2019-05-03 15:07:39 +09:00
da9055-regulator.c regulator: da9xxx: Switch to SPDX identifier 2019-05-03 15:07:39 +09:00
da9062-regulator.c regulator: da9062: Replace zero-length array with flexible-array member 2020-02-12 23:54:54 +00:00
da9063-regulator.c regulator: da9063: fix LDO9 suspend and warning. 2020-06-12 14:57:17 +01:00
da9210-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
da9210-regulator.h regulator: da9xxx: Switch to SPDX identifier 2019-05-03 15:07:39 +09:00
da9211-regulator.c regulator: da9211: Implement of_map_mode 2020-07-02 16:20:58 +01:00
da9211-regulator.h regulator: da9xxx: Switch to SPDX identifier 2019-05-03 15:07:39 +09:00
db8500-prcmu.c regulator: db8500-prcmu: Use true,false for bool variable 2020-05-06 15:16:59 +01:00
dbx500-prcmu.c regulator: dbx500-prcmu: Remove unused function dbx500_regulator_testcase() 2020-06-25 20:11:12 +01:00
dbx500-prcmu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 197 2019-05-30 11:29:22 -07:00
devres.c regulator: devres: Standardise on function documentation headers 2020-07-08 17:37:54 +01:00
dummy.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
dummy.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
fan53555.c regulator: fan53555: add chip id for Silergy SYR83X 2019-11-06 16:19:47 +00:00
fan53880.c regulator: fan53880: Add support for COMPILE_TEST 2020-07-07 13:50:46 +01:00
fixed-helper.c regulator: fixed: Convert to use GPIO descriptor only 2018-09-17 14:32:22 -07:00
fixed.c regulator: Fix trivial spelling 2020-06-15 23:06:30 +01:00
gpio-regulator.c regulator: gpio: Honor regulator-boot-on property 2020-07-20 16:31:54 +01:00
helpers.c regulator: Fix pickable ranges mapping 2020-06-12 14:57:17 +01:00
hi655x-regulator.c regulator: hi6xxx: Switch to SPDX identifier 2019-05-02 11:16:40 +09:00
hi6421-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
hi6421v530-regulator.c regulator: hi6xxx: Switch to SPDX identifier 2019-05-02 11:16:40 +09:00
internal.h regulator: core: Don't try to remove device links if add failed 2019-11-15 12:04:20 +00:00
isl6271a-regulator.c regulator: isl6271a: Constify isl_core_ops and isl_fixed_ops 2019-01-28 15:30:58 +00:00
isl9305.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
Kconfig regulator: qcom: Add labibb driver 2020-07-15 15:47:16 +01:00
lm363x-regulator.c regulator: lm363x: Fix n_voltages setting for lm36274 2019-07-22 13:18:13 +01:00
lochnagar-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
lp872x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lp873x-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
lp3971.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
lp3972.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lp8755.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
lp8788-buck.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
lp8788-ldo.c regulator: lp8788-ldo: make array en_mask static const, makes object smaller 2019-09-09 10:53:48 +01:00
lp87565-regulator.c regulator: lp87565: enable voltage regardless of ENx pin 2020-07-01 21:53:02 +01:00
ltc3589.c regulator: ltc3589: Switch to SPDX identifier 2019-04-26 10:38:20 +01:00
ltc3676.c regulator: ltc3676: Constify ltc3676_regulators 2020-06-18 13:47:33 +01:00
Makefile regulator: qcom: Add labibb driver 2020-07-15 15:47:16 +01:00
max1586.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
max8649.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
max8660.c regulator: max8660: remove redundant assignment of variable ret 2019-08-15 15:09:21 +01:00
max8907-regulator.c regulator: max8907: Constify static structs 2020-06-18 13:47:34 +01:00
max8925-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
max8952.c Linux 5.2-rc4 2019-06-18 19:12:47 +01:00
max8973-regulator.c regulator: max8973: Let core handle GPIO descriptor 2018-12-11 01:04:31 +00:00
max8997-regulator.c regulator: max8997: Constify struct regulator_ops 2020-06-18 13:47:35 +01:00
max8998.c regulator: max8998: Staticify internal function max8998_get_current_limit() 2020-06-26 15:34:18 +01:00
max14577-regulator.c regulator: max14577-regulator: Demote kerneldoc header to standard comment 2020-06-25 20:11:17 +01:00
max77620-regulator.c regulator: max77620: remove redundant assignment to variable ret 2019-07-03 13:02:38 +01:00
max77650-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
max77686-regulator.c regulator: max77686: switch to using fwnode_gpiod_get_index 2019-10-07 14:02:20 +01:00
max77693-regulator.c regulator: maxim: Add SPDX license identifiers 2018-08-08 10:52:50 +01:00
max77802-regulator.c regulator: max77802: Drop unused includes 2019-06-10 15:40:58 +01:00
max77826-regulator.c regulator: max77826: Add max77826 regulator driver 2020-04-14 19:01:19 +01:00
mc13xxx-regulator-core.c regulator: mc13xxx: Constify regulator_ops variables 2019-03-04 00:01:08 +00:00
mc13xxx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
mc13783-regulator.c regulator: mc13xxx: Constify regulator_ops variables 2019-03-04 00:01:08 +00:00
mc13892-regulator.c regulator: mc13xxx: Constify regulator_ops variables 2019-03-04 00:01:08 +00:00
mcp16502.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mp886x.c regulator: mp886x: use .probe_new 2020-07-02 16:45:46 +01:00
mp5416.c regulator: mp5416: Fix output discharge enable bit for LDOs 2020-02-17 19:13:26 +00:00
mp8859.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mpq7920.c regulator: mpq7920: Convert to use .probe_new 2020-01-14 15:25:00 +00:00
mpq7920.h regulator: mpq7920: Fix incorrect defines 2020-01-17 15:34:31 +00:00
mt6311-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
mt6311-regulator.h regulator: mt63xx: Switch to SPDX identifier 2019-04-26 10:38:23 +01:00
mt6323-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mt6358-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mt6380-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
mt6397-regulator.c regulator: mt6397: Implement of_map_mode 2020-07-02 15:25:45 +01:00
of_regulator.c regulator: of_regulator: Add missing colon for rdev kerneldoc argument 2020-07-08 17:37:53 +01:00
palmas-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
pbias-regulator.c regulator: pbias: Get rid of struct pbias_regulator_data 2019-10-07 13:54:42 +01:00
pca9450-regulator.c regulator: pca9450: add pca9450 pmic driver 2020-07-06 15:23:33 +01:00
pcap-regulator.c regulator: pcap-regulator: remove unused variable 'SW3_table' 2019-10-01 12:46:37 +01:00
pcf50633-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pfuze100-regulator.c regulator: pfuze100: add condition check for 'ramp_delay = 0' 2020-06-23 13:15:13 +01:00
pv88060-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
pv88060-regulator.h regulator: pv880x0: Switch to SPDX identifier 2019-05-03 15:05:52 +09:00
pv88080-regulator.c regulator: pv880x0: Switch to SPDX identifier 2019-05-03 15:05:52 +09:00
pv88080-regulator.h regulator: pv880x0: Switch to SPDX identifier 2019-05-03 15:05:52 +09:00
pv88090-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
pv88090-regulator.h regulator: pv880x0: Switch to SPDX identifier 2019-05-03 15:05:52 +09:00
pwm-regulator.c regulator: pwm-regulator: Demote kerneldoc header to standard comment 2020-06-26 15:34:19 +01:00
qcom_rpm-regulator.c regulator: qcom_rpm: Constify struct regulator_ops 2020-07-01 18:33:14 +01:00
qcom_smd-regulator.c regulator: qcom_smd: Add MP5496 regulators 2020-07-01 21:35:54 +01:00
qcom_spmi-regulator.c regulator: qcom_spmi: Constify struct regulator_ops 2020-07-01 18:33:15 +01:00
qcom_usb_vbus-regulator.c regulator: fix null pointer check on regmap 2020-07-02 16:45:45 +01:00
qcom-labibb-regulator.c regulator: qcom: Add labibb driver 2020-07-15 15:47:16 +01:00
qcom-rpmh-regulator.c regulator: qcom-rpmh-regulator: Repair dodgy kerneldoc header formatting 2020-06-26 15:34:18 +01:00
rc5t583-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
rk808-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
rn5t618-regulator.c regulator: Fixes for v5.5 2019-12-17 13:08:41 -08:00
rohm-regulator.c regulator: bd718x7: Split driver to common and bd718x7 specific parts 2020-01-24 07:22:53 +00:00
rt5033-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 450 2019-06-05 17:37:18 +02:00
s2mpa01.c regulator: samsung: Rename Samsung to lowercase 2020-01-06 20:47:42 +00:00
s2mps11.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
s5m8767.c Merge branch 'regulator-5.6' into regulator-next 2020-01-23 12:37:06 +00:00
sc2731-regulator.c regulator: sc2731: Constify regulators 2019-03-26 13:25:35 +00:00
sky81452-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
slg51000-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
slg51000-regulator.h regulator: slg51000: add slg51000 regulator driver 2019-05-13 11:07:43 +01:00
stm32-booster.c regulator: stm32-booster: Remove .min_uV and .list_voltage for fixed regulator 2019-07-23 12:28:01 +01:00
stm32-pwr.c regulator: stm32-pwr: Remove unneeded .min_uV and .list_volage 2019-05-03 15:07:15 +09:00
stm32-vrefbuf.c regulator: stm32-vrefbuf: fix a possible overshoot when re-enabling 2020-03-04 13:57:28 +00:00
stpmic1_regulator.c regulator: stpmic1_regulator: Properly document 'struct stpmic1_regulator_cfg' 2020-06-26 15:34:20 +01:00
stw481x-vmmc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
sy8106a-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
sy8824x.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
sy8827n.c regulator: add support for SY8827N regulator 2020-07-02 15:52:00 +01:00
ti-abb-regulator.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
tps6105x-regulator.c regulator: tps6105x: add optional devicetree support 2019-11-20 17:10:47 +00:00
tps6507x-regulator.c regulator: tps6507x: Fix boot regression due to testing wrong init_data pointer 2019-05-16 17:11:47 +01:00
tps6524x-regulator.c regulator: tps6524x: Remove *rdev[N_REGULATORS] from struct tps6524x 2019-04-15 09:44:41 +01:00
tps6586x-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tps51632-regulator.c
tps62360-regulator.c
tps65023-regulator.c regulator: tps65023: Fix inverted core enable logic. 2017-04-18 18:55:05 +01:00
tps65086-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
tps65090-regulator.c regulator: tps65090: switch to using devm_fwnode_gpiod_get 2019-10-07 14:02:02 +01:00
tps65132-regulator.c regulator: Convert i2c drivers to use .probe_new 2020-01-13 15:03:06 +00:00
tps65217-regulator.c regulator: tps65217-regulator: Use the returned value of tps65217_reg_read() 2020-06-26 15:34:22 +01:00
tps65218-regulator.c regulator: tps65218-regulator: Remove pointless 'is unsigned int <0' check 2020-06-26 15:34:23 +01:00
tps65910-regulator.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
tps65912-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
tps80031-regulator.c regulator: tps80031: remove redundant assignment to variables ret and val 2020-04-14 16:57:44 +01:00
twl6030-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
twl-regulator.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
uniphier-regulator.c regulator: uniphier: use devm_platform_ioremap_resource() to simplify code 2019-10-09 18:17:15 +01:00
userspace-consumer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
vctrl-regulator.c regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage 2020-01-17 15:32:27 +00:00
vexpress-regulator.c regulator: vexpress: Use PTR_ERR_OR_ZERO() to simplify code 2019-11-18 12:58:24 +00:00
virtual.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
vqmmc-ipq4019-regulator.c regulator: vqmmc-ipq4019: Fix platform_no_drv_owner.cocci warnings 2020-01-17 15:34:21 +00:00
wm831x-dcdc.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
wm831x-isink.c regulator: wm831x: Switch to SPDX identifier 2019-04-17 17:40:29 +01:00
wm831x-ldo.c regulator: use linear_ranges helper 2020-05-08 18:18:13 +01:00
wm8350-regulator.c regulator: wm8350-regulator: Repair odd formatting in documentation 2020-06-25 20:11:14 +01:00
wm8400-regulator.c regulator: wm8400-regulator: Repair dodgy kerneldoc header formatting 2020-06-26 15:34:24 +01:00
wm8994-regulator.c regulator: wm8994: Switch to SPDX identifier 2019-04-17 17:39:58 +01:00