diff options
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/Kconfig | 11 | ||||
-rw-r--r-- | drivers/gpio/cs5535-gpio.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpiolib.c | 49 | ||||
-rw-r--r-- | drivers/gpio/it8761e_gpio.c | 5 | ||||
-rw-r--r-- | drivers/gpio/langwell_gpio.c | 83 | ||||
-rw-r--r-- | drivers/gpio/max732x.c | 368 | ||||
-rw-r--r-- | drivers/gpio/pca953x.c | 2 | ||||
-rw-r--r-- | drivers/gpio/pl061.c | 2 |
8 files changed, 459 insertions, 63 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index fee678f74a19..4fd0f276df5a 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig | |||
@@ -139,6 +139,13 @@ config GPIO_MAX732X | |||
139 | Board setup code must specify the model to use, and the start | 139 | Board setup code must specify the model to use, and the start |
140 | number for these GPIOs. | 140 | number for these GPIOs. |
141 | 141 | ||
142 | config GPIO_MAX732X_IRQ | ||
143 | bool "Interrupt controller support for MAX732x" | ||
144 | depends on GPIO_MAX732X=y && GENERIC_HARDIRQS | ||
145 | help | ||
146 | Say yes here to enable the max732x to be used as an interrupt | ||
147 | controller. It requires the driver to be built in the kernel. | ||
148 | |||
142 | config GPIO_PCA953X | 149 | config GPIO_PCA953X |
143 | tristate "PCA953x, PCA955x, TCA64xx, and MAX7310 I/O ports" | 150 | tristate "PCA953x, PCA955x, TCA64xx, and MAX7310 I/O ports" |
144 | depends on I2C | 151 | depends on I2C |
@@ -264,10 +271,10 @@ config GPIO_BT8XX | |||
264 | If unsure, say N. | 271 | If unsure, say N. |
265 | 272 | ||
266 | config GPIO_LANGWELL | 273 | config GPIO_LANGWELL |
267 | bool "Intel Moorestown Platform Langwell GPIO support" | 274 | bool "Intel Langwell/Penwell GPIO support" |
268 | depends on PCI | 275 | depends on PCI |
269 | help | 276 | help |
270 | Say Y here to support Intel Moorestown platform GPIO. | 277 | Say Y here to support Intel Langwell/Penwell GPIO. |
271 | 278 | ||
272 | config GPIO_TIMBERDALE | 279 | config GPIO_TIMBERDALE |
273 | bool "Support for timberdale GPIO IP" | 280 | bool "Support for timberdale GPIO IP" |
diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c index 0c3c498f2260..f73a1555e49d 100644 --- a/drivers/gpio/cs5535-gpio.c +++ b/drivers/gpio/cs5535-gpio.c | |||
@@ -197,7 +197,7 @@ static int chip_direction_output(struct gpio_chip *c, unsigned offset, int val) | |||
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
199 | 199 | ||
200 | static char *cs5535_gpio_names[] = { | 200 | static const char * const cs5535_gpio_names[] = { |
201 | "GPIO0", "GPIO1", "GPIO2", "GPIO3", | 201 | "GPIO0", "GPIO1", "GPIO2", "GPIO3", |
202 | "GPIO4", "GPIO5", "GPIO6", "GPIO7", | 202 | "GPIO4", "GPIO5", "GPIO6", "GPIO7", |
203 | "GPIO8", "GPIO9", "GPIO10", "GPIO11", | 203 | "GPIO8", "GPIO9", "GPIO10", "GPIO11", |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index cae1b8c5b08c..3ca36542e338 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -722,7 +722,7 @@ int gpio_export(unsigned gpio, bool direction_may_change) | |||
722 | unsigned long flags; | 722 | unsigned long flags; |
723 | struct gpio_desc *desc; | 723 | struct gpio_desc *desc; |
724 | int status = -EINVAL; | 724 | int status = -EINVAL; |
725 | char *ioname = NULL; | 725 | const char *ioname = NULL; |
726 | 726 | ||
727 | /* can't export until sysfs is available ... */ | 727 | /* can't export until sysfs is available ... */ |
728 | if (!gpio_class.p) { | 728 | if (!gpio_class.p) { |
@@ -753,7 +753,7 @@ int gpio_export(unsigned gpio, bool direction_may_change) | |||
753 | struct device *dev; | 753 | struct device *dev; |
754 | 754 | ||
755 | dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), | 755 | dev = device_create(&gpio_class, desc->chip->dev, MKDEV(0, 0), |
756 | desc, ioname ? ioname : "gpio%d", gpio); | 756 | desc, ioname ? ioname : "gpio%u", gpio); |
757 | if (!IS_ERR(dev)) { | 757 | if (!IS_ERR(dev)) { |
758 | status = sysfs_create_group(&dev->kobj, | 758 | status = sysfs_create_group(&dev->kobj, |
759 | &gpio_attr_group); | 759 | &gpio_attr_group); |
@@ -1106,7 +1106,7 @@ unlock: | |||
1106 | fail: | 1106 | fail: |
1107 | /* failures here can mean systems won't boot... */ | 1107 | /* failures here can mean systems won't boot... */ |
1108 | if (status) | 1108 | if (status) |
1109 | pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", | 1109 | pr_err("gpiochip_add: gpios %d..%d (%s) failed to register\n", |
1110 | chip->base, chip->base + chip->ngpio - 1, | 1110 | chip->base, chip->base + chip->ngpio - 1, |
1111 | chip->label ? : "generic"); | 1111 | chip->label ? : "generic"); |
1112 | return status; | 1112 | return status; |
@@ -1447,6 +1447,49 @@ fail: | |||
1447 | } | 1447 | } |
1448 | EXPORT_SYMBOL_GPL(gpio_direction_output); | 1448 | EXPORT_SYMBOL_GPL(gpio_direction_output); |
1449 | 1449 | ||
1450 | /** | ||
1451 | * gpio_set_debounce - sets @debounce time for a @gpio | ||
1452 | * @gpio: the gpio to set debounce time | ||
1453 | * @debounce: debounce time is microseconds | ||
1454 | */ | ||
1455 | int gpio_set_debounce(unsigned gpio, unsigned debounce) | ||
1456 | { | ||
1457 | unsigned long flags; | ||
1458 | struct gpio_chip *chip; | ||
1459 | struct gpio_desc *desc = &gpio_desc[gpio]; | ||
1460 | int status = -EINVAL; | ||
1461 | |||
1462 | spin_lock_irqsave(&gpio_lock, flags); | ||
1463 | |||
1464 | if (!gpio_is_valid(gpio)) | ||
1465 | goto fail; | ||
1466 | chip = desc->chip; | ||
1467 | if (!chip || !chip->set || !chip->set_debounce) | ||
1468 | goto fail; | ||
1469 | gpio -= chip->base; | ||
1470 | if (gpio >= chip->ngpio) | ||
1471 | goto fail; | ||
1472 | status = gpio_ensure_requested(desc, gpio); | ||
1473 | if (status < 0) | ||
1474 | goto fail; | ||
1475 | |||
1476 | /* now we know the gpio is valid and chip won't vanish */ | ||
1477 | |||
1478 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
1479 | |||
1480 | might_sleep_if(extra_checks && chip->can_sleep); | ||
1481 | |||
1482 | return chip->set_debounce(chip, gpio, debounce); | ||
1483 | |||
1484 | fail: | ||
1485 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
1486 | if (status) | ||
1487 | pr_debug("%s: gpio-%d status %d\n", | ||
1488 | __func__, gpio, status); | ||
1489 | |||
1490 | return status; | ||
1491 | } | ||
1492 | EXPORT_SYMBOL_GPL(gpio_set_debounce); | ||
1450 | 1493 | ||
1451 | /* I/O calls are only valid after configuration completed; the relevant | 1494 | /* I/O calls are only valid after configuration completed; the relevant |
1452 | * "is this a valid GPIO" error checks should already have been done. | 1495 | * "is this a valid GPIO" error checks should already have been done. |
diff --git a/drivers/gpio/it8761e_gpio.c b/drivers/gpio/it8761e_gpio.c index 41a9388f2fde..48fc43c4bdd1 100644 --- a/drivers/gpio/it8761e_gpio.c +++ b/drivers/gpio/it8761e_gpio.c | |||
@@ -217,7 +217,10 @@ gpiochip_add_err: | |||
217 | static void __exit it8761e_gpio_exit(void) | 217 | static void __exit it8761e_gpio_exit(void) |
218 | { | 218 | { |
219 | if (gpio_ba) { | 219 | if (gpio_ba) { |
220 | gpiochip_remove(&it8761e_gpio_chip); | 220 | int ret = gpiochip_remove(&it8761e_gpio_chip); |
221 | |||
222 | WARN(ret, "%s(): gpiochip_remove() failed, ret=%d\n", | ||
223 | __func__, ret); | ||
221 | 224 | ||
222 | release_region(gpio_ba, GPIO_IOSIZE); | 225 | release_region(gpio_ba, GPIO_IOSIZE); |
223 | gpio_ba = 0; | 226 | gpio_ba = 0; |
diff --git a/drivers/gpio/langwell_gpio.c b/drivers/gpio/langwell_gpio.c index 00c3a14127af..8383a8d7f994 100644 --- a/drivers/gpio/langwell_gpio.c +++ b/drivers/gpio/langwell_gpio.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | /* Supports: | 18 | /* Supports: |
19 | * Moorestown platform Langwell chip. | 19 | * Moorestown platform Langwell chip. |
20 | * Medfield platform Penwell chip. | ||
20 | */ | 21 | */ |
21 | 22 | ||
22 | #include <linux/module.h> | 23 | #include <linux/module.h> |
@@ -31,44 +32,65 @@ | |||
31 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
32 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
33 | 34 | ||
34 | struct lnw_gpio_register { | 35 | /* |
35 | u32 GPLR[2]; | 36 | * Langwell chip has 64 pins and thus there are 2 32bit registers to control |
36 | u32 GPDR[2]; | 37 | * each feature, while Penwell chip has 96 pins for each block, and need 3 32bit |
37 | u32 GPSR[2]; | 38 | * registers to control them, so we only define the order here instead of a |
38 | u32 GPCR[2]; | 39 | * structure, to get a bit offset for a pin (use GPDR as an example): |
39 | u32 GRER[2]; | 40 | * |
40 | u32 GFER[2]; | 41 | * nreg = ngpio / 32; |
41 | u32 GEDR[2]; | 42 | * reg = offset / 32; |
43 | * bit = offset % 32; | ||
44 | * reg_addr = reg_base + GPDR * nreg * 4 + reg * 4; | ||
45 | * | ||
46 | * so the bit of reg_addr is to control pin offset's GPDR feature | ||
47 | */ | ||
48 | |||
49 | enum GPIO_REG { | ||
50 | GPLR = 0, /* pin level read-only */ | ||
51 | GPDR, /* pin direction */ | ||
52 | GPSR, /* pin set */ | ||
53 | GPCR, /* pin clear */ | ||
54 | GRER, /* rising edge detect */ | ||
55 | GFER, /* falling edge detect */ | ||
56 | GEDR, /* edge detect result */ | ||
42 | }; | 57 | }; |
43 | 58 | ||
44 | struct lnw_gpio { | 59 | struct lnw_gpio { |
45 | struct gpio_chip chip; | 60 | struct gpio_chip chip; |
46 | struct lnw_gpio_register *reg_base; | 61 | void *reg_base; |
47 | spinlock_t lock; | 62 | spinlock_t lock; |
48 | unsigned irq_base; | 63 | unsigned irq_base; |
49 | }; | 64 | }; |
50 | 65 | ||
51 | static int lnw_gpio_get(struct gpio_chip *chip, unsigned offset) | 66 | static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, |
67 | enum GPIO_REG reg_type) | ||
52 | { | 68 | { |
53 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); | 69 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); |
70 | unsigned nreg = chip->ngpio / 32; | ||
54 | u8 reg = offset / 32; | 71 | u8 reg = offset / 32; |
55 | void __iomem *gplr; | 72 | void __iomem *ptr; |
73 | |||
74 | ptr = (void __iomem *)(lnw->reg_base + reg_type * nreg * 4 + reg * 4); | ||
75 | return ptr; | ||
76 | } | ||
77 | |||
78 | static int lnw_gpio_get(struct gpio_chip *chip, unsigned offset) | ||
79 | { | ||
80 | void __iomem *gplr = gpio_reg(chip, offset, GPLR); | ||
56 | 81 | ||
57 | gplr = (void __iomem *)(&lnw->reg_base->GPLR[reg]); | ||
58 | return readl(gplr) & BIT(offset % 32); | 82 | return readl(gplr) & BIT(offset % 32); |
59 | } | 83 | } |
60 | 84 | ||
61 | static void lnw_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | 85 | static void lnw_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
62 | { | 86 | { |
63 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); | ||
64 | u8 reg = offset / 32; | ||
65 | void __iomem *gpsr, *gpcr; | 87 | void __iomem *gpsr, *gpcr; |
66 | 88 | ||
67 | if (value) { | 89 | if (value) { |
68 | gpsr = (void __iomem *)(&lnw->reg_base->GPSR[reg]); | 90 | gpsr = gpio_reg(chip, offset, GPSR); |
69 | writel(BIT(offset % 32), gpsr); | 91 | writel(BIT(offset % 32), gpsr); |
70 | } else { | 92 | } else { |
71 | gpcr = (void __iomem *)(&lnw->reg_base->GPCR[reg]); | 93 | gpcr = gpio_reg(chip, offset, GPCR); |
72 | writel(BIT(offset % 32), gpcr); | 94 | writel(BIT(offset % 32), gpcr); |
73 | } | 95 | } |
74 | } | 96 | } |
@@ -76,12 +98,10 @@ static void lnw_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
76 | static int lnw_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 98 | static int lnw_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
77 | { | 99 | { |
78 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); | 100 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); |
79 | u8 reg = offset / 32; | 101 | void __iomem *gpdr = gpio_reg(chip, offset, GPDR); |
80 | u32 value; | 102 | u32 value; |
81 | unsigned long flags; | 103 | unsigned long flags; |
82 | void __iomem *gpdr; | ||
83 | 104 | ||
84 | gpdr = (void __iomem *)(&lnw->reg_base->GPDR[reg]); | ||
85 | spin_lock_irqsave(&lnw->lock, flags); | 105 | spin_lock_irqsave(&lnw->lock, flags); |
86 | value = readl(gpdr); | 106 | value = readl(gpdr); |
87 | value &= ~BIT(offset % 32); | 107 | value &= ~BIT(offset % 32); |
@@ -94,12 +114,10 @@ static int lnw_gpio_direction_output(struct gpio_chip *chip, | |||
94 | unsigned offset, int value) | 114 | unsigned offset, int value) |
95 | { | 115 | { |
96 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); | 116 | struct lnw_gpio *lnw = container_of(chip, struct lnw_gpio, chip); |
97 | u8 reg = offset / 32; | 117 | void __iomem *gpdr = gpio_reg(chip, offset, GPDR); |
98 | unsigned long flags; | 118 | unsigned long flags; |
99 | void __iomem *gpdr; | ||
100 | 119 | ||
101 | lnw_gpio_set(chip, offset, value); | 120 | lnw_gpio_set(chip, offset, value); |
102 | gpdr = (void __iomem *)(&lnw->reg_base->GPDR[reg]); | ||
103 | spin_lock_irqsave(&lnw->lock, flags); | 121 | spin_lock_irqsave(&lnw->lock, flags); |
104 | value = readl(gpdr); | 122 | value = readl(gpdr); |
105 | value |= BIT(offset % 32);; | 123 | value |= BIT(offset % 32);; |
@@ -118,11 +136,10 @@ static int lnw_irq_type(unsigned irq, unsigned type) | |||
118 | { | 136 | { |
119 | struct lnw_gpio *lnw = get_irq_chip_data(irq); | 137 | struct lnw_gpio *lnw = get_irq_chip_data(irq); |
120 | u32 gpio = irq - lnw->irq_base; | 138 | u32 gpio = irq - lnw->irq_base; |
121 | u8 reg = gpio / 32; | ||
122 | unsigned long flags; | 139 | unsigned long flags; |
123 | u32 value; | 140 | u32 value; |
124 | void __iomem *grer = (void __iomem *)(&lnw->reg_base->GRER[reg]); | 141 | void __iomem *grer = gpio_reg(&lnw->chip, gpio, GRER); |
125 | void __iomem *gfer = (void __iomem *)(&lnw->reg_base->GFER[reg]); | 142 | void __iomem *gfer = gpio_reg(&lnw->chip, gpio, GFER); |
126 | 143 | ||
127 | if (gpio >= lnw->chip.ngpio) | 144 | if (gpio >= lnw->chip.ngpio) |
128 | return -EINVAL; | 145 | return -EINVAL; |
@@ -158,8 +175,10 @@ static struct irq_chip lnw_irqchip = { | |||
158 | .set_type = lnw_irq_type, | 175 | .set_type = lnw_irq_type, |
159 | }; | 176 | }; |
160 | 177 | ||
161 | static struct pci_device_id lnw_gpio_ids[] = { | 178 | static DEFINE_PCI_DEVICE_TABLE(lnw_gpio_ids) = { /* pin number */ |
162 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f) }, | 179 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x080f), .driver_data = 64 }, |
180 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081f), .driver_data = 96 }, | ||
181 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x081a), .driver_data = 96 }, | ||
163 | { 0, } | 182 | { 0, } |
164 | }; | 183 | }; |
165 | MODULE_DEVICE_TABLE(pci, lnw_gpio_ids); | 184 | MODULE_DEVICE_TABLE(pci, lnw_gpio_ids); |
@@ -167,17 +186,17 @@ MODULE_DEVICE_TABLE(pci, lnw_gpio_ids); | |||
167 | static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) | 186 | static void lnw_irq_handler(unsigned irq, struct irq_desc *desc) |
168 | { | 187 | { |
169 | struct lnw_gpio *lnw = (struct lnw_gpio *)get_irq_data(irq); | 188 | struct lnw_gpio *lnw = (struct lnw_gpio *)get_irq_data(irq); |
170 | u32 reg, gpio; | 189 | u32 base, gpio; |
171 | void __iomem *gedr; | 190 | void __iomem *gedr; |
172 | u32 gedr_v; | 191 | u32 gedr_v; |
173 | 192 | ||
174 | /* check GPIO controller to check which pin triggered the interrupt */ | 193 | /* check GPIO controller to check which pin triggered the interrupt */ |
175 | for (reg = 0; reg < lnw->chip.ngpio / 32; reg++) { | 194 | for (base = 0; base < lnw->chip.ngpio; base += 32) { |
176 | gedr = (void __iomem *)(&lnw->reg_base->GEDR[reg]); | 195 | gedr = gpio_reg(&lnw->chip, base, GEDR); |
177 | gedr_v = readl(gedr); | 196 | gedr_v = readl(gedr); |
178 | if (!gedr_v) | 197 | if (!gedr_v) |
179 | continue; | 198 | continue; |
180 | for (gpio = reg*32; gpio < reg*32+32; gpio++) | 199 | for (gpio = base; gpio < base + 32; gpio++) |
181 | if (gedr_v & BIT(gpio % 32)) { | 200 | if (gedr_v & BIT(gpio % 32)) { |
182 | pr_debug("pin %d triggered\n", gpio); | 201 | pr_debug("pin %d triggered\n", gpio); |
183 | generic_handle_irq(lnw->irq_base + gpio); | 202 | generic_handle_irq(lnw->irq_base + gpio); |
@@ -245,7 +264,7 @@ static int __devinit lnw_gpio_probe(struct pci_dev *pdev, | |||
245 | lnw->chip.set = lnw_gpio_set; | 264 | lnw->chip.set = lnw_gpio_set; |
246 | lnw->chip.to_irq = lnw_gpio_to_irq; | 265 | lnw->chip.to_irq = lnw_gpio_to_irq; |
247 | lnw->chip.base = gpio_base; | 266 | lnw->chip.base = gpio_base; |
248 | lnw->chip.ngpio = 64; | 267 | lnw->chip.ngpio = id->driver_data; |
249 | lnw->chip.can_sleep = 0; | 268 | lnw->chip.can_sleep = 0; |
250 | pci_set_drvdata(pdev, lnw); | 269 | pci_set_drvdata(pdev, lnw); |
251 | retval = gpiochip_add(&lnw->chip); | 270 | retval = gpiochip_add(&lnw->chip); |
diff --git a/drivers/gpio/max732x.c b/drivers/gpio/max732x.c index f7868243af89..9cad60f9e962 100644 --- a/drivers/gpio/max732x.c +++ b/drivers/gpio/max732x.c | |||
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
19 | #include <linux/gpio.h> | 19 | #include <linux/gpio.h> |
20 | 20 | #include <linux/interrupt.h> | |
21 | #include <linux/irq.h> | ||
21 | #include <linux/i2c.h> | 22 | #include <linux/i2c.h> |
22 | #include <linux/i2c/max732x.h> | 23 | #include <linux/i2c/max732x.h> |
23 | 24 | ||
@@ -31,7 +32,8 @@ | |||
31 | * - Open Drain I/O | 32 | * - Open Drain I/O |
32 | * | 33 | * |
33 | * designated by 'O', 'I' and 'P' individually according to MAXIM's | 34 | * designated by 'O', 'I' and 'P' individually according to MAXIM's |
34 | * datasheets. | 35 | * datasheets. 'I' and 'P' ports are interrupt capables, some with |
36 | * a dedicated interrupt mask. | ||
35 | * | 37 | * |
36 | * There are two groups of I/O ports, each group usually includes | 38 | * There are two groups of I/O ports, each group usually includes |
37 | * up to 8 I/O ports, and is accessed by a specific I2C address: | 39 | * up to 8 I/O ports, and is accessed by a specific I2C address: |
@@ -44,7 +46,8 @@ | |||
44 | * | 46 | * |
45 | * Within each group of ports, there are five known combinations of | 47 | * Within each group of ports, there are five known combinations of |
46 | * I/O ports: 4I4O, 4P4O, 8I, 8P, 8O, see the definitions below for | 48 | * I/O ports: 4I4O, 4P4O, 8I, 8P, 8O, see the definitions below for |
47 | * the detailed organization of these ports. | 49 | * the detailed organization of these ports. Only Goup A is interrupt |
50 | * capable. | ||
48 | * | 51 | * |
49 | * GPIO numbers start from 'gpio_base + 0' to 'gpio_base + 8/16', | 52 | * GPIO numbers start from 'gpio_base + 0' to 'gpio_base + 8/16', |
50 | * and GPIOs from GROUP_A are numbered before those from GROUP_B | 53 | * and GPIOs from GROUP_A are numbered before those from GROUP_B |
@@ -68,16 +71,47 @@ | |||
68 | #define GROUP_A(x) ((x) & 0xffff) /* I2C Addr: 0b'110xxxx */ | 71 | #define GROUP_A(x) ((x) & 0xffff) /* I2C Addr: 0b'110xxxx */ |
69 | #define GROUP_B(x) ((x) << 16) /* I2C Addr: 0b'101xxxx */ | 72 | #define GROUP_B(x) ((x) << 16) /* I2C Addr: 0b'101xxxx */ |
70 | 73 | ||
74 | #define INT_NONE 0x0 /* No interrupt capability */ | ||
75 | #define INT_NO_MASK 0x1 /* Has interrupts, no mask */ | ||
76 | #define INT_INDEP_MASK 0x2 /* Has interrupts, independent mask */ | ||
77 | #define INT_MERGED_MASK 0x3 /* Has interrupts, merged mask */ | ||
78 | |||
79 | #define INT_CAPS(x) (((uint64_t)(x)) << 32) | ||
80 | |||
81 | enum { | ||
82 | MAX7319, | ||
83 | MAX7320, | ||
84 | MAX7321, | ||
85 | MAX7322, | ||
86 | MAX7323, | ||
87 | MAX7324, | ||
88 | MAX7325, | ||
89 | MAX7326, | ||
90 | MAX7327, | ||
91 | }; | ||
92 | |||
93 | static uint64_t max732x_features[] = { | ||
94 | [MAX7319] = GROUP_A(IO_8I) | INT_CAPS(INT_MERGED_MASK), | ||
95 | [MAX7320] = GROUP_B(IO_8O), | ||
96 | [MAX7321] = GROUP_A(IO_8P) | INT_CAPS(INT_NO_MASK), | ||
97 | [MAX7322] = GROUP_A(IO_4I4O) | INT_CAPS(INT_MERGED_MASK), | ||
98 | [MAX7323] = GROUP_A(IO_4P4O) | INT_CAPS(INT_INDEP_MASK), | ||
99 | [MAX7324] = GROUP_A(IO_8I) | GROUP_B(IO_8O) | INT_CAPS(INT_MERGED_MASK), | ||
100 | [MAX7325] = GROUP_A(IO_8P) | GROUP_B(IO_8O) | INT_CAPS(INT_NO_MASK), | ||
101 | [MAX7326] = GROUP_A(IO_4I4O) | GROUP_B(IO_8O) | INT_CAPS(INT_MERGED_MASK), | ||
102 | [MAX7327] = GROUP_A(IO_4P4O) | GROUP_B(IO_8O) | INT_CAPS(INT_NO_MASK), | ||
103 | }; | ||
104 | |||
71 | static const struct i2c_device_id max732x_id[] = { | 105 | static const struct i2c_device_id max732x_id[] = { |
72 | { "max7319", GROUP_A(IO_8I) }, | 106 | { "max7319", MAX7319 }, |
73 | { "max7320", GROUP_B(IO_8O) }, | 107 | { "max7320", MAX7320 }, |
74 | { "max7321", GROUP_A(IO_8P) }, | 108 | { "max7321", MAX7321 }, |
75 | { "max7322", GROUP_A(IO_4I4O) }, | 109 | { "max7322", MAX7322 }, |
76 | { "max7323", GROUP_A(IO_4P4O) }, | 110 | { "max7323", MAX7323 }, |
77 | { "max7324", GROUP_A(IO_8I) | GROUP_B(IO_8O) }, | 111 | { "max7324", MAX7324 }, |
78 | { "max7325", GROUP_A(IO_8P) | GROUP_B(IO_8O) }, | 112 | { "max7325", MAX7325 }, |
79 | { "max7326", GROUP_A(IO_4I4O) | GROUP_B(IO_8O) }, | 113 | { "max7326", MAX7326 }, |
80 | { "max7327", GROUP_A(IO_4P4O) | GROUP_B(IO_8O) }, | 114 | { "max7327", MAX7327 }, |
81 | { }, | 115 | { }, |
82 | }; | 116 | }; |
83 | MODULE_DEVICE_TABLE(i2c, max732x_id); | 117 | MODULE_DEVICE_TABLE(i2c, max732x_id); |
@@ -96,9 +130,19 @@ struct max732x_chip { | |||
96 | 130 | ||
97 | struct mutex lock; | 131 | struct mutex lock; |
98 | uint8_t reg_out[2]; | 132 | uint8_t reg_out[2]; |
133 | |||
134 | #ifdef CONFIG_GPIO_MAX732X_IRQ | ||
135 | struct mutex irq_lock; | ||
136 | int irq_base; | ||
137 | uint8_t irq_mask; | ||
138 | uint8_t irq_mask_cur; | ||
139 | uint8_t irq_trig_raise; | ||
140 | uint8_t irq_trig_fall; | ||
141 | uint8_t irq_features; | ||
142 | #endif | ||
99 | }; | 143 | }; |
100 | 144 | ||
101 | static int max732x_write(struct max732x_chip *chip, int group_a, uint8_t val) | 145 | static int max732x_writeb(struct max732x_chip *chip, int group_a, uint8_t val) |
102 | { | 146 | { |
103 | struct i2c_client *client; | 147 | struct i2c_client *client; |
104 | int ret; | 148 | int ret; |
@@ -113,7 +157,7 @@ static int max732x_write(struct max732x_chip *chip, int group_a, uint8_t val) | |||
113 | return 0; | 157 | return 0; |
114 | } | 158 | } |
115 | 159 | ||
116 | static int max732x_read(struct max732x_chip *chip, int group_a, uint8_t *val) | 160 | static int max732x_readb(struct max732x_chip *chip, int group_a, uint8_t *val) |
117 | { | 161 | { |
118 | struct i2c_client *client; | 162 | struct i2c_client *client; |
119 | int ret; | 163 | int ret; |
@@ -142,7 +186,7 @@ static int max732x_gpio_get_value(struct gpio_chip *gc, unsigned off) | |||
142 | 186 | ||
143 | chip = container_of(gc, struct max732x_chip, gpio_chip); | 187 | chip = container_of(gc, struct max732x_chip, gpio_chip); |
144 | 188 | ||
145 | ret = max732x_read(chip, is_group_a(chip, off), ®_val); | 189 | ret = max732x_readb(chip, is_group_a(chip, off), ®_val); |
146 | if (ret < 0) | 190 | if (ret < 0) |
147 | return 0; | 191 | return 0; |
148 | 192 | ||
@@ -162,7 +206,7 @@ static void max732x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val) | |||
162 | reg_out = (off > 7) ? chip->reg_out[1] : chip->reg_out[0]; | 206 | reg_out = (off > 7) ? chip->reg_out[1] : chip->reg_out[0]; |
163 | reg_out = (val) ? reg_out | mask : reg_out & ~mask; | 207 | reg_out = (val) ? reg_out | mask : reg_out & ~mask; |
164 | 208 | ||
165 | ret = max732x_write(chip, is_group_a(chip, off), reg_out); | 209 | ret = max732x_writeb(chip, is_group_a(chip, off), reg_out); |
166 | if (ret < 0) | 210 | if (ret < 0) |
167 | goto out; | 211 | goto out; |
168 | 212 | ||
@@ -188,6 +232,13 @@ static int max732x_gpio_direction_input(struct gpio_chip *gc, unsigned off) | |||
188 | return -EACCES; | 232 | return -EACCES; |
189 | } | 233 | } |
190 | 234 | ||
235 | /* | ||
236 | * Open-drain pins must be set to high impedance (which is | ||
237 | * equivalent to output-high) to be turned into an input. | ||
238 | */ | ||
239 | if ((mask & chip->dir_output)) | ||
240 | max732x_gpio_set_value(gc, off, 1); | ||
241 | |||
191 | return 0; | 242 | return 0; |
192 | } | 243 | } |
193 | 244 | ||
@@ -209,12 +260,278 @@ static int max732x_gpio_direction_output(struct gpio_chip *gc, | |||
209 | return 0; | 260 | return 0; |
210 | } | 261 | } |
211 | 262 | ||
263 | #ifdef CONFIG_GPIO_MAX732X_IRQ | ||
264 | static int max732x_writew(struct max732x_chip *chip, uint16_t val) | ||
265 | { | ||
266 | int ret; | ||
267 | |||
268 | val = cpu_to_le16(val); | ||
269 | |||
270 | ret = i2c_master_send(chip->client_group_a, (char *)&val, 2); | ||
271 | if (ret < 0) { | ||
272 | dev_err(&chip->client_group_a->dev, "failed writing\n"); | ||
273 | return ret; | ||
274 | } | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | static int max732x_readw(struct max732x_chip *chip, uint16_t *val) | ||
280 | { | ||
281 | int ret; | ||
282 | |||
283 | ret = i2c_master_recv(chip->client_group_a, (char *)val, 2); | ||
284 | if (ret < 0) { | ||
285 | dev_err(&chip->client_group_a->dev, "failed reading\n"); | ||
286 | return ret; | ||
287 | } | ||
288 | |||
289 | *val = le16_to_cpu(*val); | ||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | static void max732x_irq_update_mask(struct max732x_chip *chip) | ||
294 | { | ||
295 | uint16_t msg; | ||
296 | |||
297 | if (chip->irq_mask == chip->irq_mask_cur) | ||
298 | return; | ||
299 | |||
300 | chip->irq_mask = chip->irq_mask_cur; | ||
301 | |||
302 | if (chip->irq_features == INT_NO_MASK) | ||
303 | return; | ||
304 | |||
305 | mutex_lock(&chip->lock); | ||
306 | |||
307 | switch (chip->irq_features) { | ||
308 | case INT_INDEP_MASK: | ||
309 | msg = (chip->irq_mask << 8) | chip->reg_out[0]; | ||
310 | max732x_writew(chip, msg); | ||
311 | break; | ||
312 | |||
313 | case INT_MERGED_MASK: | ||
314 | msg = chip->irq_mask | chip->reg_out[0]; | ||
315 | max732x_writeb(chip, 1, (uint8_t)msg); | ||
316 | break; | ||
317 | } | ||
318 | |||
319 | mutex_unlock(&chip->lock); | ||
320 | } | ||
321 | |||
322 | static int max732x_gpio_to_irq(struct gpio_chip *gc, unsigned off) | ||
323 | { | ||
324 | struct max732x_chip *chip; | ||
325 | |||
326 | chip = container_of(gc, struct max732x_chip, gpio_chip); | ||
327 | return chip->irq_base + off; | ||
328 | } | ||
329 | |||
330 | static void max732x_irq_mask(unsigned int irq) | ||
331 | { | ||
332 | struct max732x_chip *chip = get_irq_chip_data(irq); | ||
333 | |||
334 | chip->irq_mask_cur &= ~(1 << (irq - chip->irq_base)); | ||
335 | } | ||
336 | |||
337 | static void max732x_irq_unmask(unsigned int irq) | ||
338 | { | ||
339 | struct max732x_chip *chip = get_irq_chip_data(irq); | ||
340 | |||
341 | chip->irq_mask_cur |= 1 << (irq - chip->irq_base); | ||
342 | } | ||
343 | |||
344 | static void max732x_irq_bus_lock(unsigned int irq) | ||
345 | { | ||
346 | struct max732x_chip *chip = get_irq_chip_data(irq); | ||
347 | |||
348 | mutex_lock(&chip->irq_lock); | ||
349 | chip->irq_mask_cur = chip->irq_mask; | ||
350 | } | ||
351 | |||
352 | static void max732x_irq_bus_sync_unlock(unsigned int irq) | ||
353 | { | ||
354 | struct max732x_chip *chip = get_irq_chip_data(irq); | ||
355 | |||
356 | max732x_irq_update_mask(chip); | ||
357 | mutex_unlock(&chip->irq_lock); | ||
358 | } | ||
359 | |||
360 | static int max732x_irq_set_type(unsigned int irq, unsigned int type) | ||
361 | { | ||
362 | struct max732x_chip *chip = get_irq_chip_data(irq); | ||
363 | uint16_t off = irq - chip->irq_base; | ||
364 | uint16_t mask = 1 << off; | ||
365 | |||
366 | if (!(mask & chip->dir_input)) { | ||
367 | dev_dbg(&chip->client->dev, "%s port %d is output only\n", | ||
368 | chip->client->name, off); | ||
369 | return -EACCES; | ||
370 | } | ||
371 | |||
372 | if (!(type & IRQ_TYPE_EDGE_BOTH)) { | ||
373 | dev_err(&chip->client->dev, "irq %d: unsupported type %d\n", | ||
374 | irq, type); | ||
375 | return -EINVAL; | ||
376 | } | ||
377 | |||
378 | if (type & IRQ_TYPE_EDGE_FALLING) | ||
379 | chip->irq_trig_fall |= mask; | ||
380 | else | ||
381 | chip->irq_trig_fall &= ~mask; | ||
382 | |||
383 | if (type & IRQ_TYPE_EDGE_RISING) | ||
384 | chip->irq_trig_raise |= mask; | ||
385 | else | ||
386 | chip->irq_trig_raise &= ~mask; | ||
387 | |||
388 | return max732x_gpio_direction_input(&chip->gpio_chip, off); | ||
389 | } | ||
390 | |||
391 | static struct irq_chip max732x_irq_chip = { | ||
392 | .name = "max732x", | ||
393 | .mask = max732x_irq_mask, | ||
394 | .unmask = max732x_irq_unmask, | ||
395 | .bus_lock = max732x_irq_bus_lock, | ||
396 | .bus_sync_unlock = max732x_irq_bus_sync_unlock, | ||
397 | .set_type = max732x_irq_set_type, | ||
398 | }; | ||
399 | |||
400 | static uint8_t max732x_irq_pending(struct max732x_chip *chip) | ||
401 | { | ||
402 | uint8_t cur_stat; | ||
403 | uint8_t old_stat; | ||
404 | uint8_t trigger; | ||
405 | uint8_t pending; | ||
406 | uint16_t status; | ||
407 | int ret; | ||
408 | |||
409 | ret = max732x_readw(chip, &status); | ||
410 | if (ret) | ||
411 | return 0; | ||
412 | |||
413 | trigger = status >> 8; | ||
414 | trigger &= chip->irq_mask; | ||
415 | |||
416 | if (!trigger) | ||
417 | return 0; | ||
418 | |||
419 | cur_stat = status & 0xFF; | ||
420 | cur_stat &= chip->irq_mask; | ||
421 | |||
422 | old_stat = cur_stat ^ trigger; | ||
423 | |||
424 | pending = (old_stat & chip->irq_trig_fall) | | ||
425 | (cur_stat & chip->irq_trig_raise); | ||
426 | pending &= trigger; | ||
427 | |||
428 | return pending; | ||
429 | } | ||
430 | |||
431 | static irqreturn_t max732x_irq_handler(int irq, void *devid) | ||
432 | { | ||
433 | struct max732x_chip *chip = devid; | ||
434 | uint8_t pending; | ||
435 | uint8_t level; | ||
436 | |||
437 | pending = max732x_irq_pending(chip); | ||
438 | |||
439 | if (!pending) | ||
440 | return IRQ_HANDLED; | ||
441 | |||
442 | do { | ||
443 | level = __ffs(pending); | ||
444 | handle_nested_irq(level + chip->irq_base); | ||
445 | |||
446 | pending &= ~(1 << level); | ||
447 | } while (pending); | ||
448 | |||
449 | return IRQ_HANDLED; | ||
450 | } | ||
451 | |||
452 | static int max732x_irq_setup(struct max732x_chip *chip, | ||
453 | const struct i2c_device_id *id) | ||
454 | { | ||
455 | struct i2c_client *client = chip->client; | ||
456 | struct max732x_platform_data *pdata = client->dev.platform_data; | ||
457 | int has_irq = max732x_features[id->driver_data] >> 32; | ||
458 | int ret; | ||
459 | |||
460 | if (pdata->irq_base && has_irq != INT_NONE) { | ||
461 | int lvl; | ||
462 | |||
463 | chip->irq_base = pdata->irq_base; | ||
464 | chip->irq_features = has_irq; | ||
465 | mutex_init(&chip->irq_lock); | ||
466 | |||
467 | for (lvl = 0; lvl < chip->gpio_chip.ngpio; lvl++) { | ||
468 | int irq = lvl + chip->irq_base; | ||
469 | |||
470 | if (!(chip->dir_input & (1 << lvl))) | ||
471 | continue; | ||
472 | |||
473 | set_irq_chip_data(irq, chip); | ||
474 | set_irq_chip_and_handler(irq, &max732x_irq_chip, | ||
475 | handle_edge_irq); | ||
476 | set_irq_nested_thread(irq, 1); | ||
477 | #ifdef CONFIG_ARM | ||
478 | set_irq_flags(irq, IRQF_VALID); | ||
479 | #else | ||
480 | set_irq_noprobe(irq); | ||
481 | #endif | ||
482 | } | ||
483 | |||
484 | ret = request_threaded_irq(client->irq, | ||
485 | NULL, | ||
486 | max732x_irq_handler, | ||
487 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | ||
488 | dev_name(&client->dev), chip); | ||
489 | if (ret) { | ||
490 | dev_err(&client->dev, "failed to request irq %d\n", | ||
491 | client->irq); | ||
492 | goto out_failed; | ||
493 | } | ||
494 | |||
495 | chip->gpio_chip.to_irq = max732x_gpio_to_irq; | ||
496 | } | ||
497 | |||
498 | return 0; | ||
499 | |||
500 | out_failed: | ||
501 | chip->irq_base = 0; | ||
502 | return ret; | ||
503 | } | ||
504 | |||
505 | static void max732x_irq_teardown(struct max732x_chip *chip) | ||
506 | { | ||
507 | if (chip->irq_base) | ||
508 | free_irq(chip->client->irq, chip); | ||
509 | } | ||
510 | #else /* CONFIG_GPIO_MAX732X_IRQ */ | ||
511 | static int max732x_irq_setup(struct max732x_chip *chip, | ||
512 | const struct i2c_device_id *id) | ||
513 | { | ||
514 | struct i2c_client *client = chip->client; | ||
515 | struct max732x_platform_data *pdata = client->dev.platform_data; | ||
516 | int has_irq = max732x_features[id->driver_data] >> 32; | ||
517 | |||
518 | if (pdata->irq_base && has_irq != INT_NONE) | ||
519 | dev_warn(&client->dev, "interrupt support not compiled in\n"); | ||
520 | |||
521 | return 0; | ||
522 | } | ||
523 | |||
524 | static void max732x_irq_teardown(struct max732x_chip *chip) | ||
525 | { | ||
526 | } | ||
527 | #endif | ||
528 | |||
212 | static int __devinit max732x_setup_gpio(struct max732x_chip *chip, | 529 | static int __devinit max732x_setup_gpio(struct max732x_chip *chip, |
213 | const struct i2c_device_id *id, | 530 | const struct i2c_device_id *id, |
214 | unsigned gpio_start) | 531 | unsigned gpio_start) |
215 | { | 532 | { |
216 | struct gpio_chip *gc = &chip->gpio_chip; | 533 | struct gpio_chip *gc = &chip->gpio_chip; |
217 | uint32_t id_data = id->driver_data; | 534 | uint32_t id_data = (uint32_t)max732x_features[id->driver_data]; |
218 | int i, port = 0; | 535 | int i, port = 0; |
219 | 536 | ||
220 | for (i = 0; i < 16; i++, id_data >>= 2) { | 537 | for (i = 0; i < 16; i++, id_data >>= 2) { |
@@ -285,14 +602,14 @@ static int __devinit max732x_probe(struct i2c_client *client, | |||
285 | switch (client->addr & 0x70) { | 602 | switch (client->addr & 0x70) { |
286 | case 0x60: | 603 | case 0x60: |
287 | chip->client_group_a = client; | 604 | chip->client_group_a = client; |
288 | if (nr_port > 7) { | 605 | if (nr_port > 8) { |
289 | c = i2c_new_dummy(client->adapter, addr_b); | 606 | c = i2c_new_dummy(client->adapter, addr_b); |
290 | chip->client_group_b = chip->client_dummy = c; | 607 | chip->client_group_b = chip->client_dummy = c; |
291 | } | 608 | } |
292 | break; | 609 | break; |
293 | case 0x50: | 610 | case 0x50: |
294 | chip->client_group_b = client; | 611 | chip->client_group_b = client; |
295 | if (nr_port > 7) { | 612 | if (nr_port > 8) { |
296 | c = i2c_new_dummy(client->adapter, addr_a); | 613 | c = i2c_new_dummy(client->adapter, addr_a); |
297 | chip->client_group_a = chip->client_dummy = c; | 614 | chip->client_group_a = chip->client_dummy = c; |
298 | } | 615 | } |
@@ -306,9 +623,13 @@ static int __devinit max732x_probe(struct i2c_client *client, | |||
306 | 623 | ||
307 | mutex_init(&chip->lock); | 624 | mutex_init(&chip->lock); |
308 | 625 | ||
309 | max732x_read(chip, is_group_a(chip, 0), &chip->reg_out[0]); | 626 | max732x_readb(chip, is_group_a(chip, 0), &chip->reg_out[0]); |
310 | if (nr_port > 7) | 627 | if (nr_port > 8) |
311 | max732x_read(chip, is_group_a(chip, 8), &chip->reg_out[1]); | 628 | max732x_readb(chip, is_group_a(chip, 8), &chip->reg_out[1]); |
629 | |||
630 | ret = max732x_irq_setup(chip, id); | ||
631 | if (ret) | ||
632 | goto out_failed; | ||
312 | 633 | ||
313 | ret = gpiochip_add(&chip->gpio_chip); | 634 | ret = gpiochip_add(&chip->gpio_chip); |
314 | if (ret) | 635 | if (ret) |
@@ -325,6 +646,7 @@ static int __devinit max732x_probe(struct i2c_client *client, | |||
325 | return 0; | 646 | return 0; |
326 | 647 | ||
327 | out_failed: | 648 | out_failed: |
649 | max732x_irq_teardown(chip); | ||
328 | kfree(chip); | 650 | kfree(chip); |
329 | return ret; | 651 | return ret; |
330 | } | 652 | } |
@@ -352,6 +674,8 @@ static int __devexit max732x_remove(struct i2c_client *client) | |||
352 | return ret; | 674 | return ret; |
353 | } | 675 | } |
354 | 676 | ||
677 | max732x_irq_teardown(chip); | ||
678 | |||
355 | /* unregister any dummy i2c_client */ | 679 | /* unregister any dummy i2c_client */ |
356 | if (chip->client_dummy) | 680 | if (chip->client_dummy) |
357 | i2c_unregister_device(chip->client_dummy); | 681 | i2c_unregister_device(chip->client_dummy); |
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c index f156ab3bb6ed..a2b12aa1f2b9 100644 --- a/drivers/gpio/pca953x.c +++ b/drivers/gpio/pca953x.c | |||
@@ -73,7 +73,7 @@ struct pca953x_chip { | |||
73 | struct i2c_client *client; | 73 | struct i2c_client *client; |
74 | struct pca953x_platform_data *dyn_pdata; | 74 | struct pca953x_platform_data *dyn_pdata; |
75 | struct gpio_chip gpio_chip; | 75 | struct gpio_chip gpio_chip; |
76 | char **names; | 76 | const char *const *names; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val) | 79 | static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val) |
diff --git a/drivers/gpio/pl061.c b/drivers/gpio/pl061.c index 105701a1f05b..ee568c8fcbd0 100644 --- a/drivers/gpio/pl061.c +++ b/drivers/gpio/pl061.c | |||
@@ -164,7 +164,7 @@ static int pl061_irq_type(unsigned irq, unsigned trigger) | |||
164 | unsigned long flags; | 164 | unsigned long flags; |
165 | u8 gpiois, gpioibe, gpioiev; | 165 | u8 gpiois, gpioibe, gpioiev; |
166 | 166 | ||
167 | if (offset < 0 || offset > PL061_GPIO_NR) | 167 | if (offset < 0 || offset >= PL061_GPIO_NR) |
168 | return -EINVAL; | 168 | return -EINVAL; |
169 | 169 | ||
170 | spin_lock_irqsave(&chip->irq_lock, flags); | 170 | spin_lock_irqsave(&chip->irq_lock, flags); |