Skip to content

Commit

Permalink
pinctrl-sunxi: sunxi_pinctrl_gpio_direction_in/output: use correct of…
Browse files Browse the repository at this point in the history
…fset

The commit that sets the direction directly without calling
pinctrl_gpio_direction(), forgot to add chip->base to the offset when
calling sunxi_pmx_gpio_set_direction().

This caused failures for various Allwinner boards which have two
GPIO blocks.

Signed-off-by: Hans Verkuil <[email protected]>
Reported-by: 5kft <[email protected]>
Suggested-by: 5kft <[email protected]>
Reported-by: Corentin Labbe <[email protected]>
Fixes: 8df89a7 (pinctrl-sunxi: don't call pinctrl_gpio_direction())
Tested-by: Corentin Labbe <[email protected]>
Tested-by: Jernej Skrabec <[email protected]>
Acked-by: Jernej Skrabec <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Guenter Roeck <[email protected]>
[Picked from linux-next to pinctrl fixes]
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
Hans Verkuil authored and linusw committed Feb 28, 2022
1 parent 7e57714 commit 7795686
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/pinctrl/sunxi/pinctrl-sunxi.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,8 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
{
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);

return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, true);
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL,
chip->base + offset, true);
}

static int sunxi_pinctrl_gpio_get(struct gpio_chip *chip, unsigned offset)
Expand Down Expand Up @@ -890,7 +891,8 @@ static int sunxi_pinctrl_gpio_direction_output(struct gpio_chip *chip,
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);

sunxi_pinctrl_gpio_set(chip, offset, value);
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, false);
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL,
chip->base + offset, false);
}

static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,
Expand Down

0 comments on commit 7795686

Please sign in to comment.