linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Linus Walleij <linus.walleij@linaro.org>,
	linux-gpio@vger.kernel.org, Maxime Ripard <maxime@cerno.tech>,
	Florian Fainelli <f.fainelli@gmail.com>, 5kft <5kft@5kft.org>,
	Corentin Labbe <clabbe.montjoie@gmail.com>
Subject: [PATCH for 5.17] pinctrl-sunxi: sunxi_pinctrl_gpio_direction_in/output: use correct offset
Date: Wed, 26 Jan 2022 12:02:04 +0100	[thread overview]
Message-ID: <0f536cd8-01db-5d16-2cec-ec6d19409a49@xs4all.nl> (raw)
In-Reply-To: <20211206131648.1521868-1-hverkuil-cisco@xs4all.nl>

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 <hverkuil-cisco@xs4all.nl>
Reported-by: 5kft <5kft@5kft.org>
Suggested-by: 5kft <5kft@5kft.org>
Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Fixes: 8df89a7cbc63 (pinctrl-sunxi: don't call pinctrl_gpio_direction())
---
Corentin, can you please test this patch to verify that this fixes your
issue on the orangepiPC?
---
diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
index 80d6750c74a6..061323eab8b1 100644
--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
@@ -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)
@@ -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,

  parent reply	other threads:[~2022-01-26 11:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 13:16 [RFC PATCH 0/3] pinctrl: can_sleep and pinctrl_gpio_direction Hans Verkuil
2021-12-06 13:16 ` [RFC PATCH 1/3] pinctrl/core: check that can_sleep is true in pinctrl_gpio_direction() Hans Verkuil
2021-12-06 13:16 ` [RFC PATCH 2/3] pinctrl-bcm2835: don't call pinctrl_gpio_direction() Hans Verkuil
2021-12-06 17:29   ` Florian Fainelli
2021-12-16  2:43   ` Linus Walleij
2021-12-06 13:16 ` [RFC PATCH 3/3] pinctrl-sunxi: " Hans Verkuil
2021-12-16  2:44   ` Linus Walleij
     [not found] ` <CAHp75VcPhSvQvjA5WBO72Lb5idc6vkkodai_V=YmLWtsz-qg1A@mail.gmail.com>
2021-12-08  0:30   ` [RFC PATCH 0/3] pinctrl: can_sleep and pinctrl_gpio_direction Linus Walleij
2021-12-08  9:26     ` Hans Verkuil
2021-12-08 14:24       ` Andy Shevchenko
2022-01-26 11:02 ` Hans Verkuil [this message]
2022-01-26 15:22   ` [PATCH for 5.17] pinctrl-sunxi: sunxi_pinctrl_gpio_direction_in/output: use correct offset Corentin Labbe
2022-01-26 16:38   ` Jernej Škrabec
2022-01-28 20:40   ` Guenter Roeck
2022-02-13 20:42   ` Guenter Roeck
2022-02-14  8:44     ` Hans Verkuil
2022-02-14 21:28       ` Guenter Roeck
2022-02-15  0:19       ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f536cd8-01db-5d16-2cec-ec6d19409a49@xs4all.nl \
    --to=hverkuil-cisco@xs4all.nl \
    --cc=5kft@5kft.org \
    --cc=clabbe.montjoie@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=maxime@cerno.tech \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).