@@ -244,7 +244,6 @@ enum nmk_gpio_slpm {
244
244
245
245
struct nmk_gpio_chip {
246
246
struct gpio_chip chip ;
247
- struct irq_chip irqchip ;
248
247
void __iomem * addr ;
249
248
struct clk * clk ;
250
249
unsigned int bank ;
@@ -675,10 +674,9 @@ static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip,
675
674
__nmk_gpio_irq_modify (nmk_chip , offset , WAKE , on );
676
675
}
677
676
678
- static int nmk_gpio_irq_maskunmask (struct irq_data * d , bool enable )
677
+ static void nmk_gpio_irq_maskunmask (struct nmk_gpio_chip * nmk_chip ,
678
+ struct irq_data * d , bool enable )
679
679
{
680
- struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
681
- struct nmk_gpio_chip * nmk_chip = gpiochip_get_data (gc );
682
680
unsigned long flags ;
683
681
684
682
clk_enable (nmk_chip -> clk );
@@ -693,18 +691,24 @@ static int nmk_gpio_irq_maskunmask(struct irq_data *d, bool enable)
693
691
spin_unlock (& nmk_chip -> lock );
694
692
spin_unlock_irqrestore (& nmk_gpio_slpm_lock , flags );
695
693
clk_disable (nmk_chip -> clk );
696
-
697
- return 0 ;
698
694
}
699
695
700
696
static void nmk_gpio_irq_mask (struct irq_data * d )
701
697
{
702
- nmk_gpio_irq_maskunmask (d , false);
698
+ struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
699
+ struct nmk_gpio_chip * nmk_chip = gpiochip_get_data (gc );
700
+
701
+ nmk_gpio_irq_maskunmask (nmk_chip , d , false);
702
+ gpiochip_disable_irq (gc , irqd_to_hwirq (d ));
703
703
}
704
704
705
705
static void nmk_gpio_irq_unmask (struct irq_data * d )
706
706
{
707
- nmk_gpio_irq_maskunmask (d , true);
707
+ struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
708
+ struct nmk_gpio_chip * nmk_chip = gpiochip_get_data (gc );
709
+
710
+ gpiochip_enable_irq (gc , irqd_to_hwirq (d ));
711
+ nmk_gpio_irq_maskunmask (nmk_chip , d , true);
708
712
}
709
713
710
714
static int nmk_gpio_irq_set_wake (struct irq_data * d , unsigned int on )
@@ -1072,13 +1076,34 @@ static struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np,
1072
1076
return nmk_chip ;
1073
1077
}
1074
1078
1079
+ static void nmk_gpio_irq_print_chip (struct irq_data * d , struct seq_file * p )
1080
+ {
1081
+ struct gpio_chip * gc = irq_data_get_irq_chip_data (d );
1082
+ struct nmk_gpio_chip * nmk_chip = gpiochip_get_data (gc );
1083
+
1084
+ seq_printf (p , "nmk%u-%u-%u" , nmk_chip -> bank ,
1085
+ gc -> base , gc -> base + gc -> ngpio - 1 );
1086
+ }
1087
+
1088
+ static const struct irq_chip nmk_irq_chip = {
1089
+ .irq_ack = nmk_gpio_irq_ack ,
1090
+ .irq_mask = nmk_gpio_irq_mask ,
1091
+ .irq_unmask = nmk_gpio_irq_unmask ,
1092
+ .irq_set_type = nmk_gpio_irq_set_type ,
1093
+ .irq_set_wake = nmk_gpio_irq_set_wake ,
1094
+ .irq_startup = nmk_gpio_irq_startup ,
1095
+ .irq_shutdown = nmk_gpio_irq_shutdown ,
1096
+ .irq_print_chip = nmk_gpio_irq_print_chip ,
1097
+ .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE ,
1098
+ GPIOCHIP_IRQ_RESOURCE_HELPERS ,
1099
+ };
1100
+
1075
1101
static int nmk_gpio_probe (struct platform_device * dev )
1076
1102
{
1077
1103
struct device_node * np = dev -> dev .of_node ;
1078
1104
struct nmk_gpio_chip * nmk_chip ;
1079
1105
struct gpio_chip * chip ;
1080
1106
struct gpio_irq_chip * girq ;
1081
- struct irq_chip * irqchip ;
1082
1107
bool supports_sleepmode ;
1083
1108
int irq ;
1084
1109
int ret ;
@@ -1119,22 +1144,8 @@ static int nmk_gpio_probe(struct platform_device *dev)
1119
1144
chip -> can_sleep = false;
1120
1145
chip -> owner = THIS_MODULE ;
1121
1146
1122
- irqchip = & nmk_chip -> irqchip ;
1123
- irqchip -> irq_ack = nmk_gpio_irq_ack ;
1124
- irqchip -> irq_mask = nmk_gpio_irq_mask ;
1125
- irqchip -> irq_unmask = nmk_gpio_irq_unmask ;
1126
- irqchip -> irq_set_type = nmk_gpio_irq_set_type ;
1127
- irqchip -> irq_set_wake = nmk_gpio_irq_set_wake ;
1128
- irqchip -> irq_startup = nmk_gpio_irq_startup ;
1129
- irqchip -> irq_shutdown = nmk_gpio_irq_shutdown ;
1130
- irqchip -> flags = IRQCHIP_MASK_ON_SUSPEND ;
1131
- irqchip -> name = kasprintf (GFP_KERNEL , "nmk%u-%u-%u" ,
1132
- dev -> id ,
1133
- chip -> base ,
1134
- chip -> base + chip -> ngpio - 1 );
1135
-
1136
1147
girq = & chip -> irq ;
1137
- girq -> chip = irqchip ;
1148
+ gpio_irq_chip_set_chip ( girq , & nmk_irq_chip ) ;
1138
1149
girq -> parent_handler = nmk_gpio_irq_handler ;
1139
1150
girq -> num_parents = 1 ;
1140
1151
girq -> parents = devm_kcalloc (& dev -> dev , 1 ,
0 commit comments