diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-03-05 01:17:57 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-05 04:56:40 -0500 |
commit | ea88b132acdf3270b812117f622b0df044e6b76f (patch) | |
tree | 5adbffc156e673dfe34533d247eb89c07e861895 /drivers/regulator/max8649.c | |
parent | 318c658b7c9da58c80aef417e8f51152c604e6bc (diff) |
regulator: max8649: Use enable_is_inverted flag with regulator_enable_regmap and friends APIs
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max8649.c')
-rw-r--r-- | drivers/regulator/max8649.c | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/drivers/regulator/max8649.c b/drivers/regulator/max8649.c index 3ca14380f22d..fdb67ff98129 100644 --- a/drivers/regulator/max8649.c +++ b/drivers/regulator/max8649.c | |||
@@ -60,36 +60,6 @@ struct max8649_regulator_info { | |||
60 | unsigned ramp_down:1; | 60 | unsigned ramp_down:1; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* EN_PD means pulldown on EN input */ | ||
64 | static int max8649_enable(struct regulator_dev *rdev) | ||
65 | { | ||
66 | struct max8649_regulator_info *info = rdev_get_drvdata(rdev); | ||
67 | return regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_EN_PD, 0); | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | * Applied internal pulldown resistor on EN input pin. | ||
72 | * If pulldown EN pin outside, it would be better. | ||
73 | */ | ||
74 | static int max8649_disable(struct regulator_dev *rdev) | ||
75 | { | ||
76 | struct max8649_regulator_info *info = rdev_get_drvdata(rdev); | ||
77 | return regmap_update_bits(info->regmap, MAX8649_CONTROL, MAX8649_EN_PD, | ||
78 | MAX8649_EN_PD); | ||
79 | } | ||
80 | |||
81 | static int max8649_is_enabled(struct regulator_dev *rdev) | ||
82 | { | ||
83 | struct max8649_regulator_info *info = rdev_get_drvdata(rdev); | ||
84 | unsigned int val; | ||
85 | int ret; | ||
86 | |||
87 | ret = regmap_read(info->regmap, MAX8649_CONTROL, &val); | ||
88 | if (ret != 0) | ||
89 | return ret; | ||
90 | return !((unsigned char)val & MAX8649_EN_PD); | ||
91 | } | ||
92 | |||
93 | static int max8649_enable_time(struct regulator_dev *rdev) | 63 | static int max8649_enable_time(struct regulator_dev *rdev) |
94 | { | 64 | { |
95 | struct max8649_regulator_info *info = rdev_get_drvdata(rdev); | 65 | struct max8649_regulator_info *info = rdev_get_drvdata(rdev); |
@@ -151,9 +121,9 @@ static struct regulator_ops max8649_dcdc_ops = { | |||
151 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 121 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
152 | .list_voltage = regulator_list_voltage_linear, | 122 | .list_voltage = regulator_list_voltage_linear, |
153 | .map_voltage = regulator_map_voltage_linear, | 123 | .map_voltage = regulator_map_voltage_linear, |
154 | .enable = max8649_enable, | 124 | .enable = regulator_enable_regmap, |
155 | .disable = max8649_disable, | 125 | .disable = regulator_disable_regmap, |
156 | .is_enabled = max8649_is_enabled, | 126 | .is_enabled = regulator_is_enabled_regmap, |
157 | .enable_time = max8649_enable_time, | 127 | .enable_time = max8649_enable_time, |
158 | .set_mode = max8649_set_mode, | 128 | .set_mode = max8649_set_mode, |
159 | .get_mode = max8649_get_mode, | 129 | .get_mode = max8649_get_mode, |
@@ -169,6 +139,9 @@ static struct regulator_desc dcdc_desc = { | |||
169 | .vsel_mask = MAX8649_VOL_MASK, | 139 | .vsel_mask = MAX8649_VOL_MASK, |
170 | .min_uV = MAX8649_DCDC_VMIN, | 140 | .min_uV = MAX8649_DCDC_VMIN, |
171 | .uV_step = MAX8649_DCDC_STEP, | 141 | .uV_step = MAX8649_DCDC_STEP, |
142 | .enable_reg = MAX8649_CONTROL, | ||
143 | .enable_mask = MAX8649_EN_PD, | ||
144 | .enable_is_inverted = true, | ||
172 | }; | 145 | }; |
173 | 146 | ||
174 | static struct regmap_config max8649_regmap_config = { | 147 | static struct regmap_config max8649_regmap_config = { |