15 #include <linux/kernel.h>
16 #include <linux/module.h>
17 #include <linux/i2c.h>
332 return &wm831x_irqs[irq];
337 struct wm831x *
wm831x = irq_data_get_irq_chip_data(data);
342 static void wm831x_irq_sync_unlock(
struct irq_data *
data)
344 struct wm831x *
wm831x = irq_data_get_irq_chip_data(data);
360 dev_dbg(wm831x->
dev,
"IRQ mask sync: %x = %x\n",
374 static void wm831x_irq_enable(
struct irq_data *data)
376 struct wm831x *wm831x = irq_data_get_irq_chip_data(data);
383 static void wm831x_irq_disable(
struct irq_data *data)
385 struct wm831x *wm831x = irq_data_get_irq_chip_data(data);
392 static int wm831x_irq_set_type(
struct irq_data *data,
unsigned int type)
394 struct wm831x *wm831x = irq_data_get_irq_chip_data(data);
443 static struct irq_chip wm831x_irq_chip = {
445 .irq_bus_lock = wm831x_irq_lock,
446 .irq_bus_sync_unlock = wm831x_irq_sync_unlock,
447 .irq_disable = wm831x_irq_disable,
448 .irq_enable = wm831x_irq_enable,
449 .irq_set_type = wm831x_irq_set_type,
454 static irqreturn_t wm831x_irq_thread(
int irq,
void *data)
456 struct wm831x *wm831x =
data;
465 dev_err(wm831x->
dev,
"Failed to read system interrupt: %d\n",
483 for (i = 0; i <
ARRAY_SIZE(wm831x_irqs); i++) {
486 if (!(primary & wm831x_irqs[i].primary))
489 status = &status_regs[
offset];
494 status_addr = irq_data_to_status_reg(&wm831x_irqs[i]);
499 "Failed to read IRQ status: %d\n",
515 if (*status & wm831x_irqs[i].
mask)
549 static int wm831x_irq_map(
struct irq_domain *
h,
unsigned int virq,
554 irq_set_nested_thread(virq, 1);
561 irq_set_noprobe(virq);
568 .map = wm831x_irq_map,
576 int i,
ret, irq_base;
590 irq_base = irq_alloc_descs(pdata->
irq_base, 0,
593 dev_warn(wm831x->
dev,
"Failed to allocate IRQs: %d\n",
603 ARRAY_SIZE(wm831x_irqs),
605 &wm831x_irq_domain_ops,
609 ARRAY_SIZE(wm831x_irqs),
610 &wm831x_irq_domain_ops,
614 dev_warn(wm831x->
dev,
"Failed to allocate IRQ domain\n");
635 ret = enable_irq_wake(irq);
638 "Can't enable IRQ as wake source: %d\n",
646 dev_err(wm831x->
dev,
"Failed to request IRQ %d: %d\n",
652 "No interrupt specified - functionality limited\n");