@@ -1242,30 +1242,29 @@ static void chv_gpio_irq_ack(struct irq_data *d)
12421242{
12431243 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
12441244 struct intel_pinctrl * pctrl = gpiochip_get_data (gc );
1245- int pin = irqd_to_hwirq (d );
1245+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
12461246 u32 intr_line ;
12471247
12481248 raw_spin_lock (& chv_lock );
12491249
1250- intr_line = chv_readl (pctrl , pin , CHV_PADCTRL0 );
1250+ intr_line = chv_readl (pctrl , hwirq , CHV_PADCTRL0 );
12511251 intr_line &= CHV_PADCTRL0_INTSEL_MASK ;
12521252 intr_line >>= CHV_PADCTRL0_INTSEL_SHIFT ;
12531253 chv_pctrl_writel (pctrl , CHV_INTSTAT , BIT (intr_line ));
12541254
12551255 raw_spin_unlock (& chv_lock );
12561256}
12571257
1258- static void chv_gpio_irq_mask_unmask (struct irq_data * d , bool mask )
1258+ static void chv_gpio_irq_mask_unmask (struct irq_data * d , irq_hw_number_t hwirq , bool mask )
12591259{
12601260 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
12611261 struct intel_pinctrl * pctrl = gpiochip_get_data (gc );
1262- int pin = irqd_to_hwirq (d );
12631262 u32 value , intr_line ;
12641263 unsigned long flags ;
12651264
12661265 raw_spin_lock_irqsave (& chv_lock , flags );
12671266
1268- intr_line = chv_readl (pctrl , pin , CHV_PADCTRL0 );
1267+ intr_line = chv_readl (pctrl , hwirq , CHV_PADCTRL0 );
12691268 intr_line &= CHV_PADCTRL0_INTSEL_MASK ;
12701269 intr_line >>= CHV_PADCTRL0_INTSEL_SHIFT ;
12711270
@@ -1281,12 +1280,20 @@ static void chv_gpio_irq_mask_unmask(struct irq_data *d, bool mask)
12811280
12821281static void chv_gpio_irq_mask (struct irq_data * d )
12831282{
1284- chv_gpio_irq_mask_unmask (d , true);
1283+ struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
1284+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
1285+
1286+ chv_gpio_irq_mask_unmask (d , hwirq , true);
1287+ gpiochip_disable_irq (gc , hwirq );
12851288}
12861289
12871290static void chv_gpio_irq_unmask (struct irq_data * d )
12881291{
1289- chv_gpio_irq_mask_unmask (d , false);
1292+ struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
1293+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
1294+
1295+ gpiochip_enable_irq (gc , hwirq );
1296+ chv_gpio_irq_mask_unmask (d , hwirq , false);
12901297}
12911298
12921299static unsigned chv_gpio_irq_startup (struct irq_data * d )
@@ -1306,27 +1313,27 @@ static unsigned chv_gpio_irq_startup(struct irq_data *d)
13061313 struct intel_pinctrl * pctrl = gpiochip_get_data (gc );
13071314 struct device * dev = pctrl -> dev ;
13081315 struct intel_community_context * cctx = & pctrl -> context .communities [0 ];
1309- unsigned int pin = irqd_to_hwirq (d );
1316+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
13101317 irq_flow_handler_t handler ;
13111318 unsigned long flags ;
13121319 u32 intsel , value ;
13131320
13141321 raw_spin_lock_irqsave (& chv_lock , flags );
1315- intsel = chv_readl (pctrl , pin , CHV_PADCTRL0 );
1322+ intsel = chv_readl (pctrl , hwirq , CHV_PADCTRL0 );
13161323 intsel &= CHV_PADCTRL0_INTSEL_MASK ;
13171324 intsel >>= CHV_PADCTRL0_INTSEL_SHIFT ;
13181325
1319- value = chv_readl (pctrl , pin , CHV_PADCTRL1 );
1326+ value = chv_readl (pctrl , hwirq , CHV_PADCTRL1 );
13201327 if (value & CHV_PADCTRL1_INTWAKECFG_LEVEL )
13211328 handler = handle_level_irq ;
13221329 else
13231330 handler = handle_edge_irq ;
13241331
13251332 if (cctx -> intr_lines [intsel ] == CHV_INVALID_HWIRQ ) {
13261333 irq_set_handler_locked (d , handler );
1327- dev_dbg (dev , "using interrupt line %u for IRQ_TYPE_NONE on pin %u \n" ,
1328- intsel , pin );
1329- cctx -> intr_lines [intsel ] = pin ;
1334+ dev_dbg (dev , "using interrupt line %u for IRQ_TYPE_NONE on pin %lu \n" ,
1335+ intsel , hwirq );
1336+ cctx -> intr_lines [intsel ] = hwirq ;
13301337 }
13311338 raw_spin_unlock_irqrestore (& chv_lock , flags );
13321339 }
@@ -1392,14 +1399,14 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
13921399{
13931400 struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
13941401 struct intel_pinctrl * pctrl = gpiochip_get_data (gc );
1395- unsigned int pin = irqd_to_hwirq (d );
1402+ irq_hw_number_t hwirq = irqd_to_hwirq (d );
13961403 unsigned long flags ;
13971404 u32 value ;
13981405 int ret ;
13991406
14001407 raw_spin_lock_irqsave (& chv_lock , flags );
14011408
1402- ret = chv_gpio_set_intr_line (pctrl , pin );
1409+ ret = chv_gpio_set_intr_line (pctrl , hwirq );
14031410 if (ret )
14041411 goto out_unlock ;
14051412
@@ -1416,8 +1423,8 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
14161423 * 2. If the pin cfg is not locked in BIOS:
14171424 * Driver programs the IntWakeCfg bits and save the mapping.
14181425 */
1419- if (!chv_pad_locked (pctrl , pin )) {
1420- value = chv_readl (pctrl , pin , CHV_PADCTRL1 );
1426+ if (!chv_pad_locked (pctrl , hwirq )) {
1427+ value = chv_readl (pctrl , hwirq , CHV_PADCTRL1 );
14211428 value &= ~CHV_PADCTRL1_INTWAKECFG_MASK ;
14221429 value &= ~CHV_PADCTRL1_INVRXTX_MASK ;
14231430
@@ -1434,7 +1441,7 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
14341441 value |= CHV_PADCTRL1_INVRXTX_RXDATA ;
14351442 }
14361443
1437- chv_writel (pctrl , pin , CHV_PADCTRL1 , value );
1444+ chv_writel (pctrl , hwirq , CHV_PADCTRL1 , value );
14381445 }
14391446
14401447 if (type & IRQ_TYPE_EDGE_BOTH )
@@ -1448,6 +1455,17 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned int type)
14481455 return ret ;
14491456}
14501457
1458+ static const struct irq_chip chv_gpio_irq_chip = {
1459+ .name = "chv-gpio" ,
1460+ .irq_startup = chv_gpio_irq_startup ,
1461+ .irq_ack = chv_gpio_irq_ack ,
1462+ .irq_mask = chv_gpio_irq_mask ,
1463+ .irq_unmask = chv_gpio_irq_unmask ,
1464+ .irq_set_type = chv_gpio_irq_type ,
1465+ .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_IMMUTABLE ,
1466+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
1467+ };
1468+
14511469static void chv_gpio_irq_handler (struct irq_desc * desc )
14521470{
14531471 struct gpio_chip * gc = irq_desc_get_handler_data (desc );
@@ -1611,15 +1629,8 @@ static int chv_gpio_probe(struct intel_pinctrl *pctrl, int irq)
16111629 chip -> base = -1 ;
16121630
16131631 pctrl -> irq = irq ;
1614- pctrl -> irqchip .name = "chv-gpio" ;
1615- pctrl -> irqchip .irq_startup = chv_gpio_irq_startup ;
1616- pctrl -> irqchip .irq_ack = chv_gpio_irq_ack ;
1617- pctrl -> irqchip .irq_mask = chv_gpio_irq_mask ;
1618- pctrl -> irqchip .irq_unmask = chv_gpio_irq_unmask ;
1619- pctrl -> irqchip .irq_set_type = chv_gpio_irq_type ;
1620- pctrl -> irqchip .flags = IRQCHIP_SKIP_SET_WAKE ;
1621-
1622- chip -> irq .chip = & pctrl -> irqchip ;
1632+
1633+ gpio_irq_chip_set_chip (& chip -> irq , & chv_gpio_irq_chip );
16231634 chip -> irq .init_hw = chv_gpio_irq_init_hw ;
16241635 chip -> irq .parent_handler = chv_gpio_irq_handler ;
16251636 chip -> irq .num_parents = 1 ;
0 commit comments