summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/rtq6752-regulator.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/regulator/rtq6752-regulator.c b/drivers/regulator/rtq6752-regulator.c
index 72a72aa50d81..609d3fcf4923 100644
--- a/drivers/regulator/rtq6752-regulator.c
+++ b/drivers/regulator/rtq6752-regulator.c
@@ -54,12 +54,14 @@ static int rtq6752_set_vdd_enable(struct regulator_dev *rdev)
int rid = rdev_get_id(rdev), ret;
mutex_lock(&priv->lock);
- if (!priv->enable_flag && priv->enable_gpio) {
+ if (priv->enable_gpio) {
gpiod_set_value(priv->enable_gpio, 1);
usleep_range(RTQ6752_I2CRDY_TIMEUS,
RTQ6752_I2CRDY_TIMEUS + 100);
+ }
+ if (!priv->enable_flag) {
regcache_cache_only(priv->regmap, false);
ret = regcache_sync(priv->regmap);
if (ret) {
@@ -86,12 +88,14 @@ static int rtq6752_set_vdd_disable(struct regulator_dev *rdev)
mutex_lock(&priv->lock);
priv->enable_flag &= ~BIT(rid);
- if (!priv->enable_flag && priv->enable_gpio) {
+ if (!priv->enable_flag) {
regcache_cache_only(priv->regmap, true);
regcache_mark_dirty(priv->regmap);
+ }
+ if (priv->enable_gpio)
gpiod_set_value(priv->enable_gpio, 0);
- }
+
mutex_unlock(&priv->lock);
return 0;