aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-02-18 03:04:55 -0500
committerStephen Warren <swarren@nvidia.com>2012-04-18 12:26:38 -0400
commit3e215d0a19c2a0c389bd9117573b6dd8e46f96a8 (patch)
treea45a82fc3e26459c8146cbe933229344cefa8b70 /drivers/gpio
parentc61b3da0aca4cccb1dca757eb94e443faba4e88f (diff)
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. Cc: Chris Ball <cjb@laptop.org> Cc: linux-mmc@vger.kernel.org Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Chris Ball <cjb@laptop.org> # for sdhci-tegra.c Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-tegra.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 4383a7205349..dc5184d57892 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -26,10 +26,10 @@
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/irqdomain.h> 28#include <linux/irqdomain.h>
29#include <linux/pinctrl/consumer.h>
29 30
30#include <asm/mach/irq.h> 31#include <asm/mach/irq.h>
31 32
32#include <mach/gpio-tegra.h>
33#include <mach/iomap.h> 33#include <mach/iomap.h>
34#include <mach/suspend.h> 34#include <mach/suspend.h>
35 35
@@ -108,18 +108,29 @@ static void tegra_gpio_mask_write(u32 reg, int gpio, int value)
108 tegra_gpio_writel(val, reg); 108 tegra_gpio_writel(val, reg);
109} 109}
110 110
111void tegra_gpio_enable(int gpio) 111static void tegra_gpio_enable(int gpio)
112{ 112{
113 tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1); 113 tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 1);
114} 114}
115EXPORT_SYMBOL_GPL(tegra_gpio_enable); 115EXPORT_SYMBOL_GPL(tegra_gpio_enable);
116 116
117void tegra_gpio_disable(int gpio) 117static void tegra_gpio_disable(int gpio)
118{ 118{
119 tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0); 119 tegra_gpio_mask_write(GPIO_MSK_CNF(gpio), gpio, 0);
120} 120}
121EXPORT_SYMBOL_GPL(tegra_gpio_disable); 121EXPORT_SYMBOL_GPL(tegra_gpio_disable);
122 122
123int tegra_gpio_request(struct gpio_chip *chip, unsigned offset)
124{
125 return pinctrl_request_gpio(offset);
126}
127
128void tegra_gpio_free(struct gpio_chip *chip, unsigned offset)
129{
130 pinctrl_free_gpio(offset);
131 tegra_gpio_disable(offset);
132}
133
123static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 134static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
124{ 135{
125 tegra_gpio_mask_write(GPIO_MSK_OUT(offset), offset, value); 136 tegra_gpio_mask_write(GPIO_MSK_OUT(offset), offset, value);
@@ -133,6 +144,7 @@ static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset)
133static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset) 144static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
134{ 145{
135 tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 0); 146 tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 0);
147 tegra_gpio_enable(offset);
136 return 0; 148 return 0;
137} 149}
138 150
@@ -141,6 +153,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
141{ 153{
142 tegra_gpio_set(chip, offset, value); 154 tegra_gpio_set(chip, offset, value);
143 tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 1); 155 tegra_gpio_mask_write(GPIO_MSK_OE(offset), offset, 1);
156 tegra_gpio_enable(offset);
144 return 0; 157 return 0;
145} 158}
146 159
@@ -151,13 +164,14 @@ static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
151 164
152static struct gpio_chip tegra_gpio_chip = { 165static struct gpio_chip tegra_gpio_chip = {
153 .label = "tegra-gpio", 166 .label = "tegra-gpio",
167 .request = tegra_gpio_request,
168 .free = tegra_gpio_free,
154 .direction_input = tegra_gpio_direction_input, 169 .direction_input = tegra_gpio_direction_input,
155 .get = tegra_gpio_get, 170 .get = tegra_gpio_get,
156 .direction_output = tegra_gpio_direction_output, 171 .direction_output = tegra_gpio_direction_output,
157 .set = tegra_gpio_set, 172 .set = tegra_gpio_set,
158 .to_irq = tegra_gpio_to_irq, 173 .to_irq = tegra_gpio_to_irq,
159 .base = 0, 174 .base = 0,
160 .ngpio = TEGRA_NR_GPIOS,
161}; 175};
162 176
163static void tegra_gpio_irq_ack(struct irq_data *d) 177static void tegra_gpio_irq_ack(struct irq_data *d)
@@ -493,20 +507,6 @@ static int __init tegra_gpio_init(void)
493} 507}
494postcore_initcall(tegra_gpio_init); 508postcore_initcall(tegra_gpio_init);
495 509
496void tegra_gpio_config(struct tegra_gpio_table *table, int num)
497{
498 int i;
499
500 for (i = 0; i < num; i++) {
501 int gpio = table[i].gpio;
502
503 if (table[i].enable)
504 tegra_gpio_enable(gpio);
505 else
506 tegra_gpio_disable(gpio);
507 }
508}
509
510#ifdef CONFIG_DEBUG_FS 510#ifdef CONFIG_DEBUG_FS
511 511
512#include <linux/debugfs.h> 512#include <linux/debugfs.h>