pinctrl: st: add irq_request/release_resources callbacks
[ Upstream commit e855fa9a65c40788b5069abb0d094537daa22e05 ] When using GPIO as IRQ source, the GPIO must be configured in INPUT. Callbacks dedicated for this was missing in pinctrl-st driver. This fix the following kernel error when trying to lock a gpio as IRQ: [ 7.521095] gpio gpiochip7: (PIO11): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ [ 7.526018] gpio gpiochip7: (PIO11): unable to lock HW IRQ 6 for IRQ [ 7.529405] genirq: Failed to request resources for 0-0053 (irq 81) on irqchip GPIO Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
1d75c214ce
commit
bc9aec2fad
1 changed files with 24 additions and 6 deletions
|
@ -1338,6 +1338,22 @@ static void st_gpio_irq_unmask(struct irq_data *d)
|
||||||
writel(BIT(d->hwirq), bank->base + REG_PIO_SET_PMASK);
|
writel(BIT(d->hwirq), bank->base + REG_PIO_SET_PMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int st_gpio_irq_request_resources(struct irq_data *d)
|
||||||
|
{
|
||||||
|
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||||
|
|
||||||
|
st_gpio_direction_input(gc, d->hwirq);
|
||||||
|
|
||||||
|
return gpiochip_lock_as_irq(gc, d->hwirq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void st_gpio_irq_release_resources(struct irq_data *d)
|
||||||
|
{
|
||||||
|
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||||
|
|
||||||
|
gpiochip_unlock_as_irq(gc, d->hwirq);
|
||||||
|
}
|
||||||
|
|
||||||
static int st_gpio_irq_set_type(struct irq_data *d, unsigned type)
|
static int st_gpio_irq_set_type(struct irq_data *d, unsigned type)
|
||||||
{
|
{
|
||||||
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
|
||||||
|
@ -1494,6 +1510,8 @@ static struct gpio_chip st_gpio_template = {
|
||||||
|
|
||||||
static struct irq_chip st_gpio_irqchip = {
|
static struct irq_chip st_gpio_irqchip = {
|
||||||
.name = "GPIO",
|
.name = "GPIO",
|
||||||
|
.irq_request_resources = st_gpio_irq_request_resources,
|
||||||
|
.irq_release_resources = st_gpio_irq_release_resources,
|
||||||
.irq_disable = st_gpio_irq_mask,
|
.irq_disable = st_gpio_irq_mask,
|
||||||
.irq_mask = st_gpio_irq_mask,
|
.irq_mask = st_gpio_irq_mask,
|
||||||
.irq_unmask = st_gpio_irq_unmask,
|
.irq_unmask = st_gpio_irq_unmask,
|
||||||
|
|
Loading…
Add table
Reference in a new issue