Lines Matching +full:reg +full:- +full:data
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm8350-irq.c -- IRQ support for Wolfson WM8350
36 int reg; member
44 .reg = WM8350_OVER_CURRENT_INT_OFFSET,
50 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
55 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
60 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
65 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
70 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
75 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
80 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
85 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
90 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
95 .reg = WM8350_UNDER_VOLTAGE_INT_OFFSET,
100 .reg = WM8350_INT_OFFSET_1,
105 .reg = WM8350_INT_OFFSET_1,
110 .reg = WM8350_INT_OFFSET_1,
115 .reg = WM8350_INT_OFFSET_1,
120 .reg = WM8350_INT_OFFSET_1,
125 .reg = WM8350_INT_OFFSET_1,
130 .reg = WM8350_INT_OFFSET_1,
135 .reg = WM8350_INT_OFFSET_1,
140 .reg = WM8350_INT_OFFSET_1,
145 .reg = WM8350_INT_OFFSET_1,
150 .reg = WM8350_INT_OFFSET_1,
155 .reg = WM8350_INT_OFFSET_1,
160 .reg = WM8350_INT_OFFSET_1,
165 .reg = WM8350_INT_OFFSET_2,
170 .reg = WM8350_INT_OFFSET_2,
175 .reg = WM8350_INT_OFFSET_2,
180 .reg = WM8350_INT_OFFSET_2,
185 .reg = WM8350_INT_OFFSET_2,
190 .reg = WM8350_INT_OFFSET_2,
195 .reg = WM8350_INT_OFFSET_2,
200 .reg = WM8350_INT_OFFSET_2,
205 .reg = WM8350_INT_OFFSET_2,
210 .reg = WM8350_INT_OFFSET_2,
215 .reg = WM8350_INT_OFFSET_2,
220 .reg = WM8350_INT_OFFSET_2,
226 .reg = WM8350_COMPARATOR_INT_OFFSET,
231 .reg = WM8350_COMPARATOR_INT_OFFSET,
236 .reg = WM8350_COMPARATOR_INT_OFFSET,
241 .reg = WM8350_COMPARATOR_INT_OFFSET,
246 .reg = WM8350_COMPARATOR_INT_OFFSET,
251 .reg = WM8350_COMPARATOR_INT_OFFSET,
256 .reg = WM8350_COMPARATOR_INT_OFFSET,
261 .reg = WM8350_COMPARATOR_INT_OFFSET,
266 .reg = WM8350_COMPARATOR_INT_OFFSET,
271 .reg = WM8350_COMPARATOR_INT_OFFSET,
276 .reg = WM8350_COMPARATOR_INT_OFFSET,
281 .reg = WM8350_COMPARATOR_INT_OFFSET,
286 .reg = WM8350_COMPARATOR_INT_OFFSET,
291 .reg = WM8350_COMPARATOR_INT_OFFSET,
296 .reg = WM8350_GPIO_INT_OFFSET,
301 .reg = WM8350_GPIO_INT_OFFSET,
306 .reg = WM8350_GPIO_INT_OFFSET,
311 .reg = WM8350_GPIO_INT_OFFSET,
316 .reg = WM8350_GPIO_INT_OFFSET,
321 .reg = WM8350_GPIO_INT_OFFSET,
326 .reg = WM8350_GPIO_INT_OFFSET,
331 .reg = WM8350_GPIO_INT_OFFSET,
336 .reg = WM8350_GPIO_INT_OFFSET,
341 .reg = WM8350_GPIO_INT_OFFSET,
346 .reg = WM8350_GPIO_INT_OFFSET,
351 .reg = WM8350_GPIO_INT_OFFSET,
356 .reg = WM8350_GPIO_INT_OFFSET,
364 return &wm8350_irqs[irq - wm8350->irq_base]; in irq_to_wm8350_irq()
371 * asserted while we run - in the normal course of events this is a
382 struct wm8350_irq_data *data; in wm8350_irq() local
394 data = &wm8350_irqs[i]; in wm8350_irq()
396 if (!(level_one & data->primary)) in wm8350_irq()
399 if (!read_done[data->reg]) { in wm8350_irq()
400 sub_reg[data->reg] = in wm8350_irq()
402 data->reg); in wm8350_irq()
403 sub_reg[data->reg] &= ~wm8350->irq_masks[data->reg]; in wm8350_irq()
404 read_done[data->reg] = 1; in wm8350_irq()
407 if (sub_reg[data->reg] & data->mask) in wm8350_irq()
408 handle_nested_irq(wm8350->irq_base + i); in wm8350_irq()
414 static void wm8350_irq_lock(struct irq_data *data) in wm8350_irq_lock() argument
416 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); in wm8350_irq_lock()
418 mutex_lock(&wm8350->irq_lock); in wm8350_irq_lock()
421 static void wm8350_irq_sync_unlock(struct irq_data *data) in wm8350_irq_sync_unlock() argument
423 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); in wm8350_irq_sync_unlock()
426 for (i = 0; i < ARRAY_SIZE(wm8350->irq_masks); i++) { in wm8350_irq_sync_unlock()
429 WARN_ON(regmap_update_bits(wm8350->regmap, in wm8350_irq_sync_unlock()
431 0xffff, wm8350->irq_masks[i])); in wm8350_irq_sync_unlock()
434 mutex_unlock(&wm8350->irq_lock); in wm8350_irq_sync_unlock()
437 static void wm8350_irq_enable(struct irq_data *data) in wm8350_irq_enable() argument
439 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); in wm8350_irq_enable()
441 data->irq); in wm8350_irq_enable()
443 wm8350->irq_masks[irq_data->reg] &= ~irq_data->mask; in wm8350_irq_enable()
446 static void wm8350_irq_disable(struct irq_data *data) in wm8350_irq_disable() argument
448 struct wm8350 *wm8350 = irq_data_get_irq_chip_data(data); in wm8350_irq_disable()
450 data->irq); in wm8350_irq_disable()
452 wm8350->irq_masks[irq_data->reg] |= irq_data->mask; in wm8350_irq_disable()
468 int irq_base = -1; in wm8350_irq_init()
471 dev_warn(wm8350->dev, "No interrupt support, no core IRQ\n"); in wm8350_irq_init()
481 for (i = 0; i < ARRAY_SIZE(wm8350->irq_masks); i++) { in wm8350_irq_init()
484 wm8350->irq_masks[i] = in wm8350_irq_init()
489 mutex_init(&wm8350->irq_lock); in wm8350_irq_init()
490 wm8350->chip_irq = irq; in wm8350_irq_init()
492 if (pdata && pdata->irq_base > 0) in wm8350_irq_init()
493 irq_base = pdata->irq_base; in wm8350_irq_init()
495 wm8350->irq_base = in wm8350_irq_init()
497 if (wm8350->irq_base < 0) { in wm8350_irq_init()
498 dev_warn(wm8350->dev, "Allocating irqs failed with %d\n", in wm8350_irq_init()
499 wm8350->irq_base); in wm8350_irq_init()
503 if (pdata && pdata->irq_high) { in wm8350_irq_init()
516 for (cur_irq = wm8350->irq_base; in wm8350_irq_init()
517 cur_irq < ARRAY_SIZE(wm8350_irqs) + wm8350->irq_base; in wm8350_irq_init()
530 dev_err(wm8350->dev, "Failed to request IRQ: %d\n", ret); in wm8350_irq_init()
540 free_irq(wm8350->chip_irq, wm8350); in wm8350_irq_exit()