aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm8994-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-07 22:21:09 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-11-23 07:10:13 -0500
commita8a8fc287dd7497b3adb2f2952513849ab6506eb (patch)
tree1a4a94ee51dd4a3fa84142e97ebf3f1e60f4cb94 /drivers/mfd/wm8994-core.c
parentcd22000ade0cf023da30031b51ca810a5b6b1b8d (diff)
mfd: wm8994: Store platform data in device
This is better style as platform data is supposed to be discardable after init (though hotplug usually prevents this) and will ease implementation of device tree property bindings. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com>
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 8fefc961ec06..45a20c573aa3 100644
--- a/drivers/mfd/wm8994-core.c
+++ b/drivers/mfd/wm8994-core.c
@@ -401,13 +401,19 @@ static const __devinitconst struct reg_default wm1811_reva_patch[] = {
401 */ 401 */
402static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq) 402static __devinit 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 __devinit 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,