pinctrl/abx500: adjust offset for get_mode()
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 5 Feb 2013 19:10:57 +0000 (20:10 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 7 Feb 2013 16:26:53 +0000 (17:26 +0100)
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@linaro.org>
Reported-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-abx500.c

index 17508b5820f571b8ff7c0d3f70aeb28d3c9ff18e..0b3aa1c28fba95f9c7707d0cad6e2acd91b0dbac 100644 (file)
@@ -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;
 
This page took 0.027579 seconds and 5 git commands to generate.