From 38c804ed53aae503693338e0135a506a81ce2c11 Mon Sep 17 00:00:00 2001 From: Laxman Dewangan Date: Tue, 24 Apr 2012 19:03:26 +0530 Subject: gpio: tegra: implement gpio_request and gpio_free. Recent pinctrl discussions concluded that gpiolib APIs should in fact do whatever is required to mux a GPIO onto pins. This change is based on the work done by Stephen Warren in mainline kernel. ----- commit 3e215d0a19c2a0c389bd9117573b6dd8e46f96a8 gpio: tegra: Hide tegra_gpio_enable/disable() Recent pinctrl discussions concluded that gpiolib APIs should in fact do whatever is required to mux a GPIO onto pins, by calling pinctrl APIs if required. This change implements this for the Tegra GPIO driver, and removes calls to the Tegra-specific APIs from drivers and board files. ---- Change-Id: I482ea5c177cf2ee6fa06ddac48b556f1508efacb Signed-off-by: Laxman Dewangan Reviewed-on: http://git-master/r/98466 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Pritesh Raithatha Reviewed-by: Stephen Warren --- drivers/gpio/gpio-tegra.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 3a0893f9cdc3..17e9c1cfdf4e 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -191,6 +191,7 @@ static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset) static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 0); + tegra_gpio_enable(offset); return 0; } @@ -199,6 +200,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, { tegra_gpio_set(chip, offset, value); tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 1); + tegra_gpio_enable(offset); return 0; } @@ -213,8 +215,20 @@ static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset) return TEGRA_GPIO_TO_IRQ(offset); } +static int tegra_gpio_request(struct gpio_chip *chip, unsigned offset) +{ + return 0; +} + +static void tegra_gpio_free(struct gpio_chip *chip, unsigned offset) +{ + tegra_gpio_disable(offset); +} + static struct gpio_chip tegra_gpio_chip = { .label = "tegra-gpio", + .request = tegra_gpio_request, + .free = tegra_gpio_free, .direction_input = tegra_gpio_direction_input, .get = tegra_gpio_get, .direction_output = tegra_gpio_direction_output, -- cgit v1.2.3