diff options
author | Olof Johansson <olof@lixom.net> | 2012-05-10 02:51:32 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-05-10 02:51:32 -0400 |
commit | bf98a6eaa9964fef49f186834713bfc57d16ede1 (patch) | |
tree | 46dc9e802c90fa7d6854f19f829945ea9bfb1bc8 /drivers/gpio | |
parent | d48b97b403d23f6df0b990cee652bdf9a52337a3 (diff) | |
parent | 22bfe102c0c39f0bac24950b875e7bfdeb329dd9 (diff) |
Merge branch 'for-3.5/dt' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra into next/dt2
By Stephen Warren (29) and others
via Stephen Warren
* 'for-3.5/dt' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra: (43 commits)
ARM: dt: tegra trimslice: add support for audio
ARM: dt: tegra trimslice: enable SDHCI1 controller
ARM: dt: tegra trimslice: add RTC I2C device
ARM: dt: tegra seaboard: add i2c devices
ARM: dt: tegra seaboard: configure I2C2 pinmux
ARM: dt: tegra seaboard: fix I2C2 SCL rate
ARM: dt: tegra: enable als and proximity sensor
+ pinctrl mergebase branch
The pinctrl mergebase branch merge conflicts in drivers/pinctrl/core.c
that were resolved.
Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 12f349b3830d..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 | ||
111 | void tegra_gpio_enable(int gpio) | 111 | static 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 | } |
115 | EXPORT_SYMBOL_GPL(tegra_gpio_enable); | 115 | EXPORT_SYMBOL_GPL(tegra_gpio_enable); |
116 | 116 | ||
117 | void tegra_gpio_disable(int gpio) | 117 | static 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 | } |
121 | EXPORT_SYMBOL_GPL(tegra_gpio_disable); | 121 | EXPORT_SYMBOL_GPL(tegra_gpio_disable); |
122 | 122 | ||
123 | int tegra_gpio_request(struct gpio_chip *chip, unsigned offset) | ||
124 | { | ||
125 | return pinctrl_request_gpio(offset); | ||
126 | } | ||
127 | |||
128 | void tegra_gpio_free(struct gpio_chip *chip, unsigned offset) | ||
129 | { | ||
130 | pinctrl_free_gpio(offset); | ||
131 | tegra_gpio_disable(offset); | ||
132 | } | ||
133 | |||
123 | static void tegra_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 134 | static 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) | |||
133 | static int tegra_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 144 | static 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 | ||
152 | static struct gpio_chip tegra_gpio_chip = { | 165 | static 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 | ||
163 | static void tegra_gpio_irq_ack(struct irq_data *d) | 177 | static void tegra_gpio_irq_ack(struct irq_data *d) |
@@ -224,6 +238,9 @@ static int tegra_gpio_irq_set_type(struct irq_data *d, unsigned int type) | |||
224 | 238 | ||
225 | spin_unlock_irqrestore(&bank->lvl_lock[port], flags); | 239 | spin_unlock_irqrestore(&bank->lvl_lock[port], flags); |
226 | 240 | ||
241 | tegra_gpio_mask_write(GPIO_MSK_OE(gpio), gpio, 0); | ||
242 | tegra_gpio_enable(gpio); | ||
243 | |||
227 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) | 244 | if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) |
228 | __irq_set_handler_locked(d->irq, handle_level_irq); | 245 | __irq_set_handler_locked(d->irq, handle_level_irq); |
229 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) | 246 | else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
@@ -490,20 +507,6 @@ static int __init tegra_gpio_init(void) | |||
490 | } | 507 | } |
491 | postcore_initcall(tegra_gpio_init); | 508 | postcore_initcall(tegra_gpio_init); |
492 | 509 | ||
493 | void tegra_gpio_config(struct tegra_gpio_table *table, int num) | ||
494 | { | ||
495 | int i; | ||
496 | |||
497 | for (i = 0; i < num; i++) { | ||
498 | int gpio = table[i].gpio; | ||
499 | |||
500 | if (table[i].enable) | ||
501 | tegra_gpio_enable(gpio); | ||
502 | else | ||
503 | tegra_gpio_disable(gpio); | ||
504 | } | ||
505 | } | ||
506 | |||
507 | #ifdef CONFIG_DEBUG_FS | 510 | #ifdef CONFIG_DEBUG_FS |
508 | 511 | ||
509 | #include <linux/debugfs.h> | 512 | #include <linux/debugfs.h> |