aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/pca953x.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2010-05-05 20:56:07 -0400
committerJames Morris <jmorris@namei.org>2010-05-05 20:56:07 -0400
commit0ffbe2699cda6afbe08501098dff8a8c2fe6ae09 (patch)
tree81b1a2305d16c873371b65c5a863c0268036cefe /drivers/gpio/pca953x.c
parent4e5d6f7ec3833c0da9cf34fa5c53c6058c5908b6 (diff)
parent7ebd467551ed6ae200d7835a84bbda0dcadaa511 (diff)
Merge branch 'master' into next
Diffstat (limited to 'drivers/gpio/pca953x.c')
-rw-r--r--drivers/gpio/pca953x.c15
1 files changed, 14 insertions, 1 deletions
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 = {