kernel-fxtec-pro1x/drivers/regulator
Doug Anderson 29d62ec5f8 regulator: core: Fix enable GPIO reference counting
Normally _regulator_do_enable() isn't called on an already-enabled
rdev.  That's because the main caller, _regulator_enable() always
calls _regulator_is_enabled() and only calls _regulator_do_enable() if
the rdev was not already enabled.

However, there is one caller of _regulator_do_enable() that doesn't
check: regulator_suspend_finish().  While we might want to make
regulator_suspend_finish() behave more like _regulator_enable(), it's
probably also a good idea to make _regulator_do_enable() robust if it
is called on an already enabled rdev.

At the moment, _regulator_do_enable() is _not_ robust for already
enabled rdevs if we're using an ena_pin.  Each time
_regulator_do_enable() is called for an rdev using an ena_pin the
reference count of the ena_pin is incremented even if the rdev was
already enabled.  This is not as intended because the ena_pin is for
something else: for keeping track of how many active rdevs there are
sharing the same ena_pin.

Here's how the reference counting works here:

* Each time _regulator_enable() is called we increment
  rdev->use_count, so _regulator_enable() calls need to be balanced
  with _regulator_disable() calls.

* There is no explicit reference counting in _regulator_do_enable()
  which is normally just a warapper around rdev->desc->ops->enable()
  with code for supporting delays.  It's not expected that the
  "ops->enable()" call do reference counting.

* Since regulator_ena_gpio_ctrl() does have reference counting
  (handling the sharing of the pin amongst multiple rdevs), we
  shouldn't call it if the current rdev is already enabled.

Note that as part of this we cleanup (remove) the initting of
ena_gpio_state in regulator_register().  In _regulator_do_enable(),
_regulator_do_disable() and _regulator_is_enabled() is is clear that
ena_gpio_state should be the state of whether this particular rdev has
requested the GPIO be enabled.  regulator_register() was initting it
as the actual state of the pin.

Fixes: 967cfb18c0 ("regulator: core: manage enable GPIO list")
Signed-off-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
2015-03-08 19:43:52 +00:00
..
88pm800.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
88pm8607.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
aat2870-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
ab3100.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
ab8500-ext.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
ab8500.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
act8865-regulator.c of: Rename "poweroff-source" property to "system-power-controller" 2014-12-01 19:33:44 +00:00
ad5398.c regulator: ad5398: Convert to devm_regulator_register 2013-09-17 00:27:55 +01:00
anatop-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
arizona-ldo1.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
arizona-micsupp.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
as3711-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
as3722-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
axp20x-regulator.c regulator: axp20x: Migrate to regulator core's simplified DT parsing code 2015-01-09 17:12:58 +00:00
bcm590xx-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
core.c regulator: core: Fix enable GPIO reference counting 2015-03-08 19:43:52 +00:00
da903x.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
da9052-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
da9055-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
da9063-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
da9210-regulator.c regulator: of: Add regulator desc param to of_get_regulator_init_data() 2014-11-26 18:58:14 +00:00
da9210-regulator.h regulator: da9210: New driver 2013-08-06 17:46:15 +01:00
da9211-regulator.c regulator: da9211: Add gpio control for enable/disable of buck 2015-01-28 17:38:14 +00:00
da9211-regulator.h regulator: da9211: support DA9213 2014-08-16 16:46:22 -05:00
db8500-prcmu.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
dbx500-prcmu.c regulator: dbx500: use seq_puts() instead of seq_printf() 2014-03-19 10:19:49 +00:00
dbx500-prcmu.h regulator: dbx500-prcmu: Remove operating_point from struct dbx500_regulator_info 2013-04-02 23:05:28 +01:00
devres.c regulator: Constify the pointer to alias name array 2014-05-23 18:55:23 +01:00
dummy.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
dummy.h
fan53555.c regulator: fan53555: Constify struct regmap_config and slew_rates array 2015-01-05 20:09:40 +00:00
fixed-helper.c
fixed.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
gpio-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
helpers.c regulator: helpers: Modify helpers enabling multi-bit control 2014-03-06 17:30:10 +08:00
hi6421-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
internal.h regulator: Allow parsing custom properties when using simplified DT parsing 2015-01-08 20:15:45 +00:00
isl6271a-regulator.c regulator: isl6271a-regulator: Use devm_regulator_register 2013-09-17 00:28:42 +01:00
isl9305.c regulator: isl9305: deprecate use of isl in compatible string for isil 2014-12-22 17:51:11 +00:00
Kconfig Merge remote-tracking branches 'regulator/topic/max8649', 'regulator/topic/mode', 'regulator/topic/mt6397', 'regulator/topic/pfuze100' and 'regulator/topic/qcom-rpm' into regulator-next 2015-02-08 11:16:27 +08:00
lp872x.c regulator: lp872x: Remove **regulators from struct lp872x 2015-01-26 19:10:55 +00:00
lp3971.c regulator: lp3971: Do not hardcode return value 2014-02-20 01:28:12 +09:00
lp3972.c regulator: lp3972: Convert to devm_regulator_register 2013-11-24 14:02:18 +00:00
lp8755.c regulator: lp8755: Use devm_regulator_register 2014-07-09 11:44:01 +02:00
lp8788-buck.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
lp8788-ldo.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
ltc3589.c regulator: ltc3589: fix broken voltage transitions 2014-09-26 09:22:50 +01:00
Makefile Merge remote-tracking branches 'regulator/topic/max8649', 'regulator/topic/mode', 'regulator/topic/mt6397', 'regulator/topic/pfuze100' and 'regulator/topic/qcom-rpm' into regulator-next 2015-02-08 11:16:27 +08:00
max1586.c regulator: max1586: zero-initialize regulator match table array 2014-11-03 15:36:50 +00:00
max8649.c regulator: max8649: Constify struct regmap_config and regulator_ops 2015-01-05 20:10:13 +00:00
max8660.c regulator: max8660: zero-initialize regulator match table array 2014-11-03 15:55:53 +00:00
max8907-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
max8925-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
max8952.c Merge remote-tracking branches 'regulator/topic/max77686', 'regulator/topic/max77693', 'regulator/topic/max77802', 'regulator/topic/power-off' and 'regulator/topic/rk808' into regulator-next 2014-12-05 11:14:37 +00:00
max8973-regulator.c regulator: of: Add regulator desc param to of_get_regulator_init_data() 2014-11-26 18:58:14 +00:00
max8997.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
max8998.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
max14577.c regulator: max14577: Use regulator_nodes/of_match in the descriptor 2014-12-22 12:11:43 +00:00
max77686.c regulator: max77686: Add GPIO control 2015-01-08 20:15:45 +00:00
max77693.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
max77802.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
max77843.c regulator: max77843: Add max77843 regulator driver 2015-02-05 17:33:39 +00:00
mc13xxx-regulator-core.c regulator: of: Add regulator desc param to of_get_regulator_init_data() 2014-11-26 18:58:14 +00:00
mc13xxx.h regulator: mc13xxx: Remove unused field "hi_bit" 2014-06-09 20:50:35 +01:00
mc13783-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
mc13892-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
mt6397-regulator.c regulator: mt6397: Add support for MT6397 regulator 2014-12-24 12:41:05 +00:00
of_regulator.c regulator: Allow parsing custom properties when using simplified DT parsing 2015-01-08 20:15:45 +00:00
palmas-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
pbias-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
pcap-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
pcf50633-regulator.c mfd: pcf50633: Correct device name for pcf50633 regulator 2013-12-02 17:58:58 +00:00
pfuze100-regulator.c regulator: pfuze100-regulator: add pfuze3000 support 2015-01-09 12:22:18 +00:00
pwm-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
qcom_rpm-regulator.c Changes to existing drivers: 2015-02-18 09:05:48 -08:00
rc5t583-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
rk808-regulator.c Merge remote-tracking branches 'regulator/topic/rk808', 'regulator/topic/rpm', 'regulator/topic/rt5033' and 'regulator/topic/tps65023' into regulator-next 2015-02-08 11:16:30 +08:00
rn5t618-regulator.c regulator: rn5t618: Convert to new style DT parsing 2014-10-20 12:23:59 +01:00
rt5033-regulator.c regulator: rt5033-regulator: Use regulator_nodes/of_match in the descriptor 2014-12-24 12:54:56 +00:00
s2mpa01.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
s2mps11.c Merge remote-tracking branch 'regulator/fix/s2mps11' into regulator-linus 2015-01-16 12:05:35 +00:00
s5m8767.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
sky81452-regulator.c regulator: sky81452: Modify Device Tree structure 2014-12-02 12:22:39 +00:00
stw481x-vmmc.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ti-abb-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
tps6105x-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
tps6507x-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
tps6524x-regulator.c regulator: tps6524x: Remove redundant error message 2014-02-20 20:54:59 +09:00
tps6586x-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
tps51632-regulator.c regulator: of: Add regulator desc param to of_get_regulator_init_data() 2014-11-26 18:58:14 +00:00
tps62360-regulator.c regulator: of: Add regulator desc param to of_get_regulator_init_data() 2014-11-26 18:58:14 +00:00
tps65023-regulator.c regulator: tps65023: Constify struct regmap_config and regulator_ops 2015-01-05 20:11:06 +00:00
tps65090-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
tps65217-regulator.c regulator: tps65217: Use simplified DT parsing 2014-09-10 12:02:48 +01:00
tps65218-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
tps65910-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
tps65912-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
tps80031-regulator.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
twl-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
userspace-consumer.c regulator: use dev_get_platdata() 2013-07-30 12:24:20 +01:00
vexpress.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
virtual.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
wm831x-dcdc.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
wm831x-isink.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
wm831x-ldo.c regulator: drop owner assignment from platform_drivers 2014-10-20 16:21:29 +02:00
wm8350-regulator.c regulator: wm8350: Do not hardcode return value 2014-02-19 13:24:12 +09:00
wm8400-regulator.c Merge remote-tracking branch 'regulator/topic/linear' into regulator-next 2013-10-24 11:11:37 +01:00
wm8994-regulator.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00