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>
This commit is contained in:
@@ -1440,7 +1440,7 @@ static struct mfd_cell backlight_devs[] = {
|
|||||||
int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
||||||
{
|
{
|
||||||
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
struct wm831x_pdata *pdata = wm831x->dev->platform_data;
|
||||||
int rev;
|
int rev, wm831x_num;
|
||||||
enum wm831x_parent parent;
|
enum wm831x_parent parent;
|
||||||
int ret, i;
|
int ret, i;
|
||||||
|
|
||||||
@@ -1592,6 +1592,12 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Multiply by 10 as we have many subdevices of the same type */
|
||||||
|
if (pdata && pdata->wm831x_num)
|
||||||
|
wm831x_num = pdata->wm831x_num * 10;
|
||||||
|
else
|
||||||
|
wm831x_num = -1;
|
||||||
|
|
||||||
ret = wm831x_irq_init(wm831x, irq);
|
ret = wm831x_irq_init(wm831x, irq);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
goto err;
|
goto err;
|
||||||
@@ -1609,19 +1615,19 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||||||
/* The core device is up, instantiate the subdevices. */
|
/* The core device is up, instantiate the subdevices. */
|
||||||
switch (parent) {
|
switch (parent) {
|
||||||
case WM8310:
|
case WM8310:
|
||||||
ret = mfd_add_devices(wm831x->dev, -1,
|
ret = mfd_add_devices(wm831x->dev, wm831x_num,
|
||||||
wm8310_devs, ARRAY_SIZE(wm8310_devs),
|
wm8310_devs, ARRAY_SIZE(wm8310_devs),
|
||||||
NULL, wm831x->irq_base);
|
NULL, wm831x->irq_base);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM8311:
|
case WM8311:
|
||||||
ret = mfd_add_devices(wm831x->dev, -1,
|
ret = mfd_add_devices(wm831x->dev, wm831x_num,
|
||||||
wm8311_devs, ARRAY_SIZE(wm8311_devs),
|
wm8311_devs, ARRAY_SIZE(wm8311_devs),
|
||||||
NULL, wm831x->irq_base);
|
NULL, wm831x->irq_base);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM8312:
|
case WM8312:
|
||||||
ret = mfd_add_devices(wm831x->dev, -1,
|
ret = mfd_add_devices(wm831x->dev, wm831x_num,
|
||||||
wm8312_devs, ARRAY_SIZE(wm8312_devs),
|
wm8312_devs, ARRAY_SIZE(wm8312_devs),
|
||||||
NULL, wm831x->irq_base);
|
NULL, wm831x->irq_base);
|
||||||
break;
|
break;
|
||||||
@@ -1630,7 +1636,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||||||
case WM8321:
|
case WM8321:
|
||||||
case WM8325:
|
case WM8325:
|
||||||
case WM8326:
|
case WM8326:
|
||||||
ret = mfd_add_devices(wm831x->dev, -1,
|
ret = mfd_add_devices(wm831x->dev, wm831x_num,
|
||||||
wm8320_devs, ARRAY_SIZE(wm8320_devs),
|
wm8320_devs, ARRAY_SIZE(wm8320_devs),
|
||||||
NULL, wm831x->irq_base);
|
NULL, wm831x->irq_base);
|
||||||
break;
|
break;
|
||||||
@@ -1647,7 +1653,7 @@ int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
|
|||||||
|
|
||||||
if (pdata && pdata->backlight) {
|
if (pdata && pdata->backlight) {
|
||||||
/* Treat errors as non-critical */
|
/* Treat errors as non-critical */
|
||||||
ret = mfd_add_devices(wm831x->dev, -1, backlight_devs,
|
ret = mfd_add_devices(wm831x->dev, wm831x_num, backlight_devs,
|
||||||
ARRAY_SIZE(backlight_devs), NULL,
|
ARRAY_SIZE(backlight_devs), NULL,
|
||||||
wm831x->irq_base);
|
wm831x->irq_base);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
Reference in New Issue
Block a user