aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-05-10 09:32:46 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-05-10 09:32:46 -0400
commit0ae28a35bcb7984838acbf28bfba9c030f8b74f0 (patch)
tree4f449d929b5df9e126e839f388ff0fd2b52028a0 /drivers/gpio
parent6f1f3d0ab5c3eeea9f04486481c25e9afdfa26c5 (diff)
parentb57f95a38233a2e73b679bea4a5453a1cc2a1cc9 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: drivers/mtd/mtdcore.c Pull in the bdi fixes and ARM platform changes that other outstanding patches depend on.
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/adp5520-gpio.c1
-rw-r--r--drivers/gpio/adp5588-gpio.c1
-rw-r--r--drivers/gpio/bt8xxgpio.c1
-rw-r--r--drivers/gpio/gpiolib.c4
-rw-r--r--drivers/gpio/langwell_gpio.c1
-rw-r--r--drivers/gpio/max7300.c1
-rw-r--r--drivers/gpio/max7301.c1
-rw-r--r--drivers/gpio/max730x.c5
-rw-r--r--drivers/gpio/mc33880.c1
-rw-r--r--drivers/gpio/mcp23s08.c1
-rw-r--r--drivers/gpio/pca953x.c15
-rw-r--r--drivers/gpio/pl061.c15
-rw-r--r--drivers/gpio/timbgpio.c13
-rw-r--r--drivers/gpio/twl4030-gpio.c1
-rw-r--r--drivers/gpio/wm831x-gpio.c1
-rw-r--r--drivers/gpio/wm8350-gpiolib.c1
-rw-r--r--drivers/gpio/wm8994-gpio.c1
-rw-r--r--drivers/gpio/xilinx_gpio.c1
18 files changed, 54 insertions, 11 deletions
diff --git a/drivers/gpio/adp5520-gpio.c b/drivers/gpio/adp5520-gpio.c
index 0f93105873cd..9f2781537001 100644
--- a/drivers/gpio/adp5520-gpio.c
+++ b/drivers/gpio/adp5520-gpio.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/slab.h>
10#include <linux/kernel.h> 11#include <linux/kernel.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
diff --git a/drivers/gpio/adp5588-gpio.c b/drivers/gpio/adp5588-gpio.c
index afc097a16b33..2e8e9e24f887 100644
--- a/drivers/gpio/adp5588-gpio.c
+++ b/drivers/gpio/adp5588-gpio.c
@@ -9,6 +9,7 @@
9 9
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/slab.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/i2c.h> 14#include <linux/i2c.h>
14#include <linux/gpio.h> 15#include <linux/gpio.h>
diff --git a/drivers/gpio/bt8xxgpio.c b/drivers/gpio/bt8xxgpio.c
index 2559f2289409..aa4f09ad3ced 100644
--- a/drivers/gpio/bt8xxgpio.c
+++ b/drivers/gpio/bt8xxgpio.c
@@ -47,6 +47,7 @@
47#include <linux/pci.h> 47#include <linux/pci.h>
48#include <linux/spinlock.h> 48#include <linux/spinlock.h>
49#include <linux/gpio.h> 49#include <linux/gpio.h>
50#include <linux/slab.h>
50 51
51/* Steal the hardware definitions from the bttv driver. */ 52/* Steal the hardware definitions from the bttv driver. */
52#include "../media/video/bt8xx/bt848.h" 53#include "../media/video/bt8xx/bt848.h"
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 6d1b86661e63..eb0c3fe44b29 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -9,6 +9,7 @@
9#include <linux/seq_file.h> 9#include <linux/seq_file.h>
10#include <linux/gpio.h> 10#include <linux/gpio.h>
11#include <linux/idr.h> 11#include <linux/idr.h>
12#include <linux/slab.h>
12 13
13 14
14/* Optional implementation infrastructure for GPIO interfaces. 15/* Optional implementation infrastructure for GPIO interfaces.
@@ -415,7 +416,8 @@ static int gpio_setup_irq(struct gpio_desc *desc, struct device *dev,
415 return 0; 416 return 0;
416 417
417free_sd: 418free_sd:
418 sysfs_put(pdesc->value_sd); 419 if (pdesc)
420 sysfs_put(pdesc->value_sd);
419free_id: 421free_id:
420 idr_remove(&pdesc_idr, id); 422 idr_remove(&pdesc_idr, id);
421 desc->flags &= GPIO_FLAGS_MASK; 423 desc->flags &= GPIO_FLAGS_MASK;
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c
index 6c0ebbdc659e..00c3a14127af 100644
--- a/drivers/gpio/langwell_gpio.c
+++ b/drivers/gpio/langwell_gpio.c
@@ -29,6 +29,7 @@
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
32#include <linux/slab.h>
32 33
33struct lnw_gpio_register { 34struct lnw_gpio_register {
34 u32 GPLR[2]; 35 u32 GPLR[2];
diff --git a/drivers/gpio/max7300.c b/drivers/gpio/max7300.c
index 9d74eef1157a..962f661c18c7 100644
--- a/drivers/gpio/max7300.c
+++ b/drivers/gpio/max7300.c
@@ -16,6 +16,7 @@
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/spi/max7301.h> 18#include <linux/spi/max7301.h>
19#include <linux/slab.h>
19 20
20static int max7300_i2c_write(struct device *dev, unsigned int reg, 21static int max7300_i2c_write(struct device *dev, unsigned int reg,
21 unsigned int val) 22 unsigned int val)
diff --git a/drivers/gpio/max7301.c b/drivers/gpio/max7301.c
index 965d9b1ea13e..92a100ddef6b 100644
--- a/drivers/gpio/max7301.c
+++ b/drivers/gpio/max7301.c
@@ -16,6 +16,7 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/mutex.h> 18#include <linux/mutex.h>
19#include <linux/slab.h>
19#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
20#include <linux/spi/max7301.h> 21#include <linux/spi/max7301.h>
21 22
diff --git a/drivers/gpio/max730x.c b/drivers/gpio/max730x.c
index c9bced55f82b..7696a5625d58 100644
--- a/drivers/gpio/max730x.c
+++ b/drivers/gpio/max730x.c
@@ -38,6 +38,7 @@
38#include <linux/mutex.h> 38#include <linux/mutex.h>
39#include <linux/spi/max7301.h> 39#include <linux/spi/max7301.h>
40#include <linux/gpio.h> 40#include <linux/gpio.h>
41#include <linux/slab.h>
41 42
42/* 43/*
43 * Pin configurations, see MAX7301 datasheet page 6 44 * Pin configurations, see MAX7301 datasheet page 6
@@ -242,3 +243,7 @@ int __devexit __max730x_remove(struct device *dev)
242 return ret; 243 return ret;
243} 244}
244EXPORT_SYMBOL_GPL(__max730x_remove); 245EXPORT_SYMBOL_GPL(__max730x_remove);
246
247MODULE_AUTHOR("Juergen Beisert, Wolfram Sang");
248MODULE_LICENSE("GPL v2");
249MODULE_DESCRIPTION("MAX730x GPIO-Expanders, generic parts");
diff --git a/drivers/gpio/mc33880.c b/drivers/gpio/mc33880.c
index e7d01bd8fdb3..935479da6705 100644
--- a/drivers/gpio/mc33880.c
+++ b/drivers/gpio/mc33880.c
@@ -25,6 +25,7 @@
25#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
26#include <linux/spi/mc33880.h> 26#include <linux/spi/mc33880.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/slab.h>
28 29
29#define DRIVER_NAME "mc33880" 30#define DRIVER_NAME "mc33880"
30 31
diff --git a/drivers/gpio/mcp23s08.c b/drivers/gpio/mcp23s08.c
index cd651ec8d034..69f6f1955a31 100644
--- a/drivers/gpio/mcp23s08.c
+++ b/drivers/gpio/mcp23s08.c
@@ -9,6 +9,7 @@
9#include <linux/gpio.h> 9#include <linux/gpio.h>
10#include <linux/spi/spi.h> 10#include <linux/spi/spi.h>
11#include <linux/spi/mcp23s08.h> 11#include <linux/spi/mcp23s08.h>
12#include <linux/slab.h>
12 13
13 14
14/* Registers are all 8 bits wide. 15/* Registers are all 8 bits wide.
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index ab5daab14bc2..b827c976dc62 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -18,6 +18,7 @@
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/i2c/pca953x.h> 20#include <linux/i2c/pca953x.h>
21#include <linux/slab.h>
21#ifdef CONFIG_OF_GPIO 22#ifdef CONFIG_OF_GPIO
22#include <linux/of_platform.h> 23#include <linux/of_platform.h>
23#include <linux/of_gpio.h> 24#include <linux/of_gpio.h>
@@ -251,6 +252,18 @@ static void pca953x_irq_bus_lock(unsigned int irq)
251static void pca953x_irq_bus_sync_unlock(unsigned int irq) 252static void pca953x_irq_bus_sync_unlock(unsigned int irq)
252{ 253{
253 struct pca953x_chip *chip = get_irq_chip_data(irq); 254 struct pca953x_chip *chip = get_irq_chip_data(irq);
255 uint16_t new_irqs;
256 uint16_t level;
257
258 /* Look for any newly setup interrupt */
259 new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
260 new_irqs &= ~chip->reg_direction;
261
262 while (new_irqs) {
263 level = __ffs(new_irqs);
264 pca953x_gpio_direction_input(&chip->gpio_chip, level);
265 new_irqs &= ~(1 << level);
266 }
254 267
255 mutex_unlock(&chip->irq_lock); 268 mutex_unlock(&chip->irq_lock);
256} 269}
@@ -277,7 +290,7 @@ static int pca953x_irq_set_type(unsigned int irq, unsigned int type)
277 else 290 else
278 chip->irq_trig_raise &= ~mask; 291 chip->irq_trig_raise &= ~mask;
279 292
280 return pca953x_gpio_direction_input(&chip->gpio_chip, level); 293 return 0;
281} 294}
282 295
283static struct irq_chip pca953x_irq_chip = { 296static struct irq_chip pca953x_irq_chip = {
diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c
index 3ad1eeb49609..105701a1f05b 100644
--- a/drivers/gpio/pl061.c
+++ b/drivers/gpio/pl061.c
@@ -24,6 +24,7 @@
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/slab.h>
27 28
28#define GPIODIR 0x400 29#define GPIODIR 0x400
29#define GPIOIS 0x404 30#define GPIOIS 0x404
@@ -90,6 +91,12 @@ static int pl061_direction_output(struct gpio_chip *gc, unsigned offset,
90 gpiodir = readb(chip->base + GPIODIR); 91 gpiodir = readb(chip->base + GPIODIR);
91 gpiodir |= 1 << offset; 92 gpiodir |= 1 << offset;
92 writeb(gpiodir, chip->base + GPIODIR); 93 writeb(gpiodir, chip->base + GPIODIR);
94
95 /*
96 * gpio value is set again, because pl061 doesn't allow to set value of
97 * a gpio pin before configuring it in OUT mode.
98 */
99 writeb(!!value << offset, chip->base + (1 << (offset + 2)));
93 spin_unlock_irqrestore(&chip->lock, flags); 100 spin_unlock_irqrestore(&chip->lock, flags);
94 101
95 return 0; 102 return 0;
@@ -182,7 +189,7 @@ static int pl061_irq_type(unsigned irq, unsigned trigger)
182 gpioibe &= ~(1 << offset); 189 gpioibe &= ~(1 << offset);
183 if (trigger & IRQ_TYPE_EDGE_RISING) 190 if (trigger & IRQ_TYPE_EDGE_RISING)
184 gpioiev |= 1 << offset; 191 gpioiev |= 1 << offset;
185 else 192 else if (trigger & IRQ_TYPE_EDGE_FALLING)
186 gpioiev &= ~(1 << offset); 193 gpioiev &= ~(1 << offset);
187 } 194 }
188 writeb(gpioibe, chip->base + GPIOIBE); 195 writeb(gpioibe, chip->base + GPIOIBE);
@@ -203,7 +210,7 @@ static struct irq_chip pl061_irqchip = {
203 210
204static void pl061_irq_handler(unsigned irq, struct irq_desc *desc) 211static void pl061_irq_handler(unsigned irq, struct irq_desc *desc)
205{ 212{
206 struct list_head *chip_list = get_irq_chip_data(irq); 213 struct list_head *chip_list = get_irq_data(irq);
207 struct list_head *ptr; 214 struct list_head *ptr;
208 struct pl061_gpio *chip; 215 struct pl061_gpio *chip;
209 216
@@ -296,9 +303,9 @@ static int __init pl061_probe(struct amba_device *dev, struct amba_id *id)
296 goto iounmap; 303 goto iounmap;
297 } 304 }
298 INIT_LIST_HEAD(chip_list); 305 INIT_LIST_HEAD(chip_list);
299 set_irq_chip_data(irq, chip_list); 306 set_irq_data(irq, chip_list);
300 } else 307 } else
301 chip_list = get_irq_chip_data(irq); 308 chip_list = get_irq_data(irq);
302 list_add(&chip->list, chip_list); 309 list_add(&chip->list, chip_list);
303 310
304 for (i = 0; i < PL061_GPIO_NR; i++) { 311 for (i = 0; i < PL061_GPIO_NR; i++) {
diff --git a/drivers/gpio/timbgpio.c b/drivers/gpio/timbgpio.c
index d4295fa5369e..ddd053108a13 100644
--- a/drivers/gpio/timbgpio.c
+++ b/drivers/gpio/timbgpio.c
@@ -27,6 +27,7 @@
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/timb_gpio.h> 28#include <linux/timb_gpio.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/slab.h>
30 31
31#define DRIVER_NAME "timb-gpio" 32#define DRIVER_NAME "timb-gpio"
32 33
@@ -130,6 +131,7 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
130 unsigned long flags; 131 unsigned long flags;
131 u32 lvr, flr, bflr = 0; 132 u32 lvr, flr, bflr = 0;
132 u32 ver; 133 u32 ver;
134 int ret = 0;
133 135
134 if (offset < 0 || offset > tgpio->gpio.ngpio) 136 if (offset < 0 || offset > tgpio->gpio.ngpio)
135 return -EINVAL; 137 return -EINVAL;
@@ -153,8 +155,10 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
153 } 155 }
154 156
155 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) { 157 if ((trigger & IRQ_TYPE_EDGE_BOTH) == IRQ_TYPE_EDGE_BOTH) {
156 if (ver < 3) 158 if (ver < 3) {
157 return -EINVAL; 159 ret = -EINVAL;
160 goto out;
161 }
158 else { 162 else {
159 flr |= 1 << offset; 163 flr |= 1 << offset;
160 bflr |= 1 << offset; 164 bflr |= 1 << offset;
@@ -174,9 +178,10 @@ static int timbgpio_irq_type(unsigned irq, unsigned trigger)
174 iowrite32(bflr, tgpio->membase + TGPIO_BFLR); 178 iowrite32(bflr, tgpio->membase + TGPIO_BFLR);
175 179
176 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR); 180 iowrite32(1 << offset, tgpio->membase + TGPIO_ICR);
177 spin_unlock_irqrestore(&tgpio->lock, flags);
178 181
179 return 0; 182out:
183 spin_unlock_irqrestore(&tgpio->lock, flags);
184 return ret;
180} 185}
181 186
182static void timbgpio_irq(unsigned int irq, struct irq_desc *desc) 187static void timbgpio_irq(unsigned int irq, struct irq_desc *desc)
diff --git a/drivers/gpio/twl4030-gpio.c b/drivers/gpio/twl4030-gpio.c
index 7fe881e2bdfb..57635ac35a73 100644
--- a/drivers/gpio/twl4030-gpio.c
+++ b/drivers/gpio/twl4030-gpio.c
@@ -32,7 +32,6 @@
32#include <linux/irq.h> 32#include <linux/irq.h>
33#include <linux/gpio.h> 33#include <linux/gpio.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/slab.h>
36 35
37#include <linux/i2c/twl.h> 36#include <linux/i2c/twl.h>
38 37
diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c
index d09021f4a7d3..1fa449a1a4cb 100644
--- a/drivers/gpio/wm831x-gpio.c
+++ b/drivers/gpio/wm831x-gpio.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/slab.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/gpio.h> 18#include <linux/gpio.h>
18#include <linux/mfd/core.h> 19#include <linux/mfd/core.h>
diff --git a/drivers/gpio/wm8350-gpiolib.c b/drivers/gpio/wm8350-gpiolib.c
index 511840d1c7ba..359999290f55 100644
--- a/drivers/gpio/wm8350-gpiolib.c
+++ b/drivers/gpio/wm8350-gpiolib.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/slab.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/gpio.h> 18#include <linux/gpio.h>
18#include <linux/mfd/core.h> 19#include <linux/mfd/core.h>
diff --git a/drivers/gpio/wm8994-gpio.c b/drivers/gpio/wm8994-gpio.c
index de28b4a470ea..7607cc61e1dd 100644
--- a/drivers/gpio/wm8994-gpio.c
+++ b/drivers/gpio/wm8994-gpio.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/slab.h>
16#include <linux/module.h> 17#include <linux/module.h>
17#include <linux/gpio.h> 18#include <linux/gpio.h>
18#include <linux/mfd/core.h> 19#include <linux/mfd/core.h>
diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
index 3c1177abebd3..b8fa65b5bfca 100644
--- a/drivers/gpio/xilinx_gpio.c
+++ b/drivers/gpio/xilinx_gpio.c
@@ -19,6 +19,7 @@
19#include <linux/of_gpio.h> 19#include <linux/of_gpio.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/slab.h>
22 23
23/* Register Offset Definitions */ 24/* Register Offset Definitions */
24#define XGPIO_DATA_OFFSET (0x0) /* Data register */ 25#define XGPIO_DATA_OFFSET (0x0) /* Data register */