15 #include <linux/kernel.h>
16 #include <linux/module.h>
19 #include <linux/device.h>
32 #define WM8350_INT_OFFSET_1 0
33 #define WM8350_INT_OFFSET_2 1
34 #define WM8350_POWER_UP_INT_OFFSET 2
35 #define WM8350_UNDER_VOLTAGE_INT_OFFSET 3
36 #define WM8350_OVER_CURRENT_INT_OFFSET 4
37 #define WM8350_GPIO_INT_OFFSET 5
38 #define WM8350_COMPARATOR_INT_OFFSET 6
370 return &wm8350_irqs[irq - wm8350->
irq_base];
397 memset(&read_done, 0,
sizeof(read_done));
399 for (i = 0; i <
ARRAY_SIZE(wm8350_irqs); i++) {
400 data = &wm8350_irqs[
i];
402 if (!(level_one & data->
primary))
405 if (!read_done[data->
reg]) {
410 read_done[data->
reg] = 1;
413 if (sub_reg[data->
reg] & data->
mask)
420 static void wm8350_irq_lock(
struct irq_data *data)
422 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data);
427 static void wm8350_irq_sync_unlock(
struct irq_data *data)
429 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data);
443 static void wm8350_irq_enable(
struct irq_data *data)
445 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data);
452 static void wm8350_irq_disable(
struct irq_data *data)
454 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data);
461 static struct irq_chip wm8350_irq_chip = {
463 .irq_bus_lock = wm8350_irq_lock,
464 .irq_bus_sync_unlock = wm8350_irq_sync_unlock,
465 .irq_disable = wm8350_irq_disable,
466 .irq_enable = wm8350_irq_enable,
477 dev_warn(wm8350->
dev,
"No interrupt support, no core IRQ\n");
503 dev_warn(wm8350->
dev,
"Allocating irqs failed with %d\n",
522 cur_irq < ARRAY_SIZE(wm8350_irqs) + wm8350->
irq_base;
525 irq_set_chip_and_handler(cur_irq, &wm8350_irq_chip,
527 irq_set_nested_thread(cur_irq, 1);
534 irq_set_noprobe(cur_irq);
541 dev_err(wm8350->
dev,
"Failed to request IRQ: %d\n", ret);