aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/wm831x-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-06-02 14:18:48 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-07-31 17:28:19 -0400
commiteb503dc16b04d07a42a37892da73c74461fd06da (patch)
treee9636d03bccade215b07aad4abf3da48d9924fcd /drivers/mfd/wm831x-core.c
parentca7a71824ac957b1b9d3322656c05aad38d7275c (diff)
mfd: Implement support for multiple WM831x devices
Systems using this functionality will be uncommon. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/wm831x-core.c')
-rw-r--r--drivers/mfd/wm831x-core.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 265f75fc6a25..04994b23bb6b 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1440,7 +1440,7 @@ static struct mfd_cell backlight_devs[] = {
1440int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) 1440int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1441{ 1441{
1442 struct wm831x_pdata *pdata = wm831x->dev->platform_data; 1442 struct wm831x_pdata *pdata = wm831x->dev->platform_data;
1443 int rev; 1443 int rev, wm831x_num;
1444 enum wm831x_parent parent; 1444 enum wm831x_parent parent;
1445 int ret, i; 1445 int ret, i;
1446 1446
@@ -1592,6 +1592,12 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1592 } 1592 }
1593 } 1593 }
1594 1594
1595 /* Multiply by 10 as we have many subdevices of the same type */
1596 if (pdata && pdata->wm831x_num)
1597 wm831x_num = pdata->wm831x_num * 10;
1598 else
1599 wm831x_num = -1;
1600
1595 ret = wm831x_irq_init(wm831x, irq); 1601 ret = wm831x_irq_init(wm831x, irq);
1596 if (ret != 0) 1602 if (ret != 0)
1597 goto err; 1603 goto err;
@@ -1609,19 +1615,19 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1609 /* The core device is up, instantiate the subdevices. */ 1615 /* The core device is up, instantiate the subdevices. */
1610 switch (parent) { 1616 switch (parent) {
1611 case WM8310: 1617 case WM8310:
1612 ret = mfd_add_devices(wm831x->dev, -1, 1618 ret = mfd_add_devices(wm831x->dev, wm831x_num,
1613 wm8310_devs, ARRAY_SIZE(wm8310_devs), 1619 wm8310_devs, ARRAY_SIZE(wm8310_devs),
1614 NULL, wm831x->irq_base); 1620 NULL, wm831x->irq_base);
1615 break; 1621 break;
1616 1622
1617 case WM8311: 1623 case WM8311:
1618 ret = mfd_add_devices(wm831x->dev, -1, 1624 ret = mfd_add_devices(wm831x->dev, wm831x_num,
1619 wm8311_devs, ARRAY_SIZE(wm8311_devs), 1625 wm8311_devs, ARRAY_SIZE(wm8311_devs),
1620 NULL, wm831x->irq_base); 1626 NULL, wm831x->irq_base);
1621 break; 1627 break;
1622 1628
1623 case WM8312: 1629 case WM8312:
1624 ret = mfd_add_devices(wm831x->dev, -1, 1630 ret = mfd_add_devices(wm831x->dev, wm831x_num,
1625 wm8312_devs, ARRAY_SIZE(wm8312_devs), 1631 wm8312_devs, ARRAY_SIZE(wm8312_devs),
1626 NULL, wm831x->irq_base); 1632 NULL, wm831x->irq_base);
1627 break; 1633 break;
@@ -1630,7 +1636,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1630 case WM8321: 1636 case WM8321:
1631 case WM8325: 1637 case WM8325:
1632 case WM8326: 1638 case WM8326:
1633 ret = mfd_add_devices(wm831x->dev, -1, 1639 ret = mfd_add_devices(wm831x->dev, wm831x_num,
1634 wm8320_devs, ARRAY_SIZE(wm8320_devs), 1640 wm8320_devs, ARRAY_SIZE(wm8320_devs),
1635 NULL, wm831x->irq_base); 1641 NULL, wm831x->irq_base);
1636 break; 1642 break;
@@ -1647,7 +1653,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
1647 1653
1648 if (pdata && pdata->backlight) { 1654 if (pdata && pdata->backlight) {
1649 /* Treat errors as non-critical */ 1655 /* Treat errors as non-critical */
1650 ret = mfd_add_devices(wm831x->dev, -1, backlight_devs, 1656 ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs,
1651 ARRAY_SIZE(backlight_devs), NULL, 1657 ARRAY_SIZE(backlight_devs), NULL,
1652 wm831x->irq_base); 1658 wm831x->irq_base);
1653 if (ret < 0) 1659 if (ret < 0)