diff options
author | Patrice Chotard <patrice.chotard@st.com> | 2013-05-24 16:06:30 +0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-06-16 13:56:51 +0400 |
commit | 9ed3cd3338fcb6e5129be2b3091439e32be545b8 (patch) | |
tree | eb8a32d9e307ce9abbd94fc2c61cdc19b90f6d40 /drivers/pinctrl/pinctrl-abx500.c | |
parent | 10a8be541471f8eb3b22b147499bd5ef6ecb5e8e (diff) | |
download | linux-9ed3cd3338fcb6e5129be2b3091439e32be545b8.tar.xz |
pinctrl: abx500: allow to set pull up
On ABx500 chip family, all pins support only pull down except for
AB8540 which supports pull up/down on some pins.
Rework abx500_pin_config_set to be able to set pull up on
pins which support this feature.
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-abx500.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-abx500.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 823e261b4d85..363712bad7ef 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -725,7 +725,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, struct pullud *pullud = pct->soc->pullud; struct gpio_chip *chip = &pct->chip; unsigned offset; - int ret; + int ret = 0; enum pin_config_param param = pinconf_to_config_param(config); enum pin_config_param argument = pinconf_to_config_argument(config); @@ -763,6 +763,28 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev, offset, argument ? 0 : 1); break; + case PIN_CONFIG_BIAS_PULL_UP: + /* + * if argument = 1 set the pull up + * else clear the pull up + */ + ret = abx500_gpio_direction_input(chip, offset); + /* + * Some chips only support pull down, while some actually + * support both pull up and pull down. Such chips have + * a "pullud" range specified for the pins that support + * both features. If the pin is not within that range, do + * nothing + */ + if (pullud && + pin >= pullud->first_pin && + pin <= pullud->last_pin) { + ret = abx500_config_pull_updown(pct, + pin, + argument ? ABX500_GPIO_PULL_UP : ABX500_GPIO_PULL_NONE); + } + break; + case PIN_CONFIG_OUTPUT: ret = abx500_gpio_direction_output(chip, offset, argument); |