diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2014-05-21 19:39:35 +0530 |
---|---|---|
committer | Matthew Pedro <mapedro@nvidia.com> | 2014-09-15 10:24:38 -0700 |
commit | 3edac78ac13b471244e6053c85088916b1d9ee0b (patch) | |
tree | 46eea64a4a2877dc00500ee099baf2a0bb053cc1 | |
parent | 328216a739a24d767de68fe4c284de29d14ca093 (diff) |
gpio: tegra: call pinctrl dirctions apis on direction input/output
Set the pins in different direction based on client request from gpio.
This will help to non-tristate the pin on gpio output mode or enable
input on gpio input mode without any explicit condition.
Bug 200033491
Change-Id: I074451e344bfd8465aceb39c1091809da4f58f58
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit c520a6048a942b5870f560979045c74659c8fe76)
Reviewed-on: http://git-master/r/#/c/415991/
Reviewed-on: http://git-master/r/498326
Reviewed-by: Winnie Hsu <whsu@nvidia.com>
Tested-by: Winnie Hsu <whsu@nvidia.com>
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 88524fe6bfd7..707e1a5a04b9 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -154,12 +154,12 @@ void tegra_gpio_init_configure(unsigned gpio, bool is_input, int value) static int tegra_gpio_request(struct gpio_chip *chip, unsigned offset) { - return pinctrl_request_gpio(offset); + return pinctrl_request_gpio(chip->base + offset); } static void tegra_gpio_free(struct gpio_chip *chip, unsigned offset) { - pinctrl_free_gpio(offset); + pinctrl_free_gpio(chip->base + offset); tegra_gpio_disable(offset); } @@ -180,17 +180,33 @@ static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset) static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { + int ret; + tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 0); tegra_gpio_enable(offset); + + ret = pinctrl_gpio_direction_input(chip->base + offset); + if (ret < 0) + dev_err(chip->dev, + "Tegra gpio input: pinctrl input failed: %d\n", ret); + return 0; } static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { + int ret; + tegra_gpio_set(chip, offset, value); tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 1); tegra_gpio_enable(offset); + + ret = pinctrl_gpio_direction_output(chip->base + offset); + if (ret < 0) + dev_err(chip->dev, + "Tegra gpio output: pinctrl output failed: %d\n", ret); + return 0; } |