Skip to content

Commit

Permalink
gpio: tegra: Ensure pinctrl input-enable is set for interrupts
Browse files Browse the repository at this point in the history
If the default pin configuration for a Tegra GPIO does not have the
input-enable bit set, then when using a GPIO as an interrupt, external
events will not be seen. Fix this by calling
tegra_gpio_direction_input() when requesting the IRQ resources because
this function will in turn call pinctrl_gpio_direction_input() to set
the input-enable bit for the pin.

Note that given the tegra_gpio_direction_input() also sets the GPIO
OE (output-enable) register, we no longer need to set this register
in tegra_gpio_irq_set_type().

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
  • Loading branch information
jonhunter committed Apr 17, 2021
1 parent ae9772c commit 4d26cd8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/gpio/gpio-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type)

raw_spin_unlock_irqrestore(&bank->lvl_lock[port], flags);

tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, gpio), gpio, 0);

ret = gpiochip_lock_as_irq(&tgi->gc, gpio);
if (ret) {
dev_err(tgi->dev,
Expand Down Expand Up @@ -585,8 +583,11 @@ static int tegra_gpio_irq_request_resources(struct irq_data *d)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
struct tegra_gpio_info *tgi = gpiochip_get_data(chip);
int ret;

tegra_gpio_enable(tgi, d->hwirq);
ret = tegra_gpio_direction_input(chip, d->hwirq);
if (ret < 0)
return ret;

ret = gpiochip_reqres_irq(chip, d->hwirq);
if (ret < 0)
Expand Down

0 comments on commit 4d26cd8

Please sign in to comment.