Skip to content

Commit f086d1f

Browse files
ADESTMlinusw
authored andcommitted
pinctrl: stmfx: add irq_request/release_resources callbacks
When an STMFX IO is used as interrupt through the interrupt-controller binding, the STMFX driver should configure this IO as input. Default value of STMFX IO direction is input, but if the IO is used as output before the interrupt use, it will not work without these callbacks. Signed-off-by: Amelie Delaunay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent bcd1149 commit f086d1f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

drivers/pinctrl/pinctrl-stmfx.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,25 @@ static void stmfx_pinctrl_irq_bus_sync_unlock(struct irq_data *data)
505505
mutex_unlock(&pctl->lock);
506506
}
507507

508+
static int stmfx_gpio_irq_request_resources(struct irq_data *data)
509+
{
510+
struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
511+
int ret;
512+
513+
ret = stmfx_gpio_direction_input(gpio_chip, data->hwirq);
514+
if (ret)
515+
return ret;
516+
517+
return gpiochip_reqres_irq(gpio_chip, data->hwirq);
518+
}
519+
520+
static void stmfx_gpio_irq_release_resources(struct irq_data *data)
521+
{
522+
struct gpio_chip *gpio_chip = irq_data_get_irq_chip_data(data);
523+
524+
return gpiochip_relres_irq(gpio_chip, data->hwirq);
525+
}
526+
508527
static void stmfx_pinctrl_irq_toggle_trigger(struct stmfx_pinctrl *pctl,
509528
unsigned int offset)
510529
{
@@ -678,6 +697,8 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev)
678697
pctl->irq_chip.irq_set_type = stmfx_pinctrl_irq_set_type;
679698
pctl->irq_chip.irq_bus_lock = stmfx_pinctrl_irq_bus_lock;
680699
pctl->irq_chip.irq_bus_sync_unlock = stmfx_pinctrl_irq_bus_sync_unlock;
700+
pctl->irq_chip.irq_request_resources = stmfx_gpio_irq_request_resources;
701+
pctl->irq_chip.irq_release_resources = stmfx_gpio_irq_release_resources;
681702

682703
ret = gpiochip_irqchip_add_nested(&pctl->gpio_chip, &pctl->irq_chip,
683704
0, handle_bad_irq, IRQ_TYPE_NONE);

0 commit comments

Comments
 (0)