Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions drivers/pinctrl/bcm/pinctrl-bcm2835.c
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,32 @@ static int bcm2835_gpio_irq_set_wake(struct irq_data *data, unsigned int on)
return ret;
}

static int bcm2835_gpio_irq_reqres(struct irq_data *d)
{
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
int ret;

ret = gpiochip_irq_reqres(d);
if (!ret)
ret = bcm2835_gpio_direction_input(gc, d->hwirq);

return ret;
}

static void bcm2835_gpio_irq_relres(struct irq_data *d)
{
return gpiochip_irq_relres(d);
}

static const struct irq_chip bcm2835_gpio_irq_chip = {
.name = MODULE_NAME,
.irq_set_type = bcm2835_gpio_irq_set_type,
.irq_ack = bcm2835_gpio_irq_ack,
.irq_mask = bcm2835_gpio_irq_mask,
.irq_unmask = bcm2835_gpio_irq_unmask,
.irq_set_wake = bcm2835_gpio_irq_set_wake,
.irq_request_resources = bcm2835_gpio_irq_reqres,
.irq_release_resources = bcm2835_gpio_irq_relres,
.flags = (IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE),
GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
Expand Down Expand Up @@ -1015,6 +1034,13 @@ static int bcm2835_pmx_gpio_set_direction(struct pinctrl_dev *pctldev,
return 0;
}

static bool bcm2835_pmx_function_is_gpio(struct pinctrl_dev *pctldev,
unsigned int selector)
{
return selector == BCM2835_FSEL_GPIO_IN ||
selector == BCM2835_FSEL_GPIO_OUT;
}

static const struct pinmux_ops bcm2835_pmx_ops = {
.free = bcm2835_pmx_free,
.get_functions_count = bcm2835_pmx_get_functions_count,
Expand All @@ -1023,6 +1049,8 @@ static const struct pinmux_ops bcm2835_pmx_ops = {
.set_mux = bcm2835_pmx_set,
.gpio_disable_free = bcm2835_pmx_gpio_disable_free,
.gpio_set_direction = bcm2835_pmx_gpio_set_direction,
.function_is_gpio = bcm2835_pmx_function_is_gpio,
.strict = true,
};

static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev,
Expand Down
Loading