17
17
#include <linux/slab.h>
18
18
#include <linux/gpio/driver.h>
19
19
#include <linux/bitops.h>
20
+ #include <linux/seq_file.h>
20
21
21
22
#define EP93XX_GPIO_F_INT_STATUS 0x5c
22
23
#define EP93XX_GPIO_A_INT_STATUS 0xa0
40
41
#define EP93XX_GPIO_F_IRQ_BASE 80
41
42
42
43
struct ep93xx_gpio_irq_chip {
43
- struct irq_chip ic ;
44
44
u8 irq_offset ;
45
45
u8 int_unmasked ;
46
46
u8 int_enabled ;
@@ -185,6 +185,7 @@ static void ep93xx_gpio_irq_mask_ack(struct irq_data *d)
185
185
ep93xx_gpio_update_int_params (epg , eic );
186
186
187
187
writeb (port_mask , epg -> base + eic -> irq_offset + EP93XX_INT_EOI_OFFSET );
188
+ gpiochip_disable_irq (gc , irqd_to_hwirq (d ));
188
189
}
189
190
190
191
static void ep93xx_gpio_irq_mask (struct irq_data * d )
@@ -195,6 +196,7 @@ static void ep93xx_gpio_irq_mask(struct irq_data *d)
195
196
196
197
eic -> int_unmasked &= ~BIT (d -> irq & 7 );
197
198
ep93xx_gpio_update_int_params (epg , eic );
199
+ gpiochip_disable_irq (gc , irqd_to_hwirq (d ));
198
200
}
199
201
200
202
static void ep93xx_gpio_irq_unmask (struct irq_data * d )
@@ -203,6 +205,7 @@ static void ep93xx_gpio_irq_unmask(struct irq_data *d)
203
205
struct ep93xx_gpio_irq_chip * eic = to_ep93xx_gpio_irq_chip (gc );
204
206
struct ep93xx_gpio * epg = gpiochip_get_data (gc );
205
207
208
+ gpiochip_enable_irq (gc , irqd_to_hwirq (d ));
206
209
eic -> int_unmasked |= BIT (d -> irq & 7 );
207
210
ep93xx_gpio_update_int_params (epg , eic );
208
211
}
@@ -320,15 +323,25 @@ static int ep93xx_gpio_set_config(struct gpio_chip *gc, unsigned offset,
320
323
return 0 ;
321
324
}
322
325
323
- static void ep93xx_init_irq_chip (struct device * dev , struct irq_chip * ic )
326
+ static void ep93xx_irq_print_chip (struct irq_data * data , struct seq_file * p )
324
327
{
325
- ic -> irq_ack = ep93xx_gpio_irq_ack ;
326
- ic -> irq_mask_ack = ep93xx_gpio_irq_mask_ack ;
327
- ic -> irq_mask = ep93xx_gpio_irq_mask ;
328
- ic -> irq_unmask = ep93xx_gpio_irq_unmask ;
329
- ic -> irq_set_type = ep93xx_gpio_irq_type ;
328
+ struct gpio_chip * gc = irq_data_get_irq_chip_data (data );
329
+
330
+ seq_printf (p , dev_name (gc -> parent ));
330
331
}
331
332
333
+ static const struct irq_chip gpio_eic_irq_chip = {
334
+ .name = "ep93xx-gpio-eic" ,
335
+ .irq_ack = ep93xx_gpio_irq_ack ,
336
+ .irq_mask = ep93xx_gpio_irq_mask ,
337
+ .irq_unmask = ep93xx_gpio_irq_unmask ,
338
+ .irq_mask_ack = ep93xx_gpio_irq_mask_ack ,
339
+ .irq_set_type = ep93xx_gpio_irq_type ,
340
+ .irq_print_chip = ep93xx_irq_print_chip ,
341
+ .flags = IRQCHIP_IMMUTABLE ,
342
+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
343
+ };
344
+
332
345
static int ep93xx_gpio_add_bank (struct ep93xx_gpio_chip * egc ,
333
346
struct platform_device * pdev ,
334
347
struct ep93xx_gpio * epg ,
@@ -359,12 +372,7 @@ static int ep93xx_gpio_add_bank(struct ep93xx_gpio_chip *egc,
359
372
if (!egc -> eic )
360
373
return - ENOMEM ;
361
374
egc -> eic -> irq_offset = bank -> irq ;
362
- ic = & egc -> eic -> ic ;
363
- ic -> name = devm_kasprintf (dev , GFP_KERNEL , "gpio-irq-%s" , bank -> label );
364
- if (!ic -> name )
365
- return - ENOMEM ;
366
- ep93xx_init_irq_chip (dev , ic );
367
- girq -> chip = ic ;
375
+ gpio_irq_chip_set_chip (girq , & gpio_eic_irq_chip );
368
376
}
369
377
370
378
if (bank -> has_irq ) {
0 commit comments