diff options
author | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:15 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2011-04-26 04:22:59 -0400 |
commit | 07f9479a40cc778bc1462ada11f95b01360ae4ff (patch) | |
tree | 0676cf38df3844004bb3ebfd99dfa67a4a8998f5 /drivers/gpio | |
parent | 9d5e6bdb3013acfb311ab407eeca0b6a6a3dedbf (diff) | |
parent | cd2e49e90f1cae7726c9a2c54488d881d7f1cd1c (diff) |
Merge branch 'master' into for-next
Fast-forwarded to current state of Linus' tree as there are patches to be
applied for files that didn't exist on the old branch.
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/Kconfig | 12 | ||||
-rw-r--r-- | drivers/gpio/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpio/ab8500-gpio.c | 522 | ||||
-rw-r--r-- | drivers/gpio/adp5588-gpio.c | 8 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 45 | ||||
-rw-r--r-- | drivers/gpio/janz-ttl.c | 3 | ||||
-rw-r--r-- | drivers/gpio/max732x.c | 8 | ||||
-rw-r--r-- | drivers/gpio/mc33880.c | 2 | ||||
-rw-r--r-- | drivers/gpio/ml_ioh_gpio.c | 1 | ||||
-rw-r--r-- | drivers/gpio/pca953x.c | 11 | ||||
-rw-r--r-- | drivers/gpio/pch_gpio.c | 1 | ||||
-rw-r--r-- | drivers/gpio/pl061.c | 14 | ||||
-rw-r--r-- | drivers/gpio/rdc321x-gpio.c | 3 | ||||
-rw-r--r-- | drivers/gpio/sch_gpio.c | 57 | ||||
-rw-r--r-- | drivers/gpio/stmpe-gpio.c | 12 | ||||
-rw-r--r-- | drivers/gpio/sx150x.c | 9 | ||||
-rw-r--r-- | drivers/gpio/tc3589x-gpio.c | 12 | ||||
-rw-r--r-- | drivers/gpio/timbgpio.c | 24 | ||||
-rw-r--r-- | drivers/gpio/vr41xx_giu.c | 12 |
19 files changed, 634 insertions, 123 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index b46442d7d66e..d3b295305542 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -100,18 +100,21 @@ config GPIO_VR41XX | |||
100 | Say yes here to support the NEC VR4100 series General-purpose I/O Uint | 100 | Say yes here to support the NEC VR4100 series General-purpose I/O Uint |
101 | 101 | ||
102 | config GPIO_SCH | 102 | config GPIO_SCH |
103 | tristate "Intel SCH GPIO" | 103 | tristate "Intel SCH/TunnelCreek GPIO" |
104 | depends on GPIOLIB && PCI && X86 | 104 | depends on GPIOLIB && PCI && X86 |
105 | select MFD_CORE | 105 | select MFD_CORE |
106 | select LPC_SCH | 106 | select LPC_SCH |
107 | help | 107 | help |
108 | Say yes here to support GPIO interface on Intel Poulsbo SCH. | 108 | Say yes here to support GPIO interface on Intel Poulsbo SCH |
109 | or Intel Tunnel Creek processor. | ||
109 | The Intel SCH contains a total of 14 GPIO pins. Ten GPIOs are | 110 | The Intel SCH contains a total of 14 GPIO pins. Ten GPIOs are |
110 | powered by the core power rail and are turned off during sleep | 111 | powered by the core power rail and are turned off during sleep |
111 | modes (S3 and higher). The remaining four GPIOs are powered by | 112 | modes (S3 and higher). The remaining four GPIOs are powered by |
112 | the Intel SCH suspend power supply. These GPIOs remain | 113 | the Intel SCH suspend power supply. These GPIOs remain |
113 | active during S3. The suspend powered GPIOs can be used to wake the | 114 | active during S3. The suspend powered GPIOs can be used to wake the |
114 | system from the Suspend-to-RAM state. | 115 | system from the Suspend-to-RAM state. |
116 | The Intel Tunnel Creek processor has 5 GPIOs powered by the | ||
117 | core power rail and 9 from suspend power supply. | ||
115 | 118 | ||
116 | This driver can also be built as a module. If so, the module | 119 | This driver can also be built as a module. If so, the module |
117 | will be called sch-gpio. | 120 | will be called sch-gpio. |
@@ -411,4 +414,9 @@ config GPIO_JANZ_TTL | |||
411 | This driver provides support for driving the pins in output | 414 | This driver provides support for driving the pins in output |
412 | mode only. Input mode is not supported. | 415 | mode only. Input mode is not supported. |
413 | 416 | ||
417 | config AB8500_GPIO | ||
418 | bool "ST-Ericsson AB8500 Mixed Signal Circuit gpio functions" | ||
419 | depends on AB8500_CORE && BROKEN | ||
420 | help | ||
421 | Select this to enable the AB8500 IC GPIO driver | ||
414 | endif | 422 | endif |
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 3351cf87b0ed..becef5954356 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile | |||
@@ -42,3 +42,4 @@ obj-$(CONFIG_GPIO_JANZ_TTL) += janz-ttl.o | |||
42 | obj-$(CONFIG_GPIO_SX150X) += sx150x.o | 42 | obj-$(CONFIG_GPIO_SX150X) += sx150x.o |
43 | obj-$(CONFIG_GPIO_VX855) += vx855_gpio.o | 43 | obj-$(CONFIG_GPIO_VX855) += vx855_gpio.o |
44 | obj-$(CONFIG_GPIO_ML_IOH) += ml_ioh_gpio.o | 44 | obj-$(CONFIG_GPIO_ML_IOH) += ml_ioh_gpio.o |
45 | obj-$(CONFIG_AB8500_GPIO) += ab8500-gpio.o | ||
diff --git a/drivers/gpio/ab8500-gpio.c b/drivers/gpio/ab8500-gpio.c new file mode 100644 index 000000000000..e7b834d054b7 --- /dev/null +++ b/drivers/gpio/ab8500-gpio.c | |||
@@ -0,0 +1,522 @@ | |||
1 | /* | ||
2 | * Copyright (C) ST-Ericsson SA 2011 | ||
3 | * | ||
4 | * Author: BIBEK BASU <bibek.basu@stericsson.com> | ||
5 | * License terms: GNU General Public License (GPL) version 2 | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/slab.h> | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/err.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/gpio.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/mfd/ab8500.h> | ||
23 | #include <linux/mfd/abx500.h> | ||
24 | #include <linux/mfd/ab8500/gpio.h> | ||
25 | |||
26 | /* | ||
27 | * GPIO registers offset | ||
28 | * Bank: 0x10 | ||
29 | */ | ||
30 | #define AB8500_GPIO_SEL1_REG 0x00 | ||
31 | #define AB8500_GPIO_SEL2_REG 0x01 | ||
32 | #define AB8500_GPIO_SEL3_REG 0x02 | ||
33 | #define AB8500_GPIO_SEL4_REG 0x03 | ||
34 | #define AB8500_GPIO_SEL5_REG 0x04 | ||
35 | #define AB8500_GPIO_SEL6_REG 0x05 | ||
36 | |||
37 | #define AB8500_GPIO_DIR1_REG 0x10 | ||
38 | #define AB8500_GPIO_DIR2_REG 0x11 | ||
39 | #define AB8500_GPIO_DIR3_REG 0x12 | ||
40 | #define AB8500_GPIO_DIR4_REG 0x13 | ||
41 | #define AB8500_GPIO_DIR5_REG 0x14 | ||
42 | #define AB8500_GPIO_DIR6_REG 0x15 | ||
43 | |||
44 | #define AB8500_GPIO_OUT1_REG 0x20 | ||
45 | #define AB8500_GPIO_OUT2_REG 0x21 | ||
46 | #define AB8500_GPIO_OUT3_REG 0x22 | ||
47 | #define AB8500_GPIO_OUT4_REG 0x23 | ||
48 | #define AB8500_GPIO_OUT5_REG 0x24 | ||
49 | #define AB8500_GPIO_OUT6_REG 0x25 | ||
50 | |||
51 | #define AB8500_GPIO_PUD1_REG 0x30 | ||
52 | #define AB8500_GPIO_PUD2_REG 0x31 | ||
53 | #define AB8500_GPIO_PUD3_REG 0x32 | ||
54 | #define AB8500_GPIO_PUD4_REG 0x33 | ||
55 | #define AB8500_GPIO_PUD5_REG 0x34 | ||
56 | #define AB8500_GPIO_PUD6_REG 0x35 | ||
57 | |||
58 | #define AB8500_GPIO_IN1_REG 0x40 | ||
59 | #define AB8500_GPIO_IN2_REG 0x41 | ||
60 | #define AB8500_GPIO_IN3_REG 0x42 | ||
61 | #define AB8500_GPIO_IN4_REG 0x43 | ||
62 | #define AB8500_GPIO_IN5_REG 0x44 | ||
63 | #define AB8500_GPIO_IN6_REG 0x45 | ||
64 | #define AB8500_GPIO_ALTFUN_REG 0x45 | ||
65 | #define ALTFUN_REG_INDEX 6 | ||
66 | #define AB8500_NUM_GPIO 42 | ||
67 | #define AB8500_NUM_VIR_GPIO_IRQ 16 | ||
68 | |||
69 | enum ab8500_gpio_action { | ||
70 | NONE, | ||
71 | STARTUP, | ||
72 | SHUTDOWN, | ||
73 | MASK, | ||
74 | UNMASK | ||
75 | }; | ||
76 | |||
77 | struct ab8500_gpio { | ||
78 | struct gpio_chip chip; | ||
79 | struct ab8500 *parent; | ||
80 | struct device *dev; | ||
81 | struct mutex lock; | ||
82 | u32 irq_base; | ||
83 | enum ab8500_gpio_action irq_action; | ||
84 | u16 rising; | ||
85 | u16 falling; | ||
86 | }; | ||
87 | /** | ||
88 | * to_ab8500_gpio() - get the pointer to ab8500_gpio | ||
89 | * @chip: Member of the structure ab8500_gpio | ||
90 | */ | ||
91 | static inline struct ab8500_gpio *to_ab8500_gpio(struct gpio_chip *chip) | ||
92 | { | ||
93 | return container_of(chip, struct ab8500_gpio, chip); | ||
94 | } | ||
95 | |||
96 | static int ab8500_gpio_set_bits(struct gpio_chip *chip, u8 reg, | ||
97 | unsigned offset, int val) | ||
98 | { | ||
99 | struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); | ||
100 | u8 pos = offset % 8; | ||
101 | int ret; | ||
102 | |||
103 | reg = reg + (offset / 8); | ||
104 | ret = abx500_mask_and_set_register_interruptible(ab8500_gpio->dev, | ||
105 | AB8500_MISC, reg, 1 << pos, val << pos); | ||
106 | if (ret < 0) | ||
107 | dev_err(ab8500_gpio->dev, "%s write failed\n", __func__); | ||
108 | return ret; | ||
109 | } | ||
110 | /** | ||
111 | * ab8500_gpio_get() - Get the particular GPIO value | ||
112 | * @chip: Gpio device | ||
113 | * @offset: GPIO number to read | ||
114 | */ | ||
115 | static int ab8500_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
116 | { | ||
117 | struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); | ||
118 | u8 mask = 1 << (offset % 8); | ||
119 | u8 reg = AB8500_GPIO_OUT1_REG + (offset / 8); | ||
120 | int ret; | ||
121 | u8 data; | ||
122 | ret = abx500_get_register_interruptible(ab8500_gpio->dev, AB8500_MISC, | ||
123 | reg, &data); | ||
124 | if (ret < 0) { | ||
125 | dev_err(ab8500_gpio->dev, "%s read failed\n", __func__); | ||
126 | return ret; | ||
127 | } | ||
128 | return (data & mask) >> (offset % 8); | ||
129 | } | ||
130 | |||
131 | static void ab8500_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | ||
132 | { | ||
133 | struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); | ||
134 | int ret; | ||
135 | /* Write the data */ | ||
136 | ret = ab8500_gpio_set_bits(chip, AB8500_GPIO_OUT1_REG, offset, 1); | ||
137 | if (ret < 0) | ||
138 | dev_err(ab8500_gpio->dev, "%s write failed\n", __func__); | ||
139 | } | ||
140 | |||
141 | static int ab8500_gpio_direction_output(struct gpio_chip *chip, unsigned offset, | ||
142 | int val) | ||
143 | { | ||
144 | int ret; | ||
145 | /* set direction as output */ | ||
146 | ret = ab8500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 1); | ||
147 | if (ret < 0) | ||
148 | return ret; | ||
149 | /* disable pull down */ | ||
150 | ret = ab8500_gpio_set_bits(chip, AB8500_GPIO_PUD1_REG, offset, 1); | ||
151 | if (ret < 0) | ||
152 | return ret; | ||
153 | /* set the output as 1 or 0 */ | ||
154 | return ab8500_gpio_set_bits(chip, AB8500_GPIO_OUT1_REG, offset, val); | ||
155 | |||
156 | } | ||
157 | |||
158 | static int ab8500_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | ||
159 | { | ||
160 | /* set the register as input */ | ||
161 | return ab8500_gpio_set_bits(chip, AB8500_GPIO_DIR1_REG, offset, 0); | ||
162 | } | ||
163 | |||
164 | static int ab8500_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | ||
165 | { | ||
166 | /* | ||
167 | * Only some GPIOs are interrupt capable, and they are | ||
168 | * organized in discontiguous clusters: | ||
169 | * | ||
170 | * GPIO6 to GPIO13 | ||
171 | * GPIO24 and GPIO25 | ||
172 | * GPIO36 to GPIO41 | ||
173 | */ | ||
174 | static struct ab8500_gpio_irq_cluster { | ||
175 | int start; | ||
176 | int end; | ||
177 | } clusters[] = { | ||
178 | {.start = 6, .end = 13}, | ||
179 | {.start = 24, .end = 25}, | ||
180 | {.start = 36, .end = 41}, | ||
181 | }; | ||
182 | struct ab8500_gpio *ab8500_gpio = to_ab8500_gpio(chip); | ||
183 | int base = ab8500_gpio->irq_base; | ||
184 | int i; | ||
185 | |||
186 | for (i = 0; i < ARRAY_SIZE(clusters); i++) { | ||
187 | struct ab8500_gpio_irq_cluster *cluster = &clusters[i]; | ||
188 | |||
189 | if (offset >= cluster->start && offset <= cluster->end) | ||
190 | return base + offset - cluster->start; | ||
191 | |||
192 | /* Advance by the number of gpios in this cluster */ | ||
193 | base += cluster->end - cluster->start + 1; | ||
194 | } | ||
195 | |||
196 | return -EINVAL; | ||
197 | } | ||
198 | |||
199 | static struct gpio_chip ab8500gpio_chip = { | ||
200 | .label = "ab8500_gpio", | ||
201 | .owner = THIS_MODULE, | ||
202 | .direction_input = ab8500_gpio_direction_input, | ||
203 | .get = ab8500_gpio_get, | ||
204 | .direction_output = ab8500_gpio_direction_output, | ||
205 | .set = ab8500_gpio_set, | ||
206 | .to_irq = ab8500_gpio_to_irq, | ||
207 | }; | ||
208 | |||
209 | static unsigned int irq_to_rising(unsigned int irq) | ||
210 | { | ||
211 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
212 | int offset = irq - ab8500_gpio->irq_base; | ||
213 | int new_irq = offset + AB8500_INT_GPIO6R | ||
214 | + ab8500_gpio->parent->irq_base; | ||
215 | return new_irq; | ||
216 | } | ||
217 | |||
218 | static unsigned int irq_to_falling(unsigned int irq) | ||
219 | { | ||
220 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
221 | int offset = irq - ab8500_gpio->irq_base; | ||
222 | int new_irq = offset + AB8500_INT_GPIO6F | ||
223 | + ab8500_gpio->parent->irq_base; | ||
224 | return new_irq; | ||
225 | |||
226 | } | ||
227 | |||
228 | static unsigned int rising_to_irq(unsigned int irq, void *dev) | ||
229 | { | ||
230 | struct ab8500_gpio *ab8500_gpio = dev; | ||
231 | int offset = irq - AB8500_INT_GPIO6R | ||
232 | - ab8500_gpio->parent->irq_base ; | ||
233 | int new_irq = offset + ab8500_gpio->irq_base; | ||
234 | return new_irq; | ||
235 | } | ||
236 | |||
237 | static unsigned int falling_to_irq(unsigned int irq, void *dev) | ||
238 | { | ||
239 | struct ab8500_gpio *ab8500_gpio = dev; | ||
240 | int offset = irq - AB8500_INT_GPIO6F | ||
241 | - ab8500_gpio->parent->irq_base ; | ||
242 | int new_irq = offset + ab8500_gpio->irq_base; | ||
243 | return new_irq; | ||
244 | |||
245 | } | ||
246 | |||
247 | /* | ||
248 | * IRQ handler | ||
249 | */ | ||
250 | |||
251 | static irqreturn_t handle_rising(int irq, void *dev) | ||
252 | { | ||
253 | |||
254 | handle_nested_irq(rising_to_irq(irq , dev)); | ||
255 | return IRQ_HANDLED; | ||
256 | } | ||
257 | |||
258 | static irqreturn_t handle_falling(int irq, void *dev) | ||
259 | { | ||
260 | |||
261 | handle_nested_irq(falling_to_irq(irq, dev)); | ||
262 | return IRQ_HANDLED; | ||
263 | } | ||
264 | |||
265 | static void ab8500_gpio_irq_lock(unsigned int irq) | ||
266 | { | ||
267 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
268 | mutex_lock(&ab8500_gpio->lock); | ||
269 | } | ||
270 | |||
271 | static void ab8500_gpio_irq_sync_unlock(unsigned int irq) | ||
272 | { | ||
273 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
274 | int offset = irq - ab8500_gpio->irq_base; | ||
275 | bool rising = ab8500_gpio->rising & BIT(offset); | ||
276 | bool falling = ab8500_gpio->falling & BIT(offset); | ||
277 | int ret; | ||
278 | |||
279 | switch (ab8500_gpio->irq_action) { | ||
280 | case STARTUP: | ||
281 | if (rising) | ||
282 | ret = request_threaded_irq(irq_to_rising(irq), | ||
283 | NULL, handle_rising, | ||
284 | IRQF_TRIGGER_RISING, | ||
285 | "ab8500-gpio-r", ab8500_gpio); | ||
286 | if (falling) | ||
287 | ret = request_threaded_irq(irq_to_falling(irq), | ||
288 | NULL, handle_falling, | ||
289 | IRQF_TRIGGER_FALLING, | ||
290 | "ab8500-gpio-f", ab8500_gpio); | ||
291 | break; | ||
292 | case SHUTDOWN: | ||
293 | if (rising) | ||
294 | free_irq(irq_to_rising(irq), ab8500_gpio); | ||
295 | if (falling) | ||
296 | free_irq(irq_to_falling(irq), ab8500_gpio); | ||
297 | break; | ||
298 | case MASK: | ||
299 | if (rising) | ||
300 | disable_irq(irq_to_rising(irq)); | ||
301 | if (falling) | ||
302 | disable_irq(irq_to_falling(irq)); | ||
303 | break; | ||
304 | case UNMASK: | ||
305 | if (rising) | ||
306 | enable_irq(irq_to_rising(irq)); | ||
307 | if (falling) | ||
308 | enable_irq(irq_to_falling(irq)); | ||
309 | break; | ||
310 | case NONE: | ||
311 | break; | ||
312 | } | ||
313 | ab8500_gpio->irq_action = NONE; | ||
314 | ab8500_gpio->rising &= ~(BIT(offset)); | ||
315 | ab8500_gpio->falling &= ~(BIT(offset)); | ||
316 | mutex_unlock(&ab8500_gpio->lock); | ||
317 | } | ||
318 | |||
319 | |||
320 | static void ab8500_gpio_irq_mask(unsigned int irq) | ||
321 | { | ||
322 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
323 | ab8500_gpio->irq_action = MASK; | ||
324 | } | ||
325 | |||
326 | static void ab8500_gpio_irq_unmask(unsigned int irq) | ||
327 | { | ||
328 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
329 | ab8500_gpio->irq_action = UNMASK; | ||
330 | } | ||
331 | |||
332 | static int ab8500_gpio_irq_set_type(unsigned int irq, unsigned int type) | ||
333 | { | ||
334 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
335 | int offset = irq - ab8500_gpio->irq_base; | ||
336 | |||
337 | if (type == IRQ_TYPE_EDGE_BOTH) { | ||
338 | ab8500_gpio->rising = BIT(offset); | ||
339 | ab8500_gpio->falling = BIT(offset); | ||
340 | } else if (type == IRQ_TYPE_EDGE_RISING) { | ||
341 | ab8500_gpio->rising = BIT(offset); | ||
342 | } else { | ||
343 | ab8500_gpio->falling = BIT(offset); | ||
344 | } | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | unsigned int ab8500_gpio_irq_startup(unsigned int irq) | ||
349 | { | ||
350 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
351 | ab8500_gpio->irq_action = STARTUP; | ||
352 | return 0; | ||
353 | } | ||
354 | |||
355 | void ab8500_gpio_irq_shutdown(unsigned int irq) | ||
356 | { | ||
357 | struct ab8500_gpio *ab8500_gpio = get_irq_chip_data(irq); | ||
358 | ab8500_gpio->irq_action = SHUTDOWN; | ||
359 | } | ||
360 | |||
361 | static struct irq_chip ab8500_gpio_irq_chip = { | ||
362 | .name = "ab8500-gpio", | ||
363 | .startup = ab8500_gpio_irq_startup, | ||
364 | .shutdown = ab8500_gpio_irq_shutdown, | ||
365 | .bus_lock = ab8500_gpio_irq_lock, | ||
366 | .bus_sync_unlock = ab8500_gpio_irq_sync_unlock, | ||
367 | .mask = ab8500_gpio_irq_mask, | ||
368 | .unmask = ab8500_gpio_irq_unmask, | ||
369 | .set_type = ab8500_gpio_irq_set_type, | ||
370 | }; | ||
371 | |||
372 | static int ab8500_gpio_irq_init(struct ab8500_gpio *ab8500_gpio) | ||
373 | { | ||
374 | u32 base = ab8500_gpio->irq_base; | ||
375 | int irq; | ||
376 | |||
377 | for (irq = base; irq < base + AB8500_NUM_VIR_GPIO_IRQ ; irq++) { | ||
378 | set_irq_chip_data(irq, ab8500_gpio); | ||
379 | set_irq_chip_and_handler(irq, &ab8500_gpio_irq_chip, | ||
380 | handle_simple_irq); | ||
381 | set_irq_nested_thread(irq, 1); | ||
382 | #ifdef CONFIG_ARM | ||
383 | set_irq_flags(irq, IRQF_VALID); | ||
384 | #else | ||
385 | set_irq_noprobe(irq); | ||
386 | #endif | ||
387 | } | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
392 | static void ab8500_gpio_irq_remove(struct ab8500_gpio *ab8500_gpio) | ||
393 | { | ||
394 | int base = ab8500_gpio->irq_base; | ||
395 | int irq; | ||
396 | |||
397 | for (irq = base; irq < base + AB8500_NUM_VIR_GPIO_IRQ; irq++) { | ||
398 | #ifdef CONFIG_ARM | ||
399 | set_irq_flags(irq, 0); | ||
400 | #endif | ||
401 | set_irq_chip_and_handler(irq, NULL, NULL); | ||
402 | set_irq_chip_data(irq, NULL); | ||
403 | } | ||
404 | } | ||
405 | |||
406 | static int __devinit ab8500_gpio_probe(struct platform_device *pdev) | ||
407 | { | ||
408 | struct ab8500_platform_data *ab8500_pdata = | ||
409 | dev_get_platdata(pdev->dev.parent); | ||
410 | struct ab8500_gpio_platform_data *pdata; | ||
411 | struct ab8500_gpio *ab8500_gpio; | ||
412 | int ret; | ||
413 | int i; | ||
414 | |||
415 | pdata = ab8500_pdata->gpio; | ||
416 | if (!pdata) { | ||
417 | dev_err(&pdev->dev, "gpio platform data missing\n"); | ||
418 | return -ENODEV; | ||
419 | } | ||
420 | |||
421 | ab8500_gpio = kzalloc(sizeof(struct ab8500_gpio), GFP_KERNEL); | ||
422 | if (ab8500_gpio == NULL) { | ||
423 | dev_err(&pdev->dev, "failed to allocate memory\n"); | ||
424 | return -ENOMEM; | ||
425 | } | ||
426 | ab8500_gpio->dev = &pdev->dev; | ||
427 | ab8500_gpio->parent = dev_get_drvdata(pdev->dev.parent); | ||
428 | ab8500_gpio->chip = ab8500gpio_chip; | ||
429 | ab8500_gpio->chip.ngpio = AB8500_NUM_GPIO; | ||
430 | ab8500_gpio->chip.dev = &pdev->dev; | ||
431 | ab8500_gpio->chip.base = pdata->gpio_base; | ||
432 | ab8500_gpio->irq_base = pdata->irq_base; | ||
433 | /* initialize the lock */ | ||
434 | mutex_init(&ab8500_gpio->lock); | ||
435 | /* | ||
436 | * AB8500 core will handle and clear the IRQ | ||
437 | * configre GPIO based on config-reg value. | ||
438 | * These values are for selecting the PINs as | ||
439 | * GPIO or alternate function | ||
440 | */ | ||
441 | for (i = AB8500_GPIO_SEL1_REG; i <= AB8500_GPIO_SEL6_REG; i++) { | ||
442 | ret = abx500_set_register_interruptible(ab8500_gpio->dev, | ||
443 | AB8500_MISC, i, | ||
444 | pdata->config_reg[i]); | ||
445 | if (ret < 0) | ||
446 | goto out_free; | ||
447 | } | ||
448 | ret = abx500_set_register_interruptible(ab8500_gpio->dev, AB8500_MISC, | ||
449 | AB8500_GPIO_ALTFUN_REG, | ||
450 | pdata->config_reg[ALTFUN_REG_INDEX]); | ||
451 | if (ret < 0) | ||
452 | goto out_free; | ||
453 | |||
454 | ret = ab8500_gpio_irq_init(ab8500_gpio); | ||
455 | if (ret) | ||
456 | goto out_free; | ||
457 | ret = gpiochip_add(&ab8500_gpio->chip); | ||
458 | if (ret) { | ||
459 | dev_err(&pdev->dev, "unable to add gpiochip: %d\n", | ||
460 | ret); | ||
461 | goto out_rem_irq; | ||
462 | } | ||
463 | platform_set_drvdata(pdev, ab8500_gpio); | ||
464 | return 0; | ||
465 | |||
466 | out_rem_irq: | ||
467 | ab8500_gpio_irq_remove(ab8500_gpio); | ||
468 | out_free: | ||
469 | mutex_destroy(&ab8500_gpio->lock); | ||
470 | kfree(ab8500_gpio); | ||
471 | return ret; | ||
472 | } | ||
473 | |||
474 | /* | ||
475 | * ab8500_gpio_remove() - remove Ab8500-gpio driver | ||
476 | * @pdev : Platform device registered | ||
477 | */ | ||
478 | static int __devexit ab8500_gpio_remove(struct platform_device *pdev) | ||
479 | { | ||
480 | struct ab8500_gpio *ab8500_gpio = platform_get_drvdata(pdev); | ||
481 | int ret; | ||
482 | |||
483 | ret = gpiochip_remove(&ab8500_gpio->chip); | ||
484 | if (ret < 0) { | ||
485 | dev_err(ab8500_gpio->dev, "unable to remove gpiochip:\ | ||
486 | %d\n", ret); | ||
487 | return ret; | ||
488 | } | ||
489 | |||
490 | platform_set_drvdata(pdev, NULL); | ||
491 | mutex_destroy(&ab8500_gpio->lock); | ||
492 | kfree(ab8500_gpio); | ||
493 | |||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | static struct platform_driver ab8500_gpio_driver = { | ||
498 | .driver = { | ||
499 | .name = "ab8500-gpio", | ||
500 | .owner = THIS_MODULE, | ||
501 | }, | ||
502 | .probe = ab8500_gpio_probe, | ||
503 | .remove = __devexit_p(ab8500_gpio_remove), | ||
504 | }; | ||
505 | |||
506 | static int __init ab8500_gpio_init(void) | ||
507 | { | ||
508 | return platform_driver_register(&ab8500_gpio_driver); | ||
509 | } | ||
510 | arch_initcall(ab8500_gpio_init); | ||
511 | |||
512 | static void __exit ab8500_gpio_exit(void) | ||
513 | { | ||
514 | platform_driver_unregister(&ab8500_gpio_driver); | ||
515 | } | ||
516 | module_exit(ab8500_gpio_exit); | ||
517 | |||
518 | MODULE_AUTHOR("BIBEK BASU <bibek.basu@stericsson.com>"); | ||
519 | MODULE_DESCRIPTION("Driver allows to use AB8500 unused pins\ | ||
520 | to be used as GPIO"); | ||
521 | MODULE_ALIAS("AB8500 GPIO driver"); | ||
522 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/gpio/adp5588-gpio.c b/drivers/gpio/adp5588-gpio.c index 33fc685cb385..3525ad918771 100644 --- a/drivers/gpio/adp5588-gpio.c +++ b/drivers/gpio/adp5588-gpio.c | |||
@@ -289,10 +289,10 @@ static int adp5588_irq_setup(struct adp5588_gpio *dev) | |||
289 | 289 | ||
290 | for (gpio = 0; gpio < dev->gpio_chip.ngpio; gpio++) { | 290 | for (gpio = 0; gpio < dev->gpio_chip.ngpio; gpio++) { |
291 | int irq = gpio + dev->irq_base; | 291 | int irq = gpio + dev->irq_base; |
292 | set_irq_chip_data(irq, dev); | 292 | irq_set_chip_data(irq, dev); |
293 | set_irq_chip_and_handler(irq, &adp5588_irq_chip, | 293 | irq_set_chip_and_handler(irq, &adp5588_irq_chip, |
294 | handle_level_irq); | 294 | handle_level_irq); |
295 | set_irq_nested_thread(irq, 1); | 295 | irq_set_nested_thread(irq, 1); |
296 | #ifdef CONFIG_ARM | 296 | #ifdef CONFIG_ARM |
297 | /* | 297 | /* |
298 | * ARM needs us to explicitly flag the IRQ as VALID, | 298 | * ARM needs us to explicitly flag the IRQ as VALID, |
@@ -300,7 +300,7 @@ static int adp5588_irq_setup(struct adp5588_gpio *dev) | |||
300 | */ | 300 | */ |
301 | set_irq_flags(irq, IRQF_VALID); | 301 | set_irq_flags(irq, IRQF_VALID); |
302 | #else | 302 | #else |
303 | set_irq_noprobe(irq); | 303 | irq_set_noprobe(irq); |
304 | #endif | 304 | #endif |
305 | } | 305 | } |
306 | 306 | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 649550e2cae9..36a2974815b7 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1656,51 +1656,6 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
1656 | chip->get | 1656 | chip->get |
1657 | ? (chip->get(chip, i) ? "hi" : "lo") | 1657 | ? (chip->get(chip, i) ? "hi" : "lo") |
1658 | : "? "); | 1658 | : "? "); |
1659 | |||
1660 | if (!is_out) { | ||
1661 | int irq = gpio_to_irq(gpio); | ||
1662 | struct irq_desc *desc = irq_to_desc(irq); | ||
1663 | |||
1664 | /* This races with request_irq(), set_irq_type(), | ||
1665 | * and set_irq_wake() ... but those are "rare". | ||
1666 | * | ||
1667 | * More significantly, trigger type flags aren't | ||
1668 | * currently maintained by genirq. | ||
1669 | */ | ||
1670 | if (irq >= 0 && desc->action) { | ||
1671 | char *trigger; | ||
1672 | |||
1673 | switch (desc->status & IRQ_TYPE_SENSE_MASK) { | ||
1674 | case IRQ_TYPE_NONE: | ||
1675 | trigger = "(default)"; | ||
1676 | break; | ||
1677 | case IRQ_TYPE_EDGE_FALLING: | ||
1678 | trigger = "edge-falling"; | ||
1679 | break; | ||
1680 | case IRQ_TYPE_EDGE_RISING: | ||
1681 | trigger = "edge-rising"; | ||
1682 | break; | ||
1683 | case IRQ_TYPE_EDGE_BOTH: | ||
1684 | trigger = "edge-both"; | ||
1685 | break; | ||
1686 | case IRQ_TYPE_LEVEL_HIGH: | ||
1687 | trigger = "level-high"; | ||
1688 | break; | ||
1689 | case IRQ_TYPE_LEVEL_LOW: | ||
1690 | trigger = "level-low"; | ||
1691 | break; | ||
1692 | default: | ||
1693 | trigger = "?trigger?"; | ||
1694 | break; | ||
1695 | } | ||
1696 | |||
1697 | seq_printf(s, " irq-%d %s%s", | ||
1698 | irq, trigger, | ||
1699 | (desc->status & IRQ_WAKEUP) | ||
1700 | ? " wakeup" : ""); | ||
1701 | } | ||
1702 | } | ||
1703 | |||
1704 | seq_printf(s, "\n"); | 1659 | seq_printf(s, "\n"); |
1705 | } | 1660 | } |
1706 | } | 1661 | } |
diff --git a/drivers/gpio/janz-ttl.c b/drivers/gpio/janz-ttl.c index 813ac077e5d7..2514fb075f4a 100644 --- a/drivers/gpio/janz-ttl.c +++ b/drivers/gpio/janz-ttl.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/mfd/core.h> | ||
18 | #include <linux/io.h> | 19 | #include <linux/io.h> |
19 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
20 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
@@ -149,7 +150,7 @@ static int __devinit ttl_probe(struct platform_device *pdev) | |||
149 | struct resource *res; | 150 | struct resource *res; |
150 | int ret; | 151 | int ret; |
151 | 152 | ||
152 | pdata = pdev->dev.platform_data; | 153 | pdata = mfd_get_data(pdev); |
153 | if (!pdata) { | 154 | if (!pdata) { |
154 | dev_err(dev, "no platform data\n"); | 155 | dev_err(dev, "no platform data\n"); |
155 | ret = -ENXIO; | 156 | ret = -ENXIO; |
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c index 9e1d01f0071a..ad6951edc16c 100644 --- a/drivers/gpio/max732x.c +++ b/drivers/gpio/max732x.c | |||
@@ -470,14 +470,14 @@ static int max732x_irq_setup(struct max732x_chip *chip, | |||
470 | if (!(chip->dir_input & (1 << lvl))) | 470 | if (!(chip->dir_input & (1 << lvl))) |
471 | continue; | 471 | continue; |
472 | 472 | ||
473 | set_irq_chip_data(irq, chip); | 473 | irq_set_chip_data(irq, chip); |
474 | set_irq_chip_and_handler(irq, &max732x_irq_chip, | 474 | irq_set_chip_and_handler(irq, &max732x_irq_chip, |
475 | handle_edge_irq); | 475 | handle_edge_irq); |
476 | set_irq_nested_thread(irq, 1); | 476 | irq_set_nested_thread(irq, 1); |
477 | #ifdef CONFIG_ARM | 477 | #ifdef CONFIG_ARM |
478 | set_irq_flags(irq, IRQF_VALID); | 478 | set_irq_flags(irq, IRQF_VALID); |
479 | #else | 479 | #else |
480 | set_irq_noprobe(irq); | 480 | irq_set_noprobe(irq); |
481 | #endif | 481 | #endif |
482 | } | 482 | } |
483 | 483 | ||
diff --git a/drivers/gpio/mc33880.c b/drivers/gpio/mc33880.c index 00f6d24c669d..4ec797593bdb 100644 --- a/drivers/gpio/mc33880.c +++ b/drivers/gpio/mc33880.c | |||
@@ -45,7 +45,7 @@ | |||
45 | * To save time we cache them here in memory | 45 | * To save time we cache them here in memory |
46 | */ | 46 | */ |
47 | struct mc33880 { | 47 | struct mc33880 { |
48 | struct mutex lock; /* protect from simultanous accesses */ | 48 | struct mutex lock; /* protect from simultaneous accesses */ |
49 | u8 port_config; | 49 | u8 port_config; |
50 | struct gpio_chip chip; | 50 | struct gpio_chip chip; |
51 | struct spi_device *spi; | 51 | struct spi_device *spi; |
diff --git a/drivers/gpio/ml_ioh_gpio.c b/drivers/gpio/ml_ioh_gpio.c index 7f6f01a4b145..0a775f7987c2 100644 --- a/drivers/gpio/ml_ioh_gpio.c +++ b/drivers/gpio/ml_ioh_gpio.c | |||
@@ -116,6 +116,7 @@ static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, | |||
116 | reg_val |= (1 << nr); | 116 | reg_val |= (1 << nr); |
117 | else | 117 | else |
118 | reg_val &= ~(1 << nr); | 118 | reg_val &= ~(1 << nr); |
119 | iowrite32(reg_val, &chip->reg->regs[chip->ch].po); | ||
119 | 120 | ||
120 | mutex_unlock(&chip->lock); | 121 | mutex_unlock(&chip->lock); |
121 | 122 | ||
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index 2fc25dec7cf5..7630ab7b9bec 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -395,13 +395,13 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, | |||
395 | for (lvl = 0; lvl < chip->gpio_chip.ngpio; lvl++) { | 395 | for (lvl = 0; lvl < chip->gpio_chip.ngpio; lvl++) { |
396 | int irq = lvl + chip->irq_base; | 396 | int irq = lvl + chip->irq_base; |
397 | 397 | ||
398 | set_irq_chip_data(irq, chip); | 398 | irq_set_chip_data(irq, chip); |
399 | set_irq_chip_and_handler(irq, &pca953x_irq_chip, | 399 | irq_set_chip_and_handler(irq, &pca953x_irq_chip, |
400 | handle_edge_irq); | 400 | handle_edge_irq); |
401 | #ifdef CONFIG_ARM | 401 | #ifdef CONFIG_ARM |
402 | set_irq_flags(irq, IRQF_VALID); | 402 | set_irq_flags(irq, IRQF_VALID); |
403 | #else | 403 | #else |
404 | set_irq_noprobe(irq); | 404 | irq_set_noprobe(irq); |
405 | #endif | 405 | #endif |
406 | } | 406 | } |
407 | 407 | ||
@@ -558,7 +558,7 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
558 | 558 | ||
559 | ret = gpiochip_add(&chip->gpio_chip); | 559 | ret = gpiochip_add(&chip->gpio_chip); |
560 | if (ret) | 560 | if (ret) |
561 | goto out_failed; | 561 | goto out_failed_irq; |
562 | 562 | ||
563 | if (pdata->setup) { | 563 | if (pdata->setup) { |
564 | ret = pdata->setup(client, chip->gpio_chip.base, | 564 | ret = pdata->setup(client, chip->gpio_chip.base, |
@@ -570,8 +570,9 @@ static int __devinit pca953x_probe(struct i2c_client *client, | |||
570 | i2c_set_clientdata(client, chip); | 570 | i2c_set_clientdata(client, chip); |
571 | return 0; | 571 | return 0; |
572 | 572 | ||
573 | out_failed: | 573 | out_failed_irq: |
574 | pca953x_irq_teardown(chip); | 574 | pca953x_irq_teardown(chip); |
575 | out_failed: | ||
575 | kfree(chip->dyn_pdata); | 576 | kfree(chip->dyn_pdata); |
576 | kfree(chip); | 577 | kfree(chip); |
577 | return ret; | 578 | return ret; |
diff --git a/drivers/gpio/pch_gpio.c b/drivers/gpio/pch_gpio.c index 2c6af8705103..f970a5f3585e 100644 --- a/drivers/gpio/pch_gpio.c +++ b/drivers/gpio/pch_gpio.c | |||
@@ -105,6 +105,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, | |||
105 | reg_val |= (1 << nr); | 105 | reg_val |= (1 << nr); |
106 | else | 106 | else |
107 | reg_val &= ~(1 << nr); | 107 | reg_val &= ~(1 << nr); |
108 | iowrite32(reg_val, &chip->reg->po); | ||
108 | 109 | ||
109 | mutex_unlock(&chip->lock); | 110 | mutex_unlock(&chip->lock); |
110 | 111 | ||
diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c index 838ddbdf90cc..6fcb28cdd862 100644 --- a/drivers/gpio/pl061.c +++ b/drivers/gpio/pl061.c | |||
@@ -210,7 +210,7 @@ static struct irq_chip pl061_irqchip = { | |||
210 | 210 | ||
211 | static void pl061_irq_handler(unsigned irq, struct irq_desc *desc) | 211 | static void pl061_irq_handler(unsigned irq, struct irq_desc *desc) |
212 | { | 212 | { |
213 | struct list_head *chip_list = get_irq_data(irq); | 213 | struct list_head *chip_list = irq_get_handler_data(irq); |
214 | struct list_head *ptr; | 214 | struct list_head *ptr; |
215 | struct pl061_gpio *chip; | 215 | struct pl061_gpio *chip; |
216 | 216 | ||
@@ -294,7 +294,7 @@ static int pl061_probe(struct amba_device *dev, const struct amba_id *id) | |||
294 | ret = -ENODEV; | 294 | ret = -ENODEV; |
295 | goto iounmap; | 295 | goto iounmap; |
296 | } | 296 | } |
297 | set_irq_chained_handler(irq, pl061_irq_handler); | 297 | irq_set_chained_handler(irq, pl061_irq_handler); |
298 | if (!test_and_set_bit(irq, init_irq)) { /* list initialized? */ | 298 | if (!test_and_set_bit(irq, init_irq)) { /* list initialized? */ |
299 | chip_list = kmalloc(sizeof(*chip_list), GFP_KERNEL); | 299 | chip_list = kmalloc(sizeof(*chip_list), GFP_KERNEL); |
300 | if (chip_list == NULL) { | 300 | if (chip_list == NULL) { |
@@ -303,9 +303,9 @@ static int pl061_probe(struct amba_device *dev, const struct amba_id *id) | |||
303 | goto iounmap; | 303 | goto iounmap; |
304 | } | 304 | } |
305 | INIT_LIST_HEAD(chip_list); | 305 | INIT_LIST_HEAD(chip_list); |
306 | set_irq_data(irq, chip_list); | 306 | irq_set_handler_data(irq, chip_list); |
307 | } else | 307 | } else |
308 | chip_list = get_irq_data(irq); | 308 | chip_list = irq_get_handler_data(irq); |
309 | list_add(&chip->list, chip_list); | 309 | list_add(&chip->list, chip_list); |
310 | 310 | ||
311 | for (i = 0; i < PL061_GPIO_NR; i++) { | 311 | for (i = 0; i < PL061_GPIO_NR; i++) { |
@@ -315,10 +315,10 @@ static int pl061_probe(struct amba_device *dev, const struct amba_id *id) | |||
315 | else | 315 | else |
316 | pl061_direction_input(&chip->gc, i); | 316 | pl061_direction_input(&chip->gc, i); |
317 | 317 | ||
318 | set_irq_chip(i+chip->irq_base, &pl061_irqchip); | 318 | irq_set_chip_and_handler(i + chip->irq_base, &pl061_irqchip, |
319 | set_irq_handler(i+chip->irq_base, handle_simple_irq); | 319 | handle_simple_irq); |
320 | set_irq_flags(i+chip->irq_base, IRQF_VALID); | 320 | set_irq_flags(i+chip->irq_base, IRQF_VALID); |
321 | set_irq_chip_data(i+chip->irq_base, chip); | 321 | irq_set_chip_data(i + chip->irq_base, chip); |
322 | } | 322 | } |
323 | 323 | ||
324 | return 0; | 324 | return 0; |
diff --git a/drivers/gpio/rdc321x-gpio.c b/drivers/gpio/rdc321x-gpio.c index 897e0577e65e..a9bda881935a 100644 --- a/drivers/gpio/rdc321x-gpio.c +++ b/drivers/gpio/rdc321x-gpio.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
28 | #include <linux/gpio.h> | 28 | #include <linux/gpio.h> |
29 | #include <linux/mfd/rdc321x.h> | 29 | #include <linux/mfd/rdc321x.h> |
30 | #include <linux/mfd/core.h> | ||
30 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
31 | 32 | ||
32 | struct rdc321x_gpio { | 33 | struct rdc321x_gpio { |
@@ -135,7 +136,7 @@ static int __devinit rdc321x_gpio_probe(struct platform_device *pdev) | |||
135 | struct rdc321x_gpio *rdc321x_gpio_dev; | 136 | struct rdc321x_gpio *rdc321x_gpio_dev; |
136 | struct rdc321x_gpio_pdata *pdata; | 137 | struct rdc321x_gpio_pdata *pdata; |
137 | 138 | ||
138 | pdata = platform_get_drvdata(pdev); | 139 | pdata = mfd_get_data(pdev); |
139 | if (!pdata) { | 140 | if (!pdata) { |
140 | dev_err(&pdev->dev, "no platform data supplied\n"); | 141 | dev_err(&pdev->dev, "no platform data supplied\n"); |
141 | return -ENODEV; | 142 | return -ENODEV; |
diff --git a/drivers/gpio/sch_gpio.c b/drivers/gpio/sch_gpio.c index 583521352c16..56060421cdff 100644 --- a/drivers/gpio/sch_gpio.c +++ b/drivers/gpio/sch_gpio.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/errno.h> | 25 | #include <linux/errno.h> |
26 | #include <linux/acpi.h> | 26 | #include <linux/acpi.h> |
27 | #include <linux/platform_device.h> | 27 | #include <linux/platform_device.h> |
28 | #include <linux/pci_ids.h> | ||
28 | 29 | ||
29 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
30 | 31 | ||
@@ -187,7 +188,11 @@ static struct gpio_chip sch_gpio_resume = { | |||
187 | static int __devinit sch_gpio_probe(struct platform_device *pdev) | 188 | static int __devinit sch_gpio_probe(struct platform_device *pdev) |
188 | { | 189 | { |
189 | struct resource *res; | 190 | struct resource *res; |
190 | int err; | 191 | int err, id; |
192 | |||
193 | id = pdev->id; | ||
194 | if (!id) | ||
195 | return -ENODEV; | ||
191 | 196 | ||
192 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); | 197 | res = platform_get_resource(pdev, IORESOURCE_IO, 0); |
193 | if (!res) | 198 | if (!res) |
@@ -198,12 +203,40 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev) | |||
198 | 203 | ||
199 | gpio_ba = res->start; | 204 | gpio_ba = res->start; |
200 | 205 | ||
201 | sch_gpio_core.base = 0; | 206 | switch (id) { |
202 | sch_gpio_core.ngpio = 10; | 207 | case PCI_DEVICE_ID_INTEL_SCH_LPC: |
203 | sch_gpio_core.dev = &pdev->dev; | 208 | sch_gpio_core.base = 0; |
209 | sch_gpio_core.ngpio = 10; | ||
210 | |||
211 | sch_gpio_resume.base = 10; | ||
212 | sch_gpio_resume.ngpio = 4; | ||
213 | |||
214 | /* | ||
215 | * GPIO[6:0] enabled by default | ||
216 | * GPIO7 is configured by the CMC as SLPIOVR | ||
217 | * Enable GPIO[9:8] core powered gpios explicitly | ||
218 | */ | ||
219 | outb(0x3, gpio_ba + CGEN + 1); | ||
220 | /* | ||
221 | * SUS_GPIO[2:0] enabled by default | ||
222 | * Enable SUS_GPIO3 resume powered gpio explicitly | ||
223 | */ | ||
224 | outb(0x8, gpio_ba + RGEN); | ||
225 | break; | ||
226 | |||
227 | case PCI_DEVICE_ID_INTEL_ITC_LPC: | ||
228 | sch_gpio_core.base = 0; | ||
229 | sch_gpio_core.ngpio = 5; | ||
230 | |||
231 | sch_gpio_resume.base = 5; | ||
232 | sch_gpio_resume.ngpio = 9; | ||
233 | break; | ||
234 | |||
235 | default: | ||
236 | return -ENODEV; | ||
237 | } | ||
204 | 238 | ||
205 | sch_gpio_resume.base = 10; | 239 | sch_gpio_core.dev = &pdev->dev; |
206 | sch_gpio_resume.ngpio = 4; | ||
207 | sch_gpio_resume.dev = &pdev->dev; | 240 | sch_gpio_resume.dev = &pdev->dev; |
208 | 241 | ||
209 | err = gpiochip_add(&sch_gpio_core); | 242 | err = gpiochip_add(&sch_gpio_core); |
@@ -214,18 +247,6 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev) | |||
214 | if (err < 0) | 247 | if (err < 0) |
215 | goto err_sch_gpio_resume; | 248 | goto err_sch_gpio_resume; |
216 | 249 | ||
217 | /* | ||
218 | * GPIO[6:0] enabled by default | ||
219 | * GPIO7 is configured by the CMC as SLPIOVR | ||
220 | * Enable GPIO[9:8] core powered gpios explicitly | ||
221 | */ | ||
222 | outb(0x3, gpio_ba + CGEN + 1); | ||
223 | /* | ||
224 | * SUS_GPIO[2:0] enabled by default | ||
225 | * Enable SUS_GPIO3 resume powered gpio explicitly | ||
226 | */ | ||
227 | outb(0x8, gpio_ba + RGEN); | ||
228 | |||
229 | return 0; | 250 | return 0; |
230 | 251 | ||
231 | err_sch_gpio_resume: | 252 | err_sch_gpio_resume: |
diff --git a/drivers/gpio/stmpe-gpio.c b/drivers/gpio/stmpe-gpio.c index eb2901f8ab5e..4c980b573328 100644 --- a/drivers/gpio/stmpe-gpio.c +++ b/drivers/gpio/stmpe-gpio.c | |||
@@ -254,14 +254,14 @@ static int __devinit stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio) | |||
254 | int irq; | 254 | int irq; |
255 | 255 | ||
256 | for (irq = base; irq < base + stmpe_gpio->chip.ngpio; irq++) { | 256 | for (irq = base; irq < base + stmpe_gpio->chip.ngpio; irq++) { |
257 | set_irq_chip_data(irq, stmpe_gpio); | 257 | irq_set_chip_data(irq, stmpe_gpio); |
258 | set_irq_chip_and_handler(irq, &stmpe_gpio_irq_chip, | 258 | irq_set_chip_and_handler(irq, &stmpe_gpio_irq_chip, |
259 | handle_simple_irq); | 259 | handle_simple_irq); |
260 | set_irq_nested_thread(irq, 1); | 260 | irq_set_nested_thread(irq, 1); |
261 | #ifdef CONFIG_ARM | 261 | #ifdef CONFIG_ARM |
262 | set_irq_flags(irq, IRQF_VALID); | 262 | set_irq_flags(irq, IRQF_VALID); |
263 | #else | 263 | #else |
264 | set_irq_noprobe(irq); | 264 | irq_set_noprobe(irq); |
265 | #endif | 265 | #endif |
266 | } | 266 | } |
267 | 267 | ||
@@ -277,8 +277,8 @@ static void stmpe_gpio_irq_remove(struct stmpe_gpio *stmpe_gpio) | |||
277 | #ifdef CONFIG_ARM | 277 | #ifdef CONFIG_ARM |
278 | set_irq_flags(irq, 0); | 278 | set_irq_flags(irq, 0); |
279 | #endif | 279 | #endif |
280 | set_irq_chip_and_handler(irq, NULL, NULL); | 280 | irq_set_chip_and_handler(irq, NULL, NULL); |
281 | set_irq_chip_data(irq, NULL); | 281 | irq_set_chip_data(irq, NULL); |
282 | } | 282 | } |
283 | } | 283 | } |
284 | 284 | ||
diff --git a/drivers/gpio/sx150x.c b/drivers/gpio/sx150x.c index d2f874c3d3d5..a4f73534394e 100644 --- a/drivers/gpio/sx150x.c +++ b/drivers/gpio/sx150x.c | |||
@@ -551,12 +551,12 @@ static int sx150x_install_irq_chip(struct sx150x_chip *chip, | |||
551 | 551 | ||
552 | for (n = 0; n < chip->dev_cfg->ngpios; ++n) { | 552 | for (n = 0; n < chip->dev_cfg->ngpios; ++n) { |
553 | irq = irq_base + n; | 553 | irq = irq_base + n; |
554 | set_irq_chip_and_handler(irq, &chip->irq_chip, handle_edge_irq); | 554 | irq_set_chip_and_handler(irq, &chip->irq_chip, handle_edge_irq); |
555 | set_irq_nested_thread(irq, 1); | 555 | irq_set_nested_thread(irq, 1); |
556 | #ifdef CONFIG_ARM | 556 | #ifdef CONFIG_ARM |
557 | set_irq_flags(irq, IRQF_VALID); | 557 | set_irq_flags(irq, IRQF_VALID); |
558 | #else | 558 | #else |
559 | set_irq_noprobe(irq); | 559 | irq_set_noprobe(irq); |
560 | #endif | 560 | #endif |
561 | } | 561 | } |
562 | 562 | ||
@@ -583,8 +583,7 @@ static void sx150x_remove_irq_chip(struct sx150x_chip *chip) | |||
583 | 583 | ||
584 | for (n = 0; n < chip->dev_cfg->ngpios; ++n) { | 584 | for (n = 0; n < chip->dev_cfg->ngpios; ++n) { |
585 | irq = chip->irq_base + n; | 585 | irq = chip->irq_base + n; |
586 | set_irq_handler(irq, NULL); | 586 | irq_set_chip_and_handler(irq, NULL, NULL); |
587 | set_irq_chip(irq, NULL); | ||
588 | } | 587 | } |
589 | } | 588 | } |
590 | 589 | ||
diff --git a/drivers/gpio/tc3589x-gpio.c b/drivers/gpio/tc3589x-gpio.c index 27200af1a595..2a82e8999a42 100644 --- a/drivers/gpio/tc3589x-gpio.c +++ b/drivers/gpio/tc3589x-gpio.c | |||
@@ -239,14 +239,14 @@ static int tc3589x_gpio_irq_init(struct tc3589x_gpio *tc3589x_gpio) | |||
239 | int irq; | 239 | int irq; |
240 | 240 | ||
241 | for (irq = base; irq < base + tc3589x_gpio->chip.ngpio; irq++) { | 241 | for (irq = base; irq < base + tc3589x_gpio->chip.ngpio; irq++) { |
242 | set_irq_chip_data(irq, tc3589x_gpio); | 242 | irq_set_chip_data(irq, tc3589x_gpio); |
243 | set_irq_chip_and_handler(irq, &tc3589x_gpio_irq_chip, | 243 | irq_set_chip_and_handler(irq, &tc3589x_gpio_irq_chip, |
244 | handle_simple_irq); | 244 | handle_simple_irq); |
245 | set_irq_nested_thread(irq, 1); | 245 | irq_set_nested_thread(irq, 1); |
246 | #ifdef CONFIG_ARM | 246 | #ifdef CONFIG_ARM |
247 | set_irq_flags(irq, IRQF_VALID); | 247 | set_irq_flags(irq, IRQF_VALID); |
248 | #else | 248 | #else |
249 | set_irq_noprobe(irq); | 249 | irq_set_noprobe(irq); |
250 | #endif | 250 | #endif |
251 | } | 251 | } |
252 | 252 | ||
@@ -262,8 +262,8 @@ static void tc3589x_gpio_irq_remove(struct tc3589x_gpio *tc3589x_gpio) | |||
262 | #ifdef CONFIG_ARM | 262 | #ifdef CONFIG_ARM |
263 | set_irq_flags(irq, 0); | 263 | set_irq_flags(irq, 0); |
264 | #endif | 264 | #endif |
265 | set_irq_chip_and_handler(irq, NULL, NULL); | 265 | irq_set_chip_and_handler(irq, NULL, NULL); |
266 | set_irq_chip_data(irq, NULL); | 266 | irq_set_chip_data(irq, NULL); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | 269 | ||
diff --git a/drivers/gpio/timbgpio.c b/drivers/gpio/timbgpio.c index 58c8f30352dd..edbe1eae531f 100644 --- a/drivers/gpio/timbgpio.c +++ b/drivers/gpio/timbgpio.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/mfd/core.h> | ||
26 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
27 | #include <linux/io.h> | 28 | #include <linux/io.h> |
28 | #include <linux/timb_gpio.h> | 29 | #include <linux/timb_gpio.h> |
@@ -195,7 +196,7 @@ out: | |||
195 | 196 | ||
196 | static void timbgpio_irq(unsigned int irq, struct irq_desc *desc) | 197 | static void timbgpio_irq(unsigned int irq, struct irq_desc *desc) |
197 | { | 198 | { |
198 | struct timbgpio *tgpio = get_irq_data(irq); | 199 | struct timbgpio *tgpio = irq_get_handler_data(irq); |
199 | unsigned long ipr; | 200 | unsigned long ipr; |
200 | int offset; | 201 | int offset; |
201 | 202 | ||
@@ -228,7 +229,7 @@ static int __devinit timbgpio_probe(struct platform_device *pdev) | |||
228 | struct gpio_chip *gc; | 229 | struct gpio_chip *gc; |
229 | struct timbgpio *tgpio; | 230 | struct timbgpio *tgpio; |
230 | struct resource *iomem; | 231 | struct resource *iomem; |
231 | struct timbgpio_platform_data *pdata = pdev->dev.platform_data; | 232 | struct timbgpio_platform_data *pdata = mfd_get_data(pdev); |
232 | int irq = platform_get_irq(pdev, 0); | 233 | int irq = platform_get_irq(pdev, 0); |
233 | 234 | ||
234 | if (!pdata || pdata->nr_pins > 32) { | 235 | if (!pdata || pdata->nr_pins > 32) { |
@@ -291,16 +292,16 @@ static int __devinit timbgpio_probe(struct platform_device *pdev) | |||
291 | return 0; | 292 | return 0; |
292 | 293 | ||
293 | for (i = 0; i < pdata->nr_pins; i++) { | 294 | for (i = 0; i < pdata->nr_pins; i++) { |
294 | set_irq_chip_and_handler_name(tgpio->irq_base + i, | 295 | irq_set_chip_and_handler_name(tgpio->irq_base + i, |
295 | &timbgpio_irqchip, handle_simple_irq, "mux"); | 296 | &timbgpio_irqchip, handle_simple_irq, "mux"); |
296 | set_irq_chip_data(tgpio->irq_base + i, tgpio); | 297 | irq_set_chip_data(tgpio->irq_base + i, tgpio); |
297 | #ifdef CONFIG_ARM | 298 | #ifdef CONFIG_ARM |
298 | set_irq_flags(tgpio->irq_base + i, IRQF_VALID | IRQF_PROBE); | 299 | set_irq_flags(tgpio->irq_base + i, IRQF_VALID | IRQF_PROBE); |
299 | #endif | 300 | #endif |
300 | } | 301 | } |
301 | 302 | ||
302 | set_irq_data(irq, tgpio); | 303 | irq_set_handler_data(irq, tgpio); |
303 | set_irq_chained_handler(irq, timbgpio_irq); | 304 | irq_set_chained_handler(irq, timbgpio_irq); |
304 | 305 | ||
305 | return 0; | 306 | return 0; |
306 | 307 | ||
@@ -319,20 +320,19 @@ err_mem: | |||
319 | static int __devexit timbgpio_remove(struct platform_device *pdev) | 320 | static int __devexit timbgpio_remove(struct platform_device *pdev) |
320 | { | 321 | { |
321 | int err; | 322 | int err; |
322 | struct timbgpio_platform_data *pdata = pdev->dev.platform_data; | ||
323 | struct timbgpio *tgpio = platform_get_drvdata(pdev); | 323 | struct timbgpio *tgpio = platform_get_drvdata(pdev); |
324 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 324 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
325 | int irq = platform_get_irq(pdev, 0); | 325 | int irq = platform_get_irq(pdev, 0); |
326 | 326 | ||
327 | if (irq >= 0 && tgpio->irq_base > 0) { | 327 | if (irq >= 0 && tgpio->irq_base > 0) { |
328 | int i; | 328 | int i; |
329 | for (i = 0; i < pdata->nr_pins; i++) { | 329 | for (i = 0; i < tgpio->gpio.ngpio; i++) { |
330 | set_irq_chip(tgpio->irq_base + i, NULL); | 330 | irq_set_chip(tgpio->irq_base + i, NULL); |
331 | set_irq_chip_data(tgpio->irq_base + i, NULL); | 331 | irq_set_chip_data(tgpio->irq_base + i, NULL); |
332 | } | 332 | } |
333 | 333 | ||
334 | set_irq_handler(irq, NULL); | 334 | irq_set_handler(irq, NULL); |
335 | set_irq_data(irq, NULL); | 335 | irq_set_handler_data(irq, NULL); |
336 | } | 336 | } |
337 | 337 | ||
338 | err = gpiochip_remove(&tgpio->gpio); | 338 | err = gpiochip_remove(&tgpio->gpio); |
diff --git a/drivers/gpio/vr41xx_giu.c b/drivers/gpio/vr41xx_giu.c index cffa3bd7ad3b..a365be040b36 100644 --- a/drivers/gpio/vr41xx_giu.c +++ b/drivers/gpio/vr41xx_giu.c | |||
@@ -238,13 +238,13 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, | |||
238 | break; | 238 | break; |
239 | } | 239 | } |
240 | } | 240 | } |
241 | set_irq_chip_and_handler(GIU_IRQ(pin), | 241 | irq_set_chip_and_handler(GIU_IRQ(pin), |
242 | &giuint_low_irq_chip, | 242 | &giuint_low_irq_chip, |
243 | handle_edge_irq); | 243 | handle_edge_irq); |
244 | } else { | 244 | } else { |
245 | giu_clear(GIUINTTYPL, mask); | 245 | giu_clear(GIUINTTYPL, mask); |
246 | giu_clear(GIUINTHTSELL, mask); | 246 | giu_clear(GIUINTHTSELL, mask); |
247 | set_irq_chip_and_handler(GIU_IRQ(pin), | 247 | irq_set_chip_and_handler(GIU_IRQ(pin), |
248 | &giuint_low_irq_chip, | 248 | &giuint_low_irq_chip, |
249 | handle_level_irq); | 249 | handle_level_irq); |
250 | } | 250 | } |
@@ -273,13 +273,13 @@ void vr41xx_set_irq_trigger(unsigned int pin, irq_trigger_t trigger, | |||
273 | break; | 273 | break; |
274 | } | 274 | } |
275 | } | 275 | } |
276 | set_irq_chip_and_handler(GIU_IRQ(pin), | 276 | irq_set_chip_and_handler(GIU_IRQ(pin), |
277 | &giuint_high_irq_chip, | 277 | &giuint_high_irq_chip, |
278 | handle_edge_irq); | 278 | handle_edge_irq); |
279 | } else { | 279 | } else { |
280 | giu_clear(GIUINTTYPH, mask); | 280 | giu_clear(GIUINTTYPH, mask); |
281 | giu_clear(GIUINTHTSELH, mask); | 281 | giu_clear(GIUINTHTSELH, mask); |
282 | set_irq_chip_and_handler(GIU_IRQ(pin), | 282 | irq_set_chip_and_handler(GIU_IRQ(pin), |
283 | &giuint_high_irq_chip, | 283 | &giuint_high_irq_chip, |
284 | handle_level_irq); | 284 | handle_level_irq); |
285 | } | 285 | } |
@@ -539,9 +539,9 @@ static int __devinit giu_probe(struct platform_device *pdev) | |||
539 | chip = &giuint_high_irq_chip; | 539 | chip = &giuint_high_irq_chip; |
540 | 540 | ||
541 | if (trigger & (1 << pin)) | 541 | if (trigger & (1 << pin)) |
542 | set_irq_chip_and_handler(i, chip, handle_edge_irq); | 542 | irq_set_chip_and_handler(i, chip, handle_edge_irq); |
543 | else | 543 | else |
544 | set_irq_chip_and_handler(i, chip, handle_level_irq); | 544 | irq_set_chip_and_handler(i, chip, handle_level_irq); |
545 | 545 | ||
546 | } | 546 | } |
547 | 547 | ||