mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-23 08:35:19 -05:00
gpio: aggregator: Add interrupt support
Currently the GPIO Aggregator does not support interrupts. This means that kernel drivers going from a GPIO to an IRQ using gpiod_to_irq(), and userspace applications using line events do not work. Add interrupt support by providing a gpio_chip.to_irq() callback, which just calls into the parent GPIO controller. Note that this does not implement full interrupt controller (irq_chip) support, so using e.g. gpio-keys with "interrupts" instead of "gpios" still does not work. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
This commit is contained in:
parent
49fdfe6640
commit
a00128dfc8
1 changed files with 10 additions and 1 deletions
|
@ -371,6 +371,13 @@ static int gpio_fwd_set_config(struct gpio_chip *chip, unsigned int offset,
|
||||||
return gpiod_set_config(fwd->descs[offset], config);
|
return gpiod_set_config(fwd->descs[offset], config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int gpio_fwd_to_irq(struct gpio_chip *chip, unsigned int offset)
|
||||||
|
{
|
||||||
|
struct gpiochip_fwd *fwd = gpiochip_get_data(chip);
|
||||||
|
|
||||||
|
return gpiod_to_irq(fwd->descs[offset]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gpiochip_fwd_create() - Create a new GPIO forwarder
|
* gpiochip_fwd_create() - Create a new GPIO forwarder
|
||||||
* @dev: Parent device pointer
|
* @dev: Parent device pointer
|
||||||
|
@ -411,7 +418,8 @@ static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev,
|
||||||
for (i = 0; i < ngpios; i++) {
|
for (i = 0; i < ngpios; i++) {
|
||||||
struct gpio_chip *parent = gpiod_to_chip(descs[i]);
|
struct gpio_chip *parent = gpiod_to_chip(descs[i]);
|
||||||
|
|
||||||
dev_dbg(dev, "%u => gpio-%d\n", i, desc_to_gpio(descs[i]));
|
dev_dbg(dev, "%u => gpio %d irq %d\n", i,
|
||||||
|
desc_to_gpio(descs[i]), gpiod_to_irq(descs[i]));
|
||||||
|
|
||||||
if (gpiod_cansleep(descs[i]))
|
if (gpiod_cansleep(descs[i]))
|
||||||
chip->can_sleep = true;
|
chip->can_sleep = true;
|
||||||
|
@ -429,6 +437,7 @@ static struct gpiochip_fwd *gpiochip_fwd_create(struct device *dev,
|
||||||
chip->get_multiple = gpio_fwd_get_multiple_locked;
|
chip->get_multiple = gpio_fwd_get_multiple_locked;
|
||||||
chip->set = gpio_fwd_set;
|
chip->set = gpio_fwd_set;
|
||||||
chip->set_multiple = gpio_fwd_set_multiple_locked;
|
chip->set_multiple = gpio_fwd_set_multiple_locked;
|
||||||
|
chip->to_irq = gpio_fwd_to_irq;
|
||||||
chip->base = -1;
|
chip->base = -1;
|
||||||
chip->ngpio = ngpios;
|
chip->ngpio = ngpios;
|
||||||
fwd->descs = descs;
|
fwd->descs = descs;
|
||||||
|
|
Loading…
Add table
Reference in a new issue