aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2014-09-05 15:52:55 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-09-23 11:51:40 -0400
commit46824e224490af1e6d70fe613930a52253ea969d (patch)
tree2c3fb340abf7e7ab029eea63b9f7ba0f1bc76a6c /drivers/gpio
parent9afd23b61221a5c5c0d588f6d8f0e4495ecc8d24 (diff)
gpio: omap: Fix interrupt names
When viewing the /proc/interrupts, there is no information about which GPIO bank a specific gpio interrupt is hooked on to. This is more than a bit irritating as such information can esily be provided back to the user and at times, can be crucial for debug. So, instead of displaying something like: 31: 0 0 GPIO 0 palmas 32: 0 0 GPIO 27 mmc0 Display the following with appropriate device name: 31: 0 0 4ae10000.gpio 0 palmas 32: 0 0 4805d000.gpio 27 mmc0 This requires that we create irq_chip instance specific for each GPIO bank which is trivial to achieve. Signed-off-by: Nishanth Menon <nm@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Acked-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Acked-by: Kevin Hilman <khilman@linaro.org> Acked-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-omap.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 5cd33677a018..415682f69214 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -857,16 +857,6 @@ static void omap_gpio_unmask_irq(struct irq_data *d)
857 spin_unlock_irqrestore(&bank->lock, flags); 857 spin_unlock_irqrestore(&bank->lock, flags);
858} 858}
859 859
860static struct irq_chip gpio_irq_chip = {
861 .name = "GPIO",
862 .irq_shutdown = omap_gpio_irq_shutdown,
863 .irq_ack = omap_gpio_ack_irq,
864 .irq_mask = omap_gpio_mask_irq,
865 .irq_unmask = omap_gpio_unmask_irq,
866 .irq_set_type = omap_gpio_irq_type,
867 .irq_set_wake = omap_gpio_wake_enable,
868};
869
870/*---------------------------------------------------------------------*/ 860/*---------------------------------------------------------------------*/
871 861
872static int omap_mpuio_suspend_noirq(struct device *dev) 862static int omap_mpuio_suspend_noirq(struct device *dev)
@@ -1088,7 +1078,7 @@ omap_mpuio_alloc_gc(struct gpio_bank *bank, unsigned int irq_start,
1088 IRQ_NOREQUEST | IRQ_NOPROBE, 0); 1078 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
1089} 1079}
1090 1080
1091static int omap_gpio_chip_init(struct gpio_bank *bank) 1081static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)
1092{ 1082{
1093 int j; 1083 int j;
1094 static int gpio; 1084 static int gpio;
@@ -1137,7 +1127,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank)
1137 } 1127 }
1138#endif 1128#endif
1139 1129
1140 ret = gpiochip_irqchip_add(&bank->chip, &gpio_irq_chip, 1130 ret = gpiochip_irqchip_add(&bank->chip, irqc,
1141 irq_base, omap_gpio_irq_handler, 1131 irq_base, omap_gpio_irq_handler,
1142 IRQ_TYPE_NONE); 1132 IRQ_TYPE_NONE);
1143 1133
@@ -1147,7 +1137,7 @@ static int omap_gpio_chip_init(struct gpio_bank *bank)
1147 return -ENODEV; 1137 return -ENODEV;
1148 } 1138 }
1149 1139
1150 gpiochip_set_chained_irqchip(&bank->chip, &gpio_irq_chip, 1140 gpiochip_set_chained_irqchip(&bank->chip, irqc,
1151 bank->irq, omap_gpio_irq_handler); 1141 bank->irq, omap_gpio_irq_handler);
1152 1142
1153 for (j = 0; j < bank->width; j++) { 1143 for (j = 0; j < bank->width; j++) {
@@ -1172,6 +1162,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
1172 const struct omap_gpio_platform_data *pdata; 1162 const struct omap_gpio_platform_data *pdata;
1173 struct resource *res; 1163 struct resource *res;
1174 struct gpio_bank *bank; 1164 struct gpio_bank *bank;
1165 struct irq_chip *irqc;
1175 int ret; 1166 int ret;
1176 1167
1177 match = of_match_device(of_match_ptr(omap_gpio_match), dev); 1168 match = of_match_device(of_match_ptr(omap_gpio_match), dev);
@@ -1186,6 +1177,18 @@ static int omap_gpio_probe(struct platform_device *pdev)
1186 return -ENOMEM; 1177 return -ENOMEM;
1187 } 1178 }
1188 1179
1180 irqc = devm_kzalloc(dev, sizeof(*irqc), GFP_KERNEL);
1181 if (!irqc)
1182 return -ENOMEM;
1183
1184 irqc->irq_shutdown = omap_gpio_irq_shutdown,
1185 irqc->irq_ack = omap_gpio_ack_irq,
1186 irqc->irq_mask = omap_gpio_mask_irq,
1187 irqc->irq_unmask = omap_gpio_unmask_irq,
1188 irqc->irq_set_type = omap_gpio_irq_type,
1189 irqc->irq_set_wake = omap_gpio_wake_enable,
1190 irqc->name = dev_name(&pdev->dev);
1191
1189 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1192 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1190 if (unlikely(!res)) { 1193 if (unlikely(!res)) {
1191 dev_err(dev, "Invalid IRQ resource\n"); 1194 dev_err(dev, "Invalid IRQ resource\n");
@@ -1241,7 +1244,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
1241 1244
1242 omap_gpio_mod_init(bank); 1245 omap_gpio_mod_init(bank);
1243 1246
1244 ret = omap_gpio_chip_init(bank); 1247 ret = omap_gpio_chip_init(bank, irqc);
1245 if (ret) 1248 if (ret)
1246 return ret; 1249 return ret;
1247 1250