aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/arizona-micsupp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/arizona-micsupp.c')
-rw-r--r--drivers/regulator/arizona-micsupp.c54
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
177static 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
182static 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
177static const struct regulator_init_data arizona_micsupp_default = { 204static 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
216static 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
189static int arizona_micsupp_probe(struct platform_device *pdev) 228static 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);