Skip to content

Commit 7795686

Browse files
Hans Verkuillinusw
authored andcommitted
pinctrl-sunxi: sunxi_pinctrl_gpio_direction_in/output: use correct offset
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]>
1 parent 7e57714 commit 7795686

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/pinctrl/sunxi/pinctrl-sunxi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,8 @@ static int sunxi_pinctrl_gpio_direction_input(struct gpio_chip *chip,
837837
{
838838
struct sunxi_pinctrl *pctl = gpiochip_get_data(chip);
839839

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

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

892893
sunxi_pinctrl_gpio_set(chip, offset, value);
893-
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL, offset, false);
894+
return sunxi_pmx_gpio_set_direction(pctl->pctl_dev, NULL,
895+
chip->base + offset, false);
894896
}
895897

896898
static int sunxi_pinctrl_gpio_of_xlate(struct gpio_chip *gc,

0 commit comments

Comments
 (0)