@@ -1350,36 +1350,40 @@ static void byt_irq_ack(struct irq_data *d)
13501350{
13511351 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
13521352 struct intel_pinctrl * vg = gpiochip_get_data (gc );
1353- unsigned int offset = irqd_to_hwirq (d );
1353+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
13541354 void __iomem * reg ;
13551355
1356- reg = byt_gpio_reg (vg , offset , BYT_INT_STAT_REG );
1356+ reg = byt_gpio_reg (vg , hwirq , BYT_INT_STAT_REG );
13571357 if (!reg )
13581358 return ;
13591359
13601360 raw_spin_lock (& byt_lock );
1361- writel (BIT (offset % 32 ), reg );
1361+ writel (BIT (hwirq % 32 ), reg );
13621362 raw_spin_unlock (& byt_lock );
13631363}
13641364
13651365static void byt_irq_mask (struct irq_data * d )
13661366{
13671367 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
13681368 struct intel_pinctrl * vg = gpiochip_get_data (gc );
1369+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
13691370
1370- byt_gpio_clear_triggering (vg , irqd_to_hwirq (d ));
1371+ byt_gpio_clear_triggering (vg , hwirq );
1372+ gpiochip_disable_irq (gc , hwirq );
13711373}
13721374
13731375static void byt_irq_unmask (struct irq_data * d )
13741376{
13751377 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
13761378 struct intel_pinctrl * vg = gpiochip_get_data (gc );
1377- unsigned int offset = irqd_to_hwirq (d );
1379+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
13781380 unsigned long flags ;
13791381 void __iomem * reg ;
13801382 u32 value ;
13811383
1382- reg = byt_gpio_reg (vg , offset , BYT_CONF0_REG );
1384+ gpiochip_enable_irq (gc , hwirq );
1385+
1386+ reg = byt_gpio_reg (vg , hwirq , BYT_CONF0_REG );
13831387 if (!reg )
13841388 return ;
13851389
@@ -1412,12 +1416,13 @@ static void byt_irq_unmask(struct irq_data *d)
14121416static int byt_irq_type (struct irq_data * d , unsigned int type )
14131417{
14141418 struct intel_pinctrl * vg = gpiochip_get_data (irq_data_get_irq_chip_data (d ));
1415- u32 offset = irqd_to_hwirq (d );
1419+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
14161420 u32 value ;
14171421 unsigned long flags ;
1418- void __iomem * reg = byt_gpio_reg ( vg , offset , BYT_CONF0_REG ) ;
1422+ void __iomem * reg ;
14191423
1420- if (!reg || offset >= vg -> chip .ngpio )
1424+ reg = byt_gpio_reg (vg , hwirq , BYT_CONF0_REG );
1425+ if (!reg )
14211426 return - EINVAL ;
14221427
14231428 raw_spin_lock_irqsave (& byt_lock , flags );
@@ -1447,6 +1452,16 @@ static int byt_irq_type(struct irq_data *d, unsigned int type)
14471452 return 0 ;
14481453}
14491454
1455+ static const struct irq_chip byt_gpio_irq_chip = {
1456+ .name = "BYT-GPIO" ,
1457+ .irq_ack = byt_irq_ack ,
1458+ .irq_mask = byt_irq_mask ,
1459+ .irq_unmask = byt_irq_unmask ,
1460+ .irq_set_type = byt_irq_type ,
1461+ .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED | IRQCHIP_IMMUTABLE ,
1462+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
1463+ };
1464+
14501465static void byt_gpio_irq_handler (struct irq_desc * desc )
14511466{
14521467 struct irq_data * data = irq_desc_get_irq_data (desc );
@@ -1633,15 +1648,8 @@ static int byt_gpio_probe(struct intel_pinctrl *vg)
16331648 if (irq > 0 ) {
16341649 struct gpio_irq_chip * girq ;
16351650
1636- vg -> irqchip .name = "BYT-GPIO" ,
1637- vg -> irqchip .irq_ack = byt_irq_ack ,
1638- vg -> irqchip .irq_mask = byt_irq_mask ,
1639- vg -> irqchip .irq_unmask = byt_irq_unmask ,
1640- vg -> irqchip .irq_set_type = byt_irq_type ,
1641- vg -> irqchip .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_SET_TYPE_MASKED ,
1642-
16431651 girq = & gc -> irq ;
1644- girq -> chip = & vg -> irqchip ;
1652+ gpio_irq_chip_set_chip ( girq , & byt_gpio_irq_chip ) ;
16451653 girq -> init_hw = byt_gpio_irq_init_hw ;
16461654 girq -> init_valid_mask = byt_init_irq_valid_mask ;
16471655 girq -> parent_handler = byt_gpio_irq_handler ;
0 commit comments