[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1360254457-17024-1-git-send-email-linus.walleij@stericsson.com>
Date: Thu, 7 Feb 2013 17:27:37 +0100
From: Linus Walleij <linus.walleij@...ricsson.com>
To: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>
Cc: Stephen Warren <swarren@...dia.com>,
Anmar Oueja <anmar.oueja@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>,
Lee Jones <lee.jones@...aro.org>
Subject: [PATCH] pinctrl/abx500: adjust offset for get_mode()
From: Linus Walleij <linus.walleij@...aro.org>
The set_mode() and get_mode() functions in the abx500 were
not mirrored, leading to the wrong GPIO control bits being
read out.
Cc: Lee Jones <lee.jones@...aro.org>
Reported-by: Patrice Chotard <patrice.chotard@...com>
Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
---
drivers/pinctrl/pinctrl-abx500.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index 17508b5..0b3aa1c 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -401,6 +401,8 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
bool alt_bit2;
struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev);
struct alternate_functions af = pct->soc->alternate_functions[gpio];
+ /* on ABx5xx, there is no GPIO0, so adjust the offset */
+ unsigned offset = gpio - 1;
/*
* if gpiosel_bit is set to unused,
@@ -410,7 +412,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
return ABX500_DEFAULT;
/* read GpioSelx register */
- abx500_gpio_get_bit(chip, AB8500_GPIO_SEL1_REG + (gpio / 8),
+ abx500_gpio_get_bit(chip, AB8500_GPIO_SEL1_REG + (offset / 8),
af.gpiosel_bit, &bit_mode);
mode = bit_mode;
--
1.7.11.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists