drivers: slg51000: Prevent Driver from touching voltages

Default voltages on reset on slg51000 pmic are the expected voltages from
hardware so there is no need for the driver to set the voltage. Set via
device tree bool

Change-Id: I48ed538f0edf4c172a282c166b65fb3b00f3c383
Reviewed-on: https://gerrit.mot.com/1475733
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Rav(CR) Vembu <raviv@motorola.com>
Reviewed-by: Jian Luan <jamesluan@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
timwang 2019-12-20 16:32:12 -06:00 • committed by Tim Wang
commit 4745d227ce

View file

@ -47,6 +47,7 @@ struct slg51000 {
struct regulator_dev *rdev[SLG51000_MAX_REGULATORS];
int chip_irq;
int chip_cs_pin;
int use_default_voltage;
};
struct slg51000_evt_sta {
@ -203,6 +204,15 @@ static int slg51000_regulator_is_enabled(struct regulator_dev *rdev)
return 0;
}
static int slg51000_regulator_set_voltage_sel(struct regulator_dev *rdev, unsigned sel) {
struct slg51000 *chip = rdev_get_drvdata(rdev);
if (chip->use_default_voltage) {
return 0;
}
return regulator_set_voltage_sel_regmap(rdev, sel);
}
static struct regulator_ops slg51000_regl_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@ -210,7 +220,7 @@ static struct regulator_ops slg51000_regl_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_sel = slg51000_regulator_set_voltage_sel,
};
static struct regulator_ops slg51000_switch_ops = {
@ -478,6 +488,8 @@ static int slg51000_i2c_probe(struct i2c_client *client,
chip->chip_cs_pin = cs_gpio;
}
chip->use_default_voltage = of_property_read_bool(dev->of_node, "use-default-voltage");
i2c_set_clientdata(client, chip);
chip->chip_irq = client->irq;
chip->dev = dev;