Skip to content

Commit

Permalink
mfd: Add WM831x interrupt support
Browse files Browse the repository at this point in the history
The WM831x includes an interrupt controller managing interrupts for
the various functions on the chip. This patch adds support for the
core interrupt block on the device.

Ideally this would be supported by genirq, particularly for the
GPIOs, but currently genirq is unable to cope with controllers on
interrupt driven buses so we cut'n'paste the generic interface.
Once genirq is able to cope chips like this it should be a case
of filing the prefixes off the code and redoing wm831x-irq.c to
move over.

Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
broonie authored and Samuel Ortiz committed Sep 17, 2009
1 parent d2bedfe commit 7d4d0a3
Show file tree
Hide file tree
Showing 4 changed files with 1,354 additions and 2 deletions.
12 changes: 10 additions & 2 deletions drivers/mfd/wm831x-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include <linux/mfd/wm831x/core.h>
#include <linux/mfd/wm831x/pdata.h>
#include <linux/mfd/wm831x/irq.h>

enum wm831x_parent {
WM8310 = 0,
Expand Down Expand Up @@ -1189,6 +1190,10 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
}
}

ret = wm831x_irq_init(wm831x, irq);
if (ret != 0)
goto err;

/* The core device is up, instantiate the subdevices. */
switch (parent) {
case WM8310:
Expand Down Expand Up @@ -1216,19 +1221,21 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)

if (ret != 0) {
dev_err(wm831x->dev, "Failed to add children\n");
goto err;
goto err_irq;
}

if (pdata && pdata->post_init) {
ret = pdata->post_init(wm831x);
if (ret != 0) {
dev_err(wm831x->dev, "post_init() failed: %d\n", ret);
goto err;
goto err_irq;
}
}

return 0;

err_irq:
wm831x_irq_exit(wm831x);
err:
mfd_remove_devices(wm831x->dev);
kfree(wm831x);
Expand All @@ -1238,6 +1245,7 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
static void wm831x_device_exit(struct wm831x *wm831x)
{
mfd_remove_devices(wm831x->dev);
wm831x_irq_exit(wm831x);
kfree(wm831x);
}

Expand Down
Loading

0 comments on commit 7d4d0a3

Please sign in to comment.