aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mfd/wm8994-core.c35
-rw-r--r--include/linux/mfd/wm8994/core.h4
2 files changed, 23 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,
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index 1f173306bf05..ae5c249530b4 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -19,6 +19,8 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/regmap.h> 20#include <linux/regmap.h>
21 21
22#include <linux/mfd/wm8994/pdata.h>
23
22enum wm8994_type { 24enum wm8994_type {
23 WM8994 = 0, 25 WM8994 = 0,
24 WM8958 = 1, 26 WM8958 = 1,
@@ -55,6 +57,8 @@ struct regulator_bulk_data;
55struct wm8994 { 57struct wm8994 {
56 struct mutex irq_lock; 58 struct mutex irq_lock;
57 59
60 struct wm8994_pdata pdata;
61
58 enum wm8994_type type; 62 enum wm8994_type type;
59 int revision; 63 int revision;
60 int cust_id; 64 int cust_id;