aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max77686.c
diff options
context:
space:
mode:
authorYadwinder Singh Brar <yadi.brar@samsung.com>2012-10-16 07:54:18 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-17 09:16:21 -0400
commit6d2c896b72322ccca465b57123e66890ebddb0ab (patch)
tree77b2bd9b30c1b9b55e8be1d8ef412a198901356b /drivers/regulator/max77686.c
parentddffeb8c4d0331609ef2581d84de4d763607bd37 (diff)
regulator: max77686: Use already set opmode while re-enabling regulators.
This patch adds basic support to take care of opmode(if any) which can be set by set_suspend_[disable/mode] callbacks. Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max77686.c')
-rw-r--r--drivers/regulator/max77686.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index 2a67d08658ad..20dae7b95d38 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -67,8 +67,18 @@ enum max77686_ramp_rate {
67 67
68struct max77686_data { 68struct max77686_data {
69 struct regulator_dev *rdev[MAX77686_REGULATORS]; 69 struct regulator_dev *rdev[MAX77686_REGULATORS];
70 unsigned int opmode[MAX77686_REGULATORS];
70}; 71};
71 72
73int max77686_enable(struct regulator_dev *rdev)
74{
75 struct max77686_data *max77686 = rdev_get_drvdata(rdev);
76
77 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
78 rdev->desc->enable_mask,
79 max77686->opmode[rdev->desc->id]);
80}
81
72static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) 82static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
73{ 83{
74 unsigned int ramp_value = RAMP_RATE_NO_CTRL; 84 unsigned int ramp_value = RAMP_RATE_NO_CTRL;
@@ -98,7 +108,7 @@ static struct regulator_ops max77686_ops = {
98 .list_voltage = regulator_list_voltage_linear, 108 .list_voltage = regulator_list_voltage_linear,
99 .map_voltage = regulator_map_voltage_linear, 109 .map_voltage = regulator_map_voltage_linear,
100 .is_enabled = regulator_is_enabled_regmap, 110 .is_enabled = regulator_is_enabled_regmap,
101 .enable = regulator_enable_regmap, 111 .enable = max77686_enable,
102 .disable = regulator_disable_regmap, 112 .disable = regulator_disable_regmap,
103 .get_voltage_sel = regulator_get_voltage_sel_regmap, 113 .get_voltage_sel = regulator_get_voltage_sel_regmap,
104 .set_voltage_sel = regulator_set_voltage_sel_regmap, 114 .set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -109,7 +119,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
109 .list_voltage = regulator_list_voltage_linear, 119 .list_voltage = regulator_list_voltage_linear,
110 .map_voltage = regulator_map_voltage_linear, 120 .map_voltage = regulator_map_voltage_linear,
111 .is_enabled = regulator_is_enabled_regmap, 121 .is_enabled = regulator_is_enabled_regmap,
112 .enable = regulator_enable_regmap, 122 .enable = max77686_enable,
113 .disable = regulator_disable_regmap, 123 .disable = regulator_disable_regmap,
114 .get_voltage_sel = regulator_get_voltage_sel_regmap, 124 .get_voltage_sel = regulator_get_voltage_sel_regmap,
115 .set_voltage_sel = regulator_set_voltage_sel_regmap, 125 .set_voltage_sel = regulator_set_voltage_sel_regmap,
@@ -314,12 +324,14 @@ static __devinit int max77686_pmic_probe(struct platform_device *pdev)
314 324
315 config.dev = &pdev->dev; 325 config.dev = &pdev->dev;
316 config.regmap = iodev->regmap; 326 config.regmap = iodev->regmap;
327 config.driver_data = max77686;
317 platform_set_drvdata(pdev, max77686); 328 platform_set_drvdata(pdev, max77686);
318 329
319 for (i = 0; i < MAX77686_REGULATORS; i++) { 330 for (i = 0; i < MAX77686_REGULATORS; i++) {
320 config.init_data = pdata->regulators[i].initdata; 331 config.init_data = pdata->regulators[i].initdata;
321 config.of_node = pdata->regulators[i].of_node; 332 config.of_node = pdata->regulators[i].of_node;
322 333
334 max77686->opmode[i] = regulators[i].enable_mask;
323 max77686->rdev[i] = regulator_register(&regulators[i], &config); 335 max77686->rdev[i] = regulator_register(&regulators[i], &config);
324 if (IS_ERR(max77686->rdev[i])) { 336 if (IS_ERR(max77686->rdev[i])) {
325 ret = PTR_ERR(max77686->rdev[i]); 337 ret = PTR_ERR(max77686->rdev[i]);