[RFC,11/18] pinctrl: bcm2835: Fix BCM7211 pinconf handling
diff mbox series

Message ID 1563393026-17118-12-git-send-email-wahrenst@gmx.net
State New
Headers show
Series
  • ARM: Add minimal Raspberry Pi 4 support
Related show

Commit Message

Stefan Wahren July 17, 2019, 7:50 p.m. UTC
The BCM7211 pinconf doesn't look correct and behaves differently
to BCM2835. So fix this accordingly.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--
2.7.4

Comments

Linus Walleij Aug. 2, 2019, 10:06 p.m. UTC | #1
On Wed, Jul 17, 2019 at 9:50 PM Stefan Wahren <wahrenst@gmx.net> wrote:

> The BCM7211 pinconf doesn't look correct and behaves differently
> to BCM2835. So fix this accordingly.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

If this is fixing code in earlier patches just squash them?

Yours,
Linus Walleij

Patch
diff mbox series

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 35d9f95..029adad 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -999,12 +999,10 @@  static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,

 	for (i = 0; i < num_configs; i++) {
 		param = pinconf_to_config_param(configs[i]);
-		if (param != BCM2835_PINCONF_PARAM_PULL)
-			return -EINVAL;
 		arg = pinconf_to_config_argument(configs[i]);

 		/* convert to 7211 value */
-		switch (arg) {
+		switch (param) {
 		case PIN_CONFIG_BIAS_DISABLE:
 			arg = BCM7211_PINCONFIG_PULL_NONE;
 			break;
@@ -1014,6 +1012,8 @@  static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,
 		case PIN_CONFIG_BIAS_PULL_UP:
 			arg = BCM7211_PINCONFIG_PULL_UP;
 			break;
+		default:
+			return -ENOTSUPP;
 		}

 		off = PUD_7211_REG_OFFSET(pin);
@@ -1031,6 +1031,7 @@  static int bcm7211_pinconf_set(struct pinctrl_dev *pctldev,
 }

 static const struct pinconf_ops bcm7211_pinconf_ops = {
+	.is_generic = true,
 	.pin_config_get = bcm2835_pinconf_get,
 	.pin_config_set = bcm7211_pinconf_set,
 };