regulator: fan53555: add support to disable suspend voltage configuration
Currently, fan53555 regulator driver always registers for
set_suspend_voltage. This force configures the regulator to
set suspend voltage switching to a different voltage selector.
However, this might not be preferred for certain applications.
Add a device tree parameter "fcs,disable-suspend" for the
regulator which when specified will disable suspend voltage
configuration.
CRs-Fixed: 968575
Change-Id: Ib9f450126482e606f3e057857b7a58800583519a
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index 4bed510..13d53a3 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -99,6 +99,8 @@
unsigned int slew_rate;
/* Sleep voltage cache */
unsigned int sleep_vol_cache;
+ /* Disable suspend */
+ bool disable_suspend;
};
static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV)
@@ -106,6 +108,8 @@
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
int ret;
+ if (di->disable_suspend)
+ return 0;
if (di->sleep_vol_cache == uV)
return 0;
ret = regulator_map_voltage_linear(rdev, uV, uV);
@@ -368,6 +372,8 @@
if (!ret)
pdata->sleep_vsel_id = tmp;
+ di->disable_suspend = of_property_read_bool(np, "fcs,disable-suspend");
+
return ret;
}