summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-abx500.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/pinctrl-abx500.c')
-rw-r--r--drivers/pinctrl/pinctrl-abx500.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index c3f2b4baeed2..f0e3f28022a5 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -96,6 +96,9 @@
96#define AB8540_GPIOX_VBAT_START 51 96#define AB8540_GPIOX_VBAT_START 51
97#define AB8540_GPIOX_VBAT_END 54 97#define AB8540_GPIOX_VBAT_END 54
98 98
99#define ABX500_GPIO_INPUT 0
100#define ABX500_GPIO_OUTPUT 1
101
99struct abx500_pinctrl { 102struct abx500_pinctrl {
100 struct device *dev; 103 struct device *dev;
101 struct pinctrl_dev *pctldev; 104 struct pinctrl_dev *pctldev;
@@ -286,12 +289,18 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
286 int ret; 289 int ret;
287 290
288 /* set direction as output */ 291 /* set direction as output */
289 ret = abx500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 1); 292 ret = abx500_gpio_set_bits(chip,
293 AB8500_GPIO_DIR1_REG,
294 offset,
295 ABX500_GPIO_OUTPUT);
290 if (ret < 0) 296 if (ret < 0)
291 return ret; 297 return ret;
292 298
293 /* disable pull down */ 299 /* disable pull down */
294 ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, offset, 1); 300 ret = abx500_gpio_set_bits(chip,
301 AB8500_GPIO_PUD1_REG,
302 offset,
303 ABX500_GPIO_PULL_NONE);
295 if (ret < 0) 304 if (ret < 0)
296 return ret; 305 return ret;
297 306
@@ -312,7 +321,10 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
312static int abx500_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 321static int abx500_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
313{ 322{
314 /* set the register as input */ 323 /* set the register as input */
315 return abx500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 0); 324 return abx500_gpio_set_bits(chip,
325 AB8500_GPIO_DIR1_REG,
326 offset,
327 ABX500_GPIO_INPUT);
316} 328}
317 329
318static int abx500_gpio_to_irq(struct gpio_chip *chip, unsigned offset) 330static int abx500_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
@@ -1032,7 +1044,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
1032 else 1044 else
1033 /* Chip only supports pull down */ 1045 /* Chip only supports pull down */
1034 ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, 1046 ret = abx500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG,
1035 offset, argument ? 0 : 1); 1047 offset,
1048 argument ? ABX500_GPIO_PULL_DOWN : ABX500_GPIO_PULL_NONE);
1036 break; 1049 break;
1037 1050
1038 case PIN_CONFIG_BIAS_PULL_UP: 1051 case PIN_CONFIG_BIAS_PULL_UP: