aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-03 22:04:42 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-05-26 13:45:18 -0400
commit0b14c22ea1e0226d894df76176971d06e8886aa7 (patch)
tree1d7ee5b2bc74607c4d328e14c30692114fafe5f4 /drivers/mfd
parent8997619a045bef5d138f0f45141a398557f809e6 (diff)
mfd: Provide platform data for WM831x GPIO configuration
Allow the GPIO mode of WM831x devices to be configured using platform data. Users may provide a table of GPIO register values in gpio_defaults[]. In order to allow 0 to be set explicitly out of range values are accepted and masked off, with a WM831X_GPIO_CONFIGURE define provided to set an out of range value. This can be used to configure higher numbered GPIOs or override values set in OTP for GPIOs configured using OTP. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/wm831x-core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 3fe9a58fe6c7..265f75fc6a25 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1442,7 +1442,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1442 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 1442 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
1443 int rev; 1443 int rev;
1444 enum wm831x_parent parent; 1444 enum wm831x_parent parent;
1445 int ret; 1445 int ret, i;
1446 1446
1447 mutex_init(&wm831x->io_lock); 1447 mutex_init(&wm831x->io_lock);
1448 mutex_init(&wm831x->key_lock); 1448 mutex_init(&wm831x->key_lock);
@@ -1581,6 +1581,17 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1581 } 1581 }
1582 } 1582 }
1583 1583
1584 if (pdata) {
1585 for (i = 0; i < ARRAY_SIZE(pdata->gpio_defaults); i++) {
1586 if (!pdata->gpio_defaults[i])
1587 continue;
1588
1589 wm831x_reg_write(wm831x,
1590 WM831X_GPIO1_CONTROL + i,
1591 pdata->gpio_defaults[i] & 0xffff);
1592 }
1593 }
1594
1584 ret = wm831x_irq_init(wm831x, irq); 1595 ret = wm831x_irq_init(wm831x, irq);
1585 if (ret != 0) 1596 if (ret != 0)
1586 goto err; 1597 goto err;