aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8994-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/wm8994-core.c')
-rw-r--r--drivers/mfd/wm8994-core.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c
index c7f62ac544ad..bcb226ff9d2b 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -401,13 +401,19 @@ static const struct reg_default wm1811_reva_patch[] = {
401 */ 401 */
402static int wm8994_device_init(struct wm8994 *wm8994, int irq) 402static int wm8994_device_init(struct wm8994 *wm8994, int irq)
403{ 403{
404 struct wm8994_pdata *pdata = wm8994->dev->platform_data; 404 struct wm8994_pdata *pdata;
405 struct regmap_config *regmap_config; 405 struct regmap_config *regmap_config;
406 const struct reg_default *regmap_patch = NULL; 406 const struct reg_default *regmap_patch = NULL;
407 const char *devname; 407 const char *devname;
408 int ret, i, patch_regs; 408 int ret, i, patch_regs;
409 int pulls = 0; 409 int pulls = 0;
410 410
411 if (dev_get_platdata(wm8994->dev)) {
412 pdata = dev_get_platdata(wm8994->dev);
413 wm8994->pdata = *pdata;
414 }
415 pdata = &wm8994->pdata;
416
411 dev_set_drvdata(wm8994->dev, wm8994); 417 dev_set_drvdata(wm8994->dev, wm8994);
412 418
413 /* Add the on-chip regulators first for bootstrapping */ 419 /* Add the on-chip regulators first for bootstrapping */
@@ -604,24 +610,21 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq)
604 } 610 }
605 } 611 }
606 612
607 if (pdata) { 613 wm8994->irq_base = pdata->irq_base;
608 wm8994->irq_base = pdata->irq_base; 614 wm8994->gpio_base = pdata->gpio_base;
609 wm8994->gpio_base = pdata->gpio_base; 615
610 616 /* GPIO configuration is only applied if it's non-zero */
611 /* GPIO configuration is only applied if it's non-zero */ 617 for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) {
612 for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) { 618 if (pdata->gpio_defaults[i]) {
613 if (pdata->gpio_defaults[i]) { 619 wm8994_set_bits(wm8994, WM8994_GPIO_1 + i,
614 wm8994_set_bits(wm8994, WM8994_GPIO_1 + i, 620 0xffff, pdata->gpio_defaults[i]);
615 0xffff,
616 pdata->gpio_defaults[i]);
617 }
618 } 621 }
622 }
619 623
620 wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven; 624 wm8994->ldo_ena_always_driven = pdata->ldo_ena_always_driven;
621 625
622 if (pdata->spkmode_pu) 626 if (pdata->spkmode_pu)
623 pulls |= WM8994_SPKMODE_PU; 627 pulls |= WM8994_SPKMODE_PU;
624 }
625 628
626 /* Disable unneeded pulls */ 629 /* Disable unneeded pulls */
627 wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2, 630 wm8994_set_bits(wm8994, WM8994_PULL_CONTROL_2,