aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/arizona-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/arizona-core.c')
-rw-r--r--drivers/mfd/arizona-core.c55
1 files changed, 52 insertions, 3 deletions
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c
index 222c03a5ddc0..b562c7bf8a46 100644
--- a/drivers/mfd/arizona-core.c
+++ b/drivers/mfd/arizona-core.c
@@ -115,7 +115,7 @@ static irqreturn_t arizona_underclocked(int irq, void *data)
115 if (val & ARIZONA_ADC_UNDERCLOCKED_STS) 115 if (val & ARIZONA_ADC_UNDERCLOCKED_STS)
116 dev_err(arizona->dev, "ADC underclocked\n"); 116 dev_err(arizona->dev, "ADC underclocked\n");
117 if (val & ARIZONA_MIXER_UNDERCLOCKED_STS) 117 if (val & ARIZONA_MIXER_UNDERCLOCKED_STS)
118 dev_err(arizona->dev, "Mixer underclocked\n"); 118 dev_err(arizona->dev, "Mixer dropped sample\n");
119 119
120 return IRQ_HANDLED; 120 return IRQ_HANDLED;
121} 121}
@@ -263,10 +263,36 @@ static int arizona_runtime_suspend(struct device *dev)
263} 263}
264#endif 264#endif
265 265
266#ifdef CONFIG_PM_SLEEP
267static int arizona_resume_noirq(struct device *dev)
268{
269 struct arizona *arizona = dev_get_drvdata(dev);
270
271 dev_dbg(arizona->dev, "Early resume, disabling IRQ\n");
272 disable_irq(arizona->irq);
273
274 return 0;
275}
276
277static int arizona_resume(struct device *dev)
278{
279 struct arizona *arizona = dev_get_drvdata(dev);
280
281 dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n");
282 enable_irq(arizona->irq);
283
284 return 0;
285}
286#endif
287
266const struct dev_pm_ops arizona_pm_ops = { 288const struct dev_pm_ops arizona_pm_ops = {
267 SET_RUNTIME_PM_OPS(arizona_runtime_suspend, 289 SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
268 arizona_runtime_resume, 290 arizona_runtime_resume,
269 NULL) 291 NULL)
292 SET_SYSTEM_SLEEP_PM_OPS(NULL, arizona_resume)
293#ifdef CONFIG_PM_SLEEP
294 .resume_noirq = arizona_resume_noirq,
295#endif
270}; 296};
271EXPORT_SYMBOL_GPL(arizona_pm_ops); 297EXPORT_SYMBOL_GPL(arizona_pm_ops);
272 298
@@ -275,19 +301,19 @@ static struct mfd_cell early_devs[] = {
275}; 301};
276 302
277static struct mfd_cell wm5102_devs[] = { 303static struct mfd_cell wm5102_devs[] = {
304 { .name = "arizona-micsupp" },
278 { .name = "arizona-extcon" }, 305 { .name = "arizona-extcon" },
279 { .name = "arizona-gpio" }, 306 { .name = "arizona-gpio" },
280 { .name = "arizona-haptics" }, 307 { .name = "arizona-haptics" },
281 { .name = "arizona-micsupp" },
282 { .name = "arizona-pwm" }, 308 { .name = "arizona-pwm" },
283 { .name = "wm5102-codec" }, 309 { .name = "wm5102-codec" },
284}; 310};
285 311
286static struct mfd_cell wm5110_devs[] = { 312static struct mfd_cell wm5110_devs[] = {
313 { .name = "arizona-micsupp" },
287 { .name = "arizona-extcon" }, 314 { .name = "arizona-extcon" },
288 { .name = "arizona-gpio" }, 315 { .name = "arizona-gpio" },
289 { .name = "arizona-haptics" }, 316 { .name = "arizona-haptics" },
290 { .name = "arizona-micsupp" },
291 { .name = "arizona-pwm" }, 317 { .name = "arizona-pwm" },
292 { .name = "wm5110-codec" }, 318 { .name = "wm5110-codec" },
293}; 319};
@@ -484,6 +510,29 @@ int arizona_dev_init(struct arizona *arizona)
484 goto err_reset; 510 goto err_reset;
485 } 511 }
486 512
513 for (i = 0; i < ARIZONA_MAX_MICBIAS; i++) {
514 if (!arizona->pdata.micbias[i].mV)
515 continue;
516
517 val = (arizona->pdata.micbias[i].mV - 1500) / 100;
518 val <<= ARIZONA_MICB1_LVL_SHIFT;
519
520 if (arizona->pdata.micbias[i].ext_cap)
521 val |= ARIZONA_MICB1_EXT_CAP;
522
523 if (arizona->pdata.micbias[i].discharge)
524 val |= ARIZONA_MICB1_DISCH;
525
526 if (arizona->pdata.micbias[i].fast_start)
527 val |= ARIZONA_MICB1_RATE;
528
529 regmap_update_bits(arizona->regmap,
530 ARIZONA_MIC_BIAS_CTRL_1 + i,
531 ARIZONA_MICB1_LVL_MASK |
532 ARIZONA_MICB1_DISCH |
533 ARIZONA_MICB1_RATE, val);
534 }
535
487 for (i = 0; i < ARIZONA_MAX_INPUT; i++) { 536 for (i = 0; i < ARIZONA_MAX_INPUT; i++) {
488 /* Default for both is 0 so noop with defaults */ 537 /* Default for both is 0 so noop with defaults */
489 val = arizona->pdata.dmic_ref[i] 538 val = arizona->pdata.dmic_ref[i]