summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAlex Frid <afrid@nvidia.com>2014-02-05 00:06:41 -0800
committerAleksandr Frid <afrid@nvidia.com>2014-02-18 11:15:41 -0800
commit2acff98da011971cba17292e9730a7a47f465d5c (patch)
tree17ef4ed401fdfd23ec9445f3eaee116c96a0c759 /drivers/regulator
parent877fcff03b27220b9777fe9b67534c06f2b6dd25 (diff)
mfd: as3722 Update VSEL access control
- Added an option to mark VSEL registers as volatile by default. This option should be set either in board platform data, or in device tree node of the regulator controlled by hardware mechanism underneath s/w driver. - Replaced volatile registers table with callback that checks access attribute at run-time. Added another callback to switch VSEL registers attributes between volatile and cached. - Set persistent property for VSEL of all SD regulators (persistent value is zero). This would allow to use direct write for setting the voltage selector instead of read-modify-write. Bug 1454969 Change-Id: I9a434fa8568dc2717a81ae6ecf3891abb903befa Signed-off-by: Alex Frid <afrid@nvidia.com> Reviewed-on: http://git-master/r/367357 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/as3722-regulator.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
index 8f8716c1c3f8..f305177411e7 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -85,6 +85,7 @@ struct as3722_register_mapping {
struct as3722_regulator_config_data {
struct regulator_init_data *reg_init;
bool enable_tracking;
+ bool volatile_vsel;
int ext_control;
};
@@ -743,6 +744,8 @@ static int as3722_get_regulator_dt_data(struct platform_device *pdev,
}
reg_config->enable_tracking =
of_property_read_bool(reg_node, "ams,enable-tracking");
+ reg_config->volatile_vsel =
+ of_property_read_bool(reg_node, "ams,volatile-vsel");
}
return 0;
@@ -769,6 +772,7 @@ static int as3722_get_regulator_platform_data(struct platform_device *pdev,
reg_config->reg_init = rpdata->reg_init;
reg_config->ext_control = rpdata->ext_control;
reg_config->enable_tracking = rpdata->enable_tracking;
+ reg_config->volatile_vsel = rpdata->volatile_vsel;
}
return 0;
}
@@ -873,6 +877,7 @@ static int as3722_regulator_probe(struct platform_device *pdev)
as3722_regs->desc[id].uV_step = 10000;
as3722_regs->desc[id].linear_min_sel = 1;
as3722_regs->desc[id].enable_time = 275;
+ as3722_regs->desc[id].vsel_persist = true;
break;
case AS3722_REGULATOR_ID_SD2:
case AS3722_REGULATOR_ID_SD3:
@@ -886,6 +891,7 @@ static int as3722_regulator_probe(struct platform_device *pdev)
as3722_sd2345_ranges;
as3722_regs->desc[id].n_linear_ranges =
ARRAY_SIZE(as3722_sd2345_ranges);
+ as3722_regs->desc[id].vsel_persist = true;
break;
default:
if (reg_config->ext_control)
@@ -904,6 +910,11 @@ static int as3722_regulator_probe(struct platform_device *pdev)
as3722_regs->desc[id].ops = ops;
config.init_data = reg_config->reg_init;
config.of_node = as3722_regulator_matches[id].of_node;
+
+ if (reg_config->volatile_vsel) {
+ unsigned int bit = as3722_reg_lookup[id].vsel_reg;
+ __set_bit(bit, as3722->volatile_vsel_registers);
+ }
rdev = devm_regulator_register(&pdev->dev,
&as3722_regs->desc[id], &config);
if (IS_ERR(rdev)) {