diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2013-11-15 08:48:23 -0500 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-11-15 09:26:54 -0500 |
commit | d2e7491e24e47aa0305455031fc1b9ea1f97b555 (patch) | |
tree | 5f523d867192473f61760aa105925cebf8b8ad88 /drivers/regulator/arizona-micsupp.c | |
parent | d4d5cef649d1042454c286474343cec50ff1cb60 (diff) |
regulator: arizona-micsupp: Correct wm5110 voltage selection
wm5110 provides different voltage configurations than the other Arizona
parts, this patch adds support for this into the regulator driver. Also
fixup the default for the configuration register for wm5110.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org (v3.12)
Diffstat (limited to 'drivers/regulator/arizona-micsupp.c')
-rw-r--r-- | drivers/regulator/arizona-micsupp.c | 54 |
1 files changed, 52 insertions, 2 deletions
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index 724706a97dc4..fd3154d86901 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c | |||
@@ -174,6 +174,33 @@ static const struct regulator_desc arizona_micsupp = { | |||
174 | .owner = THIS_MODULE, | 174 | .owner = THIS_MODULE, |
175 | }; | 175 | }; |
176 | 176 | ||
177 | static const struct regulator_linear_range arizona_micsupp_ext_ranges[] = { | ||
178 | REGULATOR_LINEAR_RANGE(900000, 0, 0x14, 25000), | ||
179 | REGULATOR_LINEAR_RANGE(1500000, 0x15, 0x27, 100000), | ||
180 | }; | ||
181 | |||
182 | static const struct regulator_desc arizona_micsupp_ext = { | ||
183 | .name = "MICVDD", | ||
184 | .supply_name = "CPVDD", | ||
185 | .type = REGULATOR_VOLTAGE, | ||
186 | .n_voltages = 40, | ||
187 | .ops = &arizona_micsupp_ops, | ||
188 | |||
189 | .vsel_reg = ARIZONA_LDO2_CONTROL_1, | ||
190 | .vsel_mask = ARIZONA_LDO2_VSEL_MASK, | ||
191 | .enable_reg = ARIZONA_MIC_CHARGE_PUMP_1, | ||
192 | .enable_mask = ARIZONA_CPMIC_ENA, | ||
193 | .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, | ||
194 | .bypass_mask = ARIZONA_CPMIC_BYPASS, | ||
195 | |||
196 | .linear_ranges = arizona_micsupp_ext_ranges, | ||
197 | .n_linear_ranges = ARRAY_SIZE(arizona_micsupp_ext_ranges), | ||
198 | |||
199 | .enable_time = 3000, | ||
200 | |||
201 | .owner = THIS_MODULE, | ||
202 | }; | ||
203 | |||
177 | static const struct regulator_init_data arizona_micsupp_default = { | 204 | static const struct regulator_init_data arizona_micsupp_default = { |
178 | .constraints = { | 205 | .constraints = { |
179 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | | 206 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | |
@@ -186,9 +213,22 @@ static const struct regulator_init_data arizona_micsupp_default = { | |||
186 | .num_consumer_supplies = 1, | 213 | .num_consumer_supplies = 1, |
187 | }; | 214 | }; |
188 | 215 | ||
216 | static const struct regulator_init_data arizona_micsupp_ext_default = { | ||
217 | .constraints = { | ||
218 | .valid_ops_mask = REGULATOR_CHANGE_STATUS | | ||
219 | REGULATOR_CHANGE_VOLTAGE | | ||
220 | REGULATOR_CHANGE_BYPASS, | ||
221 | .min_uV = 900000, | ||
222 | .max_uV = 3300000, | ||
223 | }, | ||
224 | |||
225 | .num_consumer_supplies = 1, | ||
226 | }; | ||
227 | |||
189 | static int arizona_micsupp_probe(struct platform_device *pdev) | 228 | static int arizona_micsupp_probe(struct platform_device *pdev) |
190 | { | 229 | { |
191 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); | 230 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
231 | const struct regulator_desc *desc; | ||
192 | struct regulator_config config = { }; | 232 | struct regulator_config config = { }; |
193 | struct arizona_micsupp *micsupp; | 233 | struct arizona_micsupp *micsupp; |
194 | int ret; | 234 | int ret; |
@@ -207,7 +247,17 @@ static int arizona_micsupp_probe(struct platform_device *pdev) | |||
207 | * default init_data for it. This will be overridden with | 247 | * default init_data for it. This will be overridden with |
208 | * platform data if provided. | 248 | * platform data if provided. |
209 | */ | 249 | */ |
210 | micsupp->init_data = arizona_micsupp_default; | 250 | switch (arizona->type) { |
251 | case WM5110: | ||
252 | desc = &arizona_micsupp_ext; | ||
253 | micsupp->init_data = arizona_micsupp_ext_default; | ||
254 | break; | ||
255 | default: | ||
256 | desc = &arizona_micsupp; | ||
257 | micsupp->init_data = arizona_micsupp_default; | ||
258 | break; | ||
259 | } | ||
260 | |||
211 | micsupp->init_data.consumer_supplies = &micsupp->supply; | 261 | micsupp->init_data.consumer_supplies = &micsupp->supply; |
212 | micsupp->supply.supply = "MICVDD"; | 262 | micsupp->supply.supply = "MICVDD"; |
213 | micsupp->supply.dev_name = dev_name(arizona->dev); | 263 | micsupp->supply.dev_name = dev_name(arizona->dev); |
@@ -226,7 +276,7 @@ static int arizona_micsupp_probe(struct platform_device *pdev) | |||
226 | ARIZONA_CPMIC_BYPASS, 0); | 276 | ARIZONA_CPMIC_BYPASS, 0); |
227 | 277 | ||
228 | micsupp->regulator = devm_regulator_register(&pdev->dev, | 278 | micsupp->regulator = devm_regulator_register(&pdev->dev, |
229 | &arizona_micsupp, | 279 | desc, |
230 | &config); | 280 | &config); |
231 | if (IS_ERR(micsupp->regulator)) { | 281 | if (IS_ERR(micsupp->regulator)) { |
232 | ret = PTR_ERR(micsupp->regulator); | 282 | ret = PTR_ERR(micsupp->regulator); |