diff options
Diffstat (limited to 'drivers/gpio')
| -rw-r--r-- | drivers/gpio/gpio-altera-a10sr.c | 4 | ||||
| -rw-r--r-- | drivers/gpio/gpio-eic-sprd.c | 14 | ||||
| -rw-r--r-- | drivers/gpio/gpio-mt7621.c | 20 | ||||
| -rw-r--r-- | drivers/gpio/gpio-pca953x.c | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpio-pcf857x.c | 26 | ||||
| -rw-r--r-- | drivers/gpio/gpio-pxa.c | 1 | ||||
| -rw-r--r-- | drivers/gpio/gpio-vf610.c | 5 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib-acpi.c | 7 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib.c | 9 |
9 files changed, 54 insertions, 34 deletions
diff --git a/drivers/gpio/gpio-altera-a10sr.c b/drivers/gpio/gpio-altera-a10sr.c index 6b11f1314248..7f9e0304b510 100644 --- a/drivers/gpio/gpio-altera-a10sr.c +++ b/drivers/gpio/gpio-altera-a10sr.c | |||
| @@ -66,8 +66,10 @@ static int altr_a10sr_gpio_direction_input(struct gpio_chip *gc, | |||
| 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, | 66 | static int altr_a10sr_gpio_direction_output(struct gpio_chip *gc, |
| 67 | unsigned int nr, int value) | 67 | unsigned int nr, int value) |
| 68 | { | 68 | { |
| 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) | 69 | if (nr <= (ALTR_A10SR_OUT_VALID_RANGE_HI - ALTR_A10SR_LED_VALID_SHIFT)) { |
| 70 | altr_a10sr_gpio_set(gc, nr, value); | ||
| 70 | return 0; | 71 | return 0; |
| 72 | } | ||
| 71 | return -EINVAL; | 73 | return -EINVAL; |
| 72 | } | 74 | } |
| 73 | 75 | ||
diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c index e0d6a0a7bc69..e41223c05f6e 100644 --- a/drivers/gpio/gpio-eic-sprd.c +++ b/drivers/gpio/gpio-eic-sprd.c | |||
| @@ -180,7 +180,18 @@ static void sprd_eic_free(struct gpio_chip *chip, unsigned int offset) | |||
| 180 | 180 | ||
| 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) | 181 | static int sprd_eic_get(struct gpio_chip *chip, unsigned int offset) |
| 182 | { | 182 | { |
| 183 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | 183 | struct sprd_eic *sprd_eic = gpiochip_get_data(chip); |
| 184 | |||
| 185 | switch (sprd_eic->type) { | ||
| 186 | case SPRD_EIC_DEBOUNCE: | ||
| 187 | return sprd_eic_read(chip, offset, SPRD_EIC_DBNC_DATA); | ||
| 188 | case SPRD_EIC_ASYNC: | ||
| 189 | return sprd_eic_read(chip, offset, SPRD_EIC_ASYNC_DATA); | ||
| 190 | case SPRD_EIC_SYNC: | ||
| 191 | return sprd_eic_read(chip, offset, SPRD_EIC_SYNC_DATA); | ||
| 192 | default: | ||
| 193 | return -ENOTSUPP; | ||
| 194 | } | ||
| 184 | } | 195 | } |
| 185 | 196 | ||
| 186 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) | 197 | static int sprd_eic_direction_input(struct gpio_chip *chip, unsigned int offset) |
| @@ -368,6 +379,7 @@ static int sprd_eic_irq_set_type(struct irq_data *data, unsigned int flow_type) | |||
| 368 | irq_set_handler_locked(data, handle_edge_irq); | 379 | irq_set_handler_locked(data, handle_edge_irq); |
| 369 | break; | 380 | break; |
| 370 | case IRQ_TYPE_EDGE_BOTH: | 381 | case IRQ_TYPE_EDGE_BOTH: |
| 382 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTMODE, 0); | ||
| 371 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); | 383 | sprd_eic_update(chip, offset, SPRD_EIC_ASYNC_INTBOTH, 1); |
| 372 | irq_set_handler_locked(data, handle_edge_irq); | 384 | irq_set_handler_locked(data, handle_edge_irq); |
| 373 | break; | 385 | break; |
diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c index 00e954f22bc9..74401e0adb29 100644 --- a/drivers/gpio/gpio-mt7621.c +++ b/drivers/gpio/gpio-mt7621.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #define GPIO_REG_EDGE 0xA0 | 30 | #define GPIO_REG_EDGE 0xA0 |
| 31 | 31 | ||
| 32 | struct mtk_gc { | 32 | struct mtk_gc { |
| 33 | struct irq_chip irq_chip; | ||
| 33 | struct gpio_chip chip; | 34 | struct gpio_chip chip; |
| 34 | spinlock_t lock; | 35 | spinlock_t lock; |
| 35 | int bank; | 36 | int bank; |
| @@ -189,13 +190,6 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type) | |||
| 189 | return 0; | 190 | return 0; |
| 190 | } | 191 | } |
| 191 | 192 | ||
| 192 | static struct irq_chip mediatek_gpio_irq_chip = { | ||
| 193 | .irq_unmask = mediatek_gpio_irq_unmask, | ||
| 194 | .irq_mask = mediatek_gpio_irq_mask, | ||
| 195 | .irq_mask_ack = mediatek_gpio_irq_mask, | ||
| 196 | .irq_set_type = mediatek_gpio_irq_type, | ||
| 197 | }; | ||
| 198 | |||
| 199 | static int | 193 | static int |
| 200 | mediatek_gpio_xlate(struct gpio_chip *chip, | 194 | mediatek_gpio_xlate(struct gpio_chip *chip, |
| 201 | const struct of_phandle_args *spec, u32 *flags) | 195 | const struct of_phandle_args *spec, u32 *flags) |
| @@ -254,6 +248,13 @@ mediatek_gpio_bank_probe(struct device *dev, | |||
| 254 | return ret; | 248 | return ret; |
| 255 | } | 249 | } |
| 256 | 250 | ||
| 251 | rg->irq_chip.name = dev_name(dev); | ||
| 252 | rg->irq_chip.parent_device = dev; | ||
| 253 | rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask; | ||
| 254 | rg->irq_chip.irq_mask = mediatek_gpio_irq_mask; | ||
| 255 | rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask; | ||
| 256 | rg->irq_chip.irq_set_type = mediatek_gpio_irq_type; | ||
| 257 | |||
| 257 | if (mtk->gpio_irq) { | 258 | if (mtk->gpio_irq) { |
| 258 | /* | 259 | /* |
| 259 | * Manually request the irq here instead of passing | 260 | * Manually request the irq here instead of passing |
| @@ -270,14 +271,14 @@ mediatek_gpio_bank_probe(struct device *dev, | |||
| 270 | return ret; | 271 | return ret; |
| 271 | } | 272 | } |
| 272 | 273 | ||
| 273 | ret = gpiochip_irqchip_add(&rg->chip, &mediatek_gpio_irq_chip, | 274 | ret = gpiochip_irqchip_add(&rg->chip, &rg->irq_chip, |
| 274 | 0, handle_simple_irq, IRQ_TYPE_NONE); | 275 | 0, handle_simple_irq, IRQ_TYPE_NONE); |
| 275 | if (ret) { | 276 | if (ret) { |
| 276 | dev_err(dev, "failed to add gpiochip_irqchip\n"); | 277 | dev_err(dev, "failed to add gpiochip_irqchip\n"); |
| 277 | return ret; | 278 | return ret; |
| 278 | } | 279 | } |
| 279 | 280 | ||
| 280 | gpiochip_set_chained_irqchip(&rg->chip, &mediatek_gpio_irq_chip, | 281 | gpiochip_set_chained_irqchip(&rg->chip, &rg->irq_chip, |
| 281 | mtk->gpio_irq, NULL); | 282 | mtk->gpio_irq, NULL); |
| 282 | } | 283 | } |
| 283 | 284 | ||
| @@ -310,7 +311,6 @@ mediatek_gpio_probe(struct platform_device *pdev) | |||
| 310 | mtk->gpio_irq = irq_of_parse_and_map(np, 0); | 311 | mtk->gpio_irq = irq_of_parse_and_map(np, 0); |
| 311 | mtk->dev = dev; | 312 | mtk->dev = dev; |
| 312 | platform_set_drvdata(pdev, mtk); | 313 | platform_set_drvdata(pdev, mtk); |
| 313 | mediatek_gpio_irq_chip.name = dev_name(dev); | ||
| 314 | 314 | ||
| 315 | for (i = 0; i < MTK_BANK_CNT; i++) { | 315 | for (i = 0; i < MTK_BANK_CNT; i++) { |
| 316 | ret = mediatek_gpio_bank_probe(dev, np, i); | 316 | ret = mediatek_gpio_bank_probe(dev, np, i); |
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 83617fdc661d..0dc96419efe3 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c | |||
| @@ -289,7 +289,7 @@ static bool pca953x_volatile_register(struct device *dev, unsigned int reg) | |||
| 289 | return pca953x_check_register(chip, reg, bank); | 289 | return pca953x_check_register(chip, reg, bank); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | const struct regmap_config pca953x_i2c_regmap = { | 292 | static const struct regmap_config pca953x_i2c_regmap = { |
| 293 | .reg_bits = 8, | 293 | .reg_bits = 8, |
| 294 | .val_bits = 8, | 294 | .val_bits = 8, |
| 295 | 295 | ||
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index adf72dda25a2..68a35b65925a 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
| @@ -84,6 +84,7 @@ MODULE_DEVICE_TABLE(of, pcf857x_of_table); | |||
| 84 | */ | 84 | */ |
| 85 | struct pcf857x { | 85 | struct pcf857x { |
| 86 | struct gpio_chip chip; | 86 | struct gpio_chip chip; |
| 87 | struct irq_chip irqchip; | ||
| 87 | struct i2c_client *client; | 88 | struct i2c_client *client; |
| 88 | struct mutex lock; /* protect 'out' */ | 89 | struct mutex lock; /* protect 'out' */ |
| 89 | unsigned out; /* software latch */ | 90 | unsigned out; /* software latch */ |
| @@ -252,18 +253,6 @@ static void pcf857x_irq_bus_sync_unlock(struct irq_data *data) | |||
| 252 | mutex_unlock(&gpio->lock); | 253 | mutex_unlock(&gpio->lock); |
| 253 | } | 254 | } |
| 254 | 255 | ||
| 255 | static struct irq_chip pcf857x_irq_chip = { | ||
| 256 | .name = "pcf857x", | ||
| 257 | .irq_enable = pcf857x_irq_enable, | ||
| 258 | .irq_disable = pcf857x_irq_disable, | ||
| 259 | .irq_ack = noop, | ||
| 260 | .irq_mask = noop, | ||
| 261 | .irq_unmask = noop, | ||
| 262 | .irq_set_wake = pcf857x_irq_set_wake, | ||
| 263 | .irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 264 | .irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 265 | }; | ||
| 266 | |||
| 267 | /*-------------------------------------------------------------------------*/ | 256 | /*-------------------------------------------------------------------------*/ |
| 268 | 257 | ||
| 269 | static int pcf857x_probe(struct i2c_client *client, | 258 | static int pcf857x_probe(struct i2c_client *client, |
| @@ -376,8 +365,17 @@ static int pcf857x_probe(struct i2c_client *client, | |||
| 376 | 365 | ||
| 377 | /* Enable irqchip if we have an interrupt */ | 366 | /* Enable irqchip if we have an interrupt */ |
| 378 | if (client->irq) { | 367 | if (client->irq) { |
| 368 | gpio->irqchip.name = "pcf857x", | ||
| 369 | gpio->irqchip.irq_enable = pcf857x_irq_enable, | ||
| 370 | gpio->irqchip.irq_disable = pcf857x_irq_disable, | ||
| 371 | gpio->irqchip.irq_ack = noop, | ||
| 372 | gpio->irqchip.irq_mask = noop, | ||
| 373 | gpio->irqchip.irq_unmask = noop, | ||
| 374 | gpio->irqchip.irq_set_wake = pcf857x_irq_set_wake, | ||
| 375 | gpio->irqchip.irq_bus_lock = pcf857x_irq_bus_lock, | ||
| 376 | gpio->irqchip.irq_bus_sync_unlock = pcf857x_irq_bus_sync_unlock, | ||
| 379 | status = gpiochip_irqchip_add_nested(&gpio->chip, | 377 | status = gpiochip_irqchip_add_nested(&gpio->chip, |
| 380 | &pcf857x_irq_chip, | 378 | &gpio->irqchip, |
| 381 | 0, handle_level_irq, | 379 | 0, handle_level_irq, |
| 382 | IRQ_TYPE_NONE); | 380 | IRQ_TYPE_NONE); |
| 383 | if (status) { | 381 | if (status) { |
| @@ -392,7 +390,7 @@ static int pcf857x_probe(struct i2c_client *client, | |||
| 392 | if (status) | 390 | if (status) |
| 393 | goto fail; | 391 | goto fail; |
| 394 | 392 | ||
| 395 | gpiochip_set_nested_irqchip(&gpio->chip, &pcf857x_irq_chip, | 393 | gpiochip_set_nested_irqchip(&gpio->chip, &gpio->irqchip, |
| 396 | client->irq); | 394 | client->irq); |
| 397 | gpio->irq_parent = client->irq; | 395 | gpio->irq_parent = client->irq; |
| 398 | } | 396 | } |
diff --git a/drivers/gpio/gpio-pxa.c b/drivers/gpio/gpio-pxa.c index e9600b556f39..bcc6be4a5cb2 100644 --- a/drivers/gpio/gpio-pxa.c +++ b/drivers/gpio/gpio-pxa.c | |||
| @@ -245,6 +245,7 @@ static bool pxa_gpio_has_pinctrl(void) | |||
| 245 | { | 245 | { |
| 246 | switch (gpio_type) { | 246 | switch (gpio_type) { |
| 247 | case PXA3XX_GPIO: | 247 | case PXA3XX_GPIO: |
| 248 | case MMP2_GPIO: | ||
| 248 | return false; | 249 | return false; |
| 249 | 250 | ||
| 250 | default: | 251 | default: |
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 1b79ebcfce3e..541fa6ac399d 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c | |||
| @@ -253,6 +253,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
| 253 | struct vf610_gpio_port *port; | 253 | struct vf610_gpio_port *port; |
| 254 | struct resource *iores; | 254 | struct resource *iores; |
| 255 | struct gpio_chip *gc; | 255 | struct gpio_chip *gc; |
| 256 | int i; | ||
| 256 | int ret; | 257 | int ret; |
| 257 | 258 | ||
| 258 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); | 259 | port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL); |
| @@ -319,6 +320,10 @@ static int vf610_gpio_probe(struct platform_device *pdev) | |||
| 319 | if (ret < 0) | 320 | if (ret < 0) |
| 320 | return ret; | 321 | return ret; |
| 321 | 322 | ||
| 323 | /* Mask all GPIO interrupts */ | ||
| 324 | for (i = 0; i < gc->ngpio; i++) | ||
| 325 | vf610_gpio_writel(0, port->base + PORT_PCR(i)); | ||
| 326 | |||
| 322 | /* Clear the interrupt status register for all GPIO's */ | 327 | /* Clear the interrupt status register for all GPIO's */ |
| 323 | vf610_gpio_writel(~0, port->base + PORT_ISFR); | 328 | vf610_gpio_writel(~0, port->base + PORT_ISFR); |
| 324 | 329 | ||
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 48534bda73d3..259cf6ab969b 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c | |||
| @@ -357,8 +357,6 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
| 357 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); | 357 | mutex_unlock(&acpi_gpio_deferred_req_irqs_lock); |
| 358 | 358 | ||
| 359 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { | 359 | list_for_each_entry_safe_reverse(event, ep, &acpi_gpio->events, node) { |
| 360 | struct gpio_desc *desc; | ||
| 361 | |||
| 362 | if (event->irq_requested) { | 360 | if (event->irq_requested) { |
| 363 | if (event->irq_is_wake) | 361 | if (event->irq_is_wake) |
| 364 | disable_irq_wake(event->irq); | 362 | disable_irq_wake(event->irq); |
| @@ -366,11 +364,8 @@ void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) | |||
| 366 | free_irq(event->irq, event); | 364 | free_irq(event->irq, event); |
| 367 | } | 365 | } |
| 368 | 366 | ||
| 369 | desc = event->desc; | ||
| 370 | if (WARN_ON(IS_ERR(desc))) | ||
| 371 | continue; | ||
| 372 | gpiochip_unlock_as_irq(chip, event->pin); | 367 | gpiochip_unlock_as_irq(chip, event->pin); |
| 373 | gpiochip_free_own_desc(desc); | 368 | gpiochip_free_own_desc(event->desc); |
| 374 | list_del(&event->node); | 369 | list_del(&event->node); |
| 375 | kfree(event); | 370 | kfree(event); |
| 376 | } | 371 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 1651d7f0a303..d1adfdf50fb3 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -828,7 +828,14 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p) | |||
| 828 | /* Do not leak kernel stack to userspace */ | 828 | /* Do not leak kernel stack to userspace */ |
| 829 | memset(&ge, 0, sizeof(ge)); | 829 | memset(&ge, 0, sizeof(ge)); |
| 830 | 830 | ||
| 831 | ge.timestamp = le->timestamp; | 831 | /* |
| 832 | * We may be running from a nested threaded interrupt in which case | ||
| 833 | * we didn't get the timestamp from lineevent_irq_handler(). | ||
| 834 | */ | ||
| 835 | if (!le->timestamp) | ||
| 836 | ge.timestamp = ktime_get_real_ns(); | ||
| 837 | else | ||
| 838 | ge.timestamp = le->timestamp; | ||
| 832 | 839 | ||
| 833 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE | 840 | if (le->eflags & GPIOEVENT_REQUEST_RISING_EDGE |
| 834 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { | 841 | && le->eflags & GPIOEVENT_REQUEST_FALLING_EDGE) { |
