gpio/pca953x: Remove dynamic platform data pointer
[pandora-kernel.git] / drivers / gpio / gpio-pca953x.c
1 /*
2  *  PCA953x 4/8/16 bit I/O ports
3  *
4  *  Copyright (C) 2005 Ben Gardner <bgardner@wabtec.com>
5  *  Copyright (C) 2007 Marvell International Ltd.
6  *
7  *  Derived from drivers/i2c/chips/pca9539.c
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; version 2 of the License.
12  */
13
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/gpio.h>
17 #include <linux/interrupt.h>
18 #include <linux/irq.h>
19 #include <linux/i2c.h>
20 #include <linux/i2c/pca953x.h>
21 #include <linux/slab.h>
22 #ifdef CONFIG_OF_GPIO
23 #include <linux/of_platform.h>
24 #include <linux/of_gpio.h>
25 #endif
26
27 #define PCA953X_INPUT           0
28 #define PCA953X_OUTPUT          1
29 #define PCA953X_INVERT          2
30 #define PCA953X_DIRECTION       3
31
32 #define PCA957X_IN              0
33 #define PCA957X_INVRT           1
34 #define PCA957X_BKEN            2
35 #define PCA957X_PUPD            3
36 #define PCA957X_CFG             4
37 #define PCA957X_OUT             5
38 #define PCA957X_MSK             6
39 #define PCA957X_INTS            7
40
41 #define PCA_GPIO_MASK           0x00FF
42 #define PCA_INT                 0x0100
43 #define PCA953X_TYPE            0x1000
44 #define PCA957X_TYPE            0x2000
45
46 static const struct i2c_device_id pca953x_id[] = {
47         { "pca9534", 8  | PCA953X_TYPE | PCA_INT, },
48         { "pca9535", 16 | PCA953X_TYPE | PCA_INT, },
49         { "pca9536", 4  | PCA953X_TYPE, },
50         { "pca9537", 4  | PCA953X_TYPE | PCA_INT, },
51         { "pca9538", 8  | PCA953X_TYPE | PCA_INT, },
52         { "pca9539", 16 | PCA953X_TYPE | PCA_INT, },
53         { "pca9554", 8  | PCA953X_TYPE | PCA_INT, },
54         { "pca9555", 16 | PCA953X_TYPE | PCA_INT, },
55         { "pca9556", 8  | PCA953X_TYPE, },
56         { "pca9557", 8  | PCA953X_TYPE, },
57         { "pca9574", 8  | PCA957X_TYPE | PCA_INT, },
58         { "pca9575", 16 | PCA957X_TYPE | PCA_INT, },
59
60         { "max7310", 8  | PCA953X_TYPE, },
61         { "max7312", 16 | PCA953X_TYPE | PCA_INT, },
62         { "max7313", 16 | PCA953X_TYPE | PCA_INT, },
63         { "max7315", 8  | PCA953X_TYPE | PCA_INT, },
64         { "pca6107", 8  | PCA953X_TYPE | PCA_INT, },
65         { "tca6408", 8  | PCA953X_TYPE | PCA_INT, },
66         { "tca6416", 16 | PCA953X_TYPE | PCA_INT, },
67         /* NYET:  { "tca6424", 24, }, */
68         { }
69 };
70 MODULE_DEVICE_TABLE(i2c, pca953x_id);
71
72 struct pca953x_chip {
73         unsigned gpio_start;
74         uint16_t reg_output;
75         uint16_t reg_direction;
76         struct mutex i2c_lock;
77
78 #ifdef CONFIG_GPIO_PCA953X_IRQ
79         struct mutex irq_lock;
80         uint16_t irq_mask;
81         uint16_t irq_stat;
82         uint16_t irq_trig_raise;
83         uint16_t irq_trig_fall;
84         int      irq_base;
85 #endif
86
87         struct i2c_client *client;
88         struct gpio_chip gpio_chip;
89         const char *const *names;
90         int     chip_type;
91 };
92
93 static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
94 {
95         int ret = 0;
96
97         if (chip->gpio_chip.ngpio <= 8)
98                 ret = i2c_smbus_write_byte_data(chip->client, reg, val);
99         else {
100                 switch (chip->chip_type) {
101                 case PCA953X_TYPE:
102                         ret = i2c_smbus_write_word_data(chip->client,
103                                                         reg << 1, val);
104                         break;
105                 case PCA957X_TYPE:
106                         ret = i2c_smbus_write_byte_data(chip->client, reg << 1,
107                                                         val & 0xff);
108                         if (ret < 0)
109                                 break;
110                         ret = i2c_smbus_write_byte_data(chip->client,
111                                                         (reg << 1) + 1,
112                                                         (val & 0xff00) >> 8);
113                         break;
114                 }
115         }
116
117         if (ret < 0) {
118                 dev_err(&chip->client->dev, "failed writing register\n");
119                 return ret;
120         }
121
122         return 0;
123 }
124
125 static int pca953x_read_reg(struct pca953x_chip *chip, int reg, uint16_t *val)
126 {
127         int ret;
128
129         if (chip->gpio_chip.ngpio <= 8)
130                 ret = i2c_smbus_read_byte_data(chip->client, reg);
131         else
132                 ret = i2c_smbus_read_word_data(chip->client, reg << 1);
133
134         if (ret < 0) {
135                 dev_err(&chip->client->dev, "failed reading register\n");
136                 return ret;
137         }
138
139         *val = (uint16_t)ret;
140         return 0;
141 }
142
143 static int pca953x_gpio_direction_input(struct gpio_chip *gc, unsigned off)
144 {
145         struct pca953x_chip *chip;
146         uint16_t reg_val;
147         int ret, offset = 0;
148
149         chip = container_of(gc, struct pca953x_chip, gpio_chip);
150
151         mutex_lock(&chip->i2c_lock);
152         reg_val = chip->reg_direction | (1u << off);
153
154         switch (chip->chip_type) {
155         case PCA953X_TYPE:
156                 offset = PCA953X_DIRECTION;
157                 break;
158         case PCA957X_TYPE:
159                 offset = PCA957X_CFG;
160                 break;
161         }
162         ret = pca953x_write_reg(chip, offset, reg_val);
163         if (ret)
164                 goto exit;
165
166         chip->reg_direction = reg_val;
167         ret = 0;
168 exit:
169         mutex_unlock(&chip->i2c_lock);
170         return ret;
171 }
172
173 static int pca953x_gpio_direction_output(struct gpio_chip *gc,
174                 unsigned off, int val)
175 {
176         struct pca953x_chip *chip;
177         uint16_t reg_val;
178         int ret, offset = 0;
179
180         chip = container_of(gc, struct pca953x_chip, gpio_chip);
181
182         mutex_lock(&chip->i2c_lock);
183         /* set output level */
184         if (val)
185                 reg_val = chip->reg_output | (1u << off);
186         else
187                 reg_val = chip->reg_output & ~(1u << off);
188
189         switch (chip->chip_type) {
190         case PCA953X_TYPE:
191                 offset = PCA953X_OUTPUT;
192                 break;
193         case PCA957X_TYPE:
194                 offset = PCA957X_OUT;
195                 break;
196         }
197         ret = pca953x_write_reg(chip, offset, reg_val);
198         if (ret)
199                 goto exit;
200
201         chip->reg_output = reg_val;
202
203         /* then direction */
204         reg_val = chip->reg_direction & ~(1u << off);
205         switch (chip->chip_type) {
206         case PCA953X_TYPE:
207                 offset = PCA953X_DIRECTION;
208                 break;
209         case PCA957X_TYPE:
210                 offset = PCA957X_CFG;
211                 break;
212         }
213         ret = pca953x_write_reg(chip, offset, reg_val);
214         if (ret)
215                 goto exit;
216
217         chip->reg_direction = reg_val;
218         ret = 0;
219 exit:
220         mutex_unlock(&chip->i2c_lock);
221         return ret;
222 }
223
224 static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off)
225 {
226         struct pca953x_chip *chip;
227         uint16_t reg_val;
228         int ret, offset = 0;
229
230         chip = container_of(gc, struct pca953x_chip, gpio_chip);
231
232         mutex_lock(&chip->i2c_lock);
233         switch (chip->chip_type) {
234         case PCA953X_TYPE:
235                 offset = PCA953X_INPUT;
236                 break;
237         case PCA957X_TYPE:
238                 offset = PCA957X_IN;
239                 break;
240         }
241         ret = pca953x_read_reg(chip, offset, &reg_val);
242         mutex_unlock(&chip->i2c_lock);
243         if (ret < 0) {
244                 /* NOTE:  diagnostic already emitted; that's all we should
245                  * do unless gpio_*_value_cansleep() calls become different
246                  * from their nonsleeping siblings (and report faults).
247                  */
248                 return 0;
249         }
250
251         return (reg_val & (1u << off)) ? 1 : 0;
252 }
253
254 static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val)
255 {
256         struct pca953x_chip *chip;
257         uint16_t reg_val;
258         int ret, offset = 0;
259
260         chip = container_of(gc, struct pca953x_chip, gpio_chip);
261
262         mutex_lock(&chip->i2c_lock);
263         if (val)
264                 reg_val = chip->reg_output | (1u << off);
265         else
266                 reg_val = chip->reg_output & ~(1u << off);
267
268         switch (chip->chip_type) {
269         case PCA953X_TYPE:
270                 offset = PCA953X_OUTPUT;
271                 break;
272         case PCA957X_TYPE:
273                 offset = PCA957X_OUT;
274                 break;
275         }
276         ret = pca953x_write_reg(chip, offset, reg_val);
277         if (ret)
278                 goto exit;
279
280         chip->reg_output = reg_val;
281 exit:
282         mutex_unlock(&chip->i2c_lock);
283 }
284
285 static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
286 {
287         struct gpio_chip *gc;
288
289         gc = &chip->gpio_chip;
290
291         gc->direction_input  = pca953x_gpio_direction_input;
292         gc->direction_output = pca953x_gpio_direction_output;
293         gc->get = pca953x_gpio_get_value;
294         gc->set = pca953x_gpio_set_value;
295         gc->can_sleep = 1;
296
297         gc->base = chip->gpio_start;
298         gc->ngpio = gpios;
299         gc->label = chip->client->name;
300         gc->dev = &chip->client->dev;
301         gc->owner = THIS_MODULE;
302         gc->names = chip->names;
303 }
304
305 #ifdef CONFIG_GPIO_PCA953X_IRQ
306 static int pca953x_gpio_to_irq(struct gpio_chip *gc, unsigned off)
307 {
308         struct pca953x_chip *chip;
309
310         chip = container_of(gc, struct pca953x_chip, gpio_chip);
311         return chip->irq_base + off;
312 }
313
314 static void pca953x_irq_mask(struct irq_data *d)
315 {
316         struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
317
318         chip->irq_mask &= ~(1 << (d->irq - chip->irq_base));
319 }
320
321 static void pca953x_irq_unmask(struct irq_data *d)
322 {
323         struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
324
325         chip->irq_mask |= 1 << (d->irq - chip->irq_base);
326 }
327
328 static void pca953x_irq_bus_lock(struct irq_data *d)
329 {
330         struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
331
332         mutex_lock(&chip->irq_lock);
333 }
334
335 static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
336 {
337         struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
338         uint16_t new_irqs;
339         uint16_t level;
340
341         /* Look for any newly setup interrupt */
342         new_irqs = chip->irq_trig_fall | chip->irq_trig_raise;
343         new_irqs &= ~chip->reg_direction;
344
345         while (new_irqs) {
346                 level = __ffs(new_irqs);
347                 pca953x_gpio_direction_input(&chip->gpio_chip, level);
348                 new_irqs &= ~(1 << level);
349         }
350
351         mutex_unlock(&chip->irq_lock);
352 }
353
354 static int pca953x_irq_set_type(struct irq_data *d, unsigned int type)
355 {
356         struct pca953x_chip *chip = irq_data_get_irq_chip_data(d);
357         uint16_t level = d->irq - chip->irq_base;
358         uint16_t mask = 1 << level;
359
360         if (!(type & IRQ_TYPE_EDGE_BOTH)) {
361                 dev_err(&chip->client->dev, "irq %d: unsupported type %d\n",
362                         d->irq, type);
363                 return -EINVAL;
364         }
365
366         if (type & IRQ_TYPE_EDGE_FALLING)
367                 chip->irq_trig_fall |= mask;
368         else
369                 chip->irq_trig_fall &= ~mask;
370
371         if (type & IRQ_TYPE_EDGE_RISING)
372                 chip->irq_trig_raise |= mask;
373         else
374                 chip->irq_trig_raise &= ~mask;
375
376         return 0;
377 }
378
379 static struct irq_chip pca953x_irq_chip = {
380         .name                   = "pca953x",
381         .irq_mask               = pca953x_irq_mask,
382         .irq_unmask             = pca953x_irq_unmask,
383         .irq_bus_lock           = pca953x_irq_bus_lock,
384         .irq_bus_sync_unlock    = pca953x_irq_bus_sync_unlock,
385         .irq_set_type           = pca953x_irq_set_type,
386 };
387
388 static uint16_t pca953x_irq_pending(struct pca953x_chip *chip)
389 {
390         uint16_t cur_stat;
391         uint16_t old_stat;
392         uint16_t pending;
393         uint16_t trigger;
394         int ret, offset = 0;
395
396         switch (chip->chip_type) {
397         case PCA953X_TYPE:
398                 offset = PCA953X_INPUT;
399                 break;
400         case PCA957X_TYPE:
401                 offset = PCA957X_IN;
402                 break;
403         }
404         ret = pca953x_read_reg(chip, offset, &cur_stat);
405         if (ret)
406                 return 0;
407
408         /* Remove output pins from the equation */
409         cur_stat &= chip->reg_direction;
410
411         old_stat = chip->irq_stat;
412         trigger = (cur_stat ^ old_stat) & chip->irq_mask;
413
414         if (!trigger)
415                 return 0;
416
417         chip->irq_stat = cur_stat;
418
419         pending = (old_stat & chip->irq_trig_fall) |
420                   (cur_stat & chip->irq_trig_raise);
421         pending &= trigger;
422
423         return pending;
424 }
425
426 static irqreturn_t pca953x_irq_handler(int irq, void *devid)
427 {
428         struct pca953x_chip *chip = devid;
429         uint16_t pending;
430         uint16_t level;
431
432         pending = pca953x_irq_pending(chip);
433
434         if (!pending)
435                 return IRQ_HANDLED;
436
437         do {
438                 level = __ffs(pending);
439                 handle_nested_irq(level + chip->irq_base);
440
441                 pending &= ~(1 << level);
442         } while (pending);
443
444         return IRQ_HANDLED;
445 }
446
447 static int pca953x_irq_setup(struct pca953x_chip *chip,
448                              const struct i2c_device_id *id,
449                              int irq_base)
450 {
451         struct i2c_client *client = chip->client;
452         int ret, offset = 0;
453
454         if (irq_base != -1
455                         && (id->driver_data & PCA_INT)) {
456                 int lvl;
457
458                 switch (chip->chip_type) {
459                 case PCA953X_TYPE:
460                         offset = PCA953X_INPUT;
461                         break;
462                 case PCA957X_TYPE:
463                         offset = PCA957X_IN;
464                         break;
465                 }
466                 ret = pca953x_read_reg(chip, offset, &chip->irq_stat);
467                 if (ret)
468                         goto out_failed;
469
470                 /*
471                  * There is no way to know which GPIO line generated the
472                  * interrupt.  We have to rely on the previous read for
473                  * this purpose.
474                  */
475                 chip->irq_stat &= chip->reg_direction;
476                 mutex_init(&chip->irq_lock);
477
478                 chip->irq_base = irq_alloc_descs(-1, irq_base, chip->gpio_chip.ngpio, -1);
479                 if (chip->irq_base < 0)
480                         goto out_failed;
481
482                 for (lvl = 0; lvl < chip->gpio_chip.ngpio; lvl++) {
483                         int irq = lvl + chip->irq_base;
484
485                         irq_clear_status_flags(irq, IRQ_NOREQUEST);
486                         irq_set_chip_data(irq, chip);
487                         irq_set_chip(irq, &pca953x_irq_chip);
488                         irq_set_nested_thread(irq, true);
489 #ifdef CONFIG_ARM
490                         set_irq_flags(irq, IRQF_VALID);
491 #else
492                         irq_set_noprobe(irq);
493 #endif
494                 }
495
496                 ret = request_threaded_irq(client->irq,
497                                            NULL,
498                                            pca953x_irq_handler,
499                                            IRQF_TRIGGER_LOW | IRQF_ONESHOT,
500                                            dev_name(&client->dev), chip);
501                 if (ret) {
502                         dev_err(&client->dev, "failed to request irq %d\n",
503                                 client->irq);
504                         goto out_failed;
505                 }
506
507                 chip->gpio_chip.to_irq = pca953x_gpio_to_irq;
508         }
509
510         return 0;
511
512 out_failed:
513         chip->irq_base = -1;
514         return ret;
515 }
516
517 static void pca953x_irq_teardown(struct pca953x_chip *chip)
518 {
519         if (chip->irq_base != -1) {
520                 irq_free_descs(chip->irq_base, chip->gpio_chip.ngpio);
521                 free_irq(chip->client->irq, chip);
522         }
523 }
524 #else /* CONFIG_GPIO_PCA953X_IRQ */
525 static int pca953x_irq_setup(struct pca953x_chip *chip,
526                              const struct i2c_device_id *id,
527                              int irq_base)
528 {
529         struct i2c_client *client = chip->client;
530
531         if (irq_base != -1 && (id->driver_data & PCA_INT))
532                 dev_warn(&client->dev, "interrupt support not compiled in\n");
533
534         return 0;
535 }
536
537 static void pca953x_irq_teardown(struct pca953x_chip *chip)
538 {
539 }
540 #endif
541
542 /*
543  * Handlers for alternative sources of platform_data
544  */
545 #ifdef CONFIG_OF_GPIO
546 /*
547  * Translate OpenFirmware node properties into platform_data
548  */
549 void
550 pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
551 {
552         struct device_node *node;
553         const __be32 *val;
554         int size;
555
556         node = client->dev.of_node;
557         if (node == NULL)
558                 return;
559
560         *gpio_base = -1;
561         val = of_get_property(node, "linux,gpio-base", &size);
562         if (val) {
563                 if (size != sizeof(*val))
564                         dev_warn(&client->dev, "%s: wrong linux,gpio-base\n",
565                                  node->full_name);
566                 else
567                         *gpio_base = be32_to_cpup(val);
568         }
569
570         val = of_get_property(node, "polarity", NULL);
571         if (val)
572                 *invert = *val;
573 }
574 #else
575 void
576 pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, int *invert)
577 {
578 }
579 #endif
580
581 static int __devinit device_pca953x_init(struct pca953x_chip *chip, int invert)
582 {
583         int ret;
584
585         ret = pca953x_read_reg(chip, PCA953X_OUTPUT, &chip->reg_output);
586         if (ret)
587                 goto out;
588
589         ret = pca953x_read_reg(chip, PCA953X_DIRECTION,
590                                &chip->reg_direction);
591         if (ret)
592                 goto out;
593
594         /* set platform specific polarity inversion */
595         ret = pca953x_write_reg(chip, PCA953X_INVERT, invert);
596         if (ret)
597                 goto out;
598         return 0;
599 out:
600         return ret;
601 }
602
603 static int __devinit device_pca957x_init(struct pca953x_chip *chip, int invert)
604 {
605         int ret;
606         uint16_t val = 0;
607
608         /* Let every port in proper state, that could save power */
609         pca953x_write_reg(chip, PCA957X_PUPD, 0x0);
610         pca953x_write_reg(chip, PCA957X_CFG, 0xffff);
611         pca953x_write_reg(chip, PCA957X_OUT, 0x0);
612
613         ret = pca953x_read_reg(chip, PCA957X_IN, &val);
614         if (ret)
615                 goto out;
616         ret = pca953x_read_reg(chip, PCA957X_OUT, &chip->reg_output);
617         if (ret)
618                 goto out;
619         ret = pca953x_read_reg(chip, PCA957X_CFG, &chip->reg_direction);
620         if (ret)
621                 goto out;
622
623         /* set platform specific polarity inversion */
624         pca953x_write_reg(chip, PCA957X_INVRT, invert);
625
626         /* To enable register 6, 7 to controll pull up and pull down */
627         pca953x_write_reg(chip, PCA957X_BKEN, 0x202);
628
629         return 0;
630 out:
631         return ret;
632 }
633
634 static int __devinit pca953x_probe(struct i2c_client *client,
635                                    const struct i2c_device_id *id)
636 {
637         struct pca953x_platform_data *pdata;
638         struct pca953x_chip *chip;
639         int irq_base=-1, invert=0;
640         int ret = 0;
641
642         chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
643         if (chip == NULL)
644                 return -ENOMEM;
645
646         pdata = client->dev.platform_data;
647         if (pdata) {
648                 irq_base = pdata->irq_base;
649                 chip->gpio_start = pdata->gpio_base;
650                 invert = pdata->invert;
651                 chip->names = pdata->names;
652         } else {
653                 pca953x_get_alt_pdata(client, &chip->gpio_start, &invert);
654         }
655
656         chip->client = client;
657
658         chip->chip_type = id->driver_data & (PCA953X_TYPE | PCA957X_TYPE);
659
660         mutex_init(&chip->i2c_lock);
661
662         /* initialize cached registers from their original values.
663          * we can't share this chip with another i2c master.
664          */
665         pca953x_setup_gpio(chip, id->driver_data & PCA_GPIO_MASK);
666
667         if (chip->chip_type == PCA953X_TYPE)
668                 device_pca953x_init(chip, invert);
669         else if (chip->chip_type == PCA957X_TYPE)
670                 device_pca957x_init(chip, invert);
671         else
672                 goto out_failed;
673
674         ret = pca953x_irq_setup(chip, id, irq_base);
675         if (ret)
676                 goto out_failed;
677
678         ret = gpiochip_add(&chip->gpio_chip);
679         if (ret)
680                 goto out_failed_irq;
681
682         if (pdata && pdata->setup) {
683                 ret = pdata->setup(client, chip->gpio_chip.base,
684                                 chip->gpio_chip.ngpio, pdata->context);
685                 if (ret < 0)
686                         dev_warn(&client->dev, "setup failed, %d\n", ret);
687         }
688
689         i2c_set_clientdata(client, chip);
690         return 0;
691
692 out_failed_irq:
693         pca953x_irq_teardown(chip);
694 out_failed:
695         kfree(chip);
696         return ret;
697 }
698
699 static int pca953x_remove(struct i2c_client *client)
700 {
701         struct pca953x_platform_data *pdata = client->dev.platform_data;
702         struct pca953x_chip *chip = i2c_get_clientdata(client);
703         int ret = 0;
704
705         if (pdata && pdata->teardown) {
706                 ret = pdata->teardown(client, chip->gpio_chip.base,
707                                 chip->gpio_chip.ngpio, pdata->context);
708                 if (ret < 0) {
709                         dev_err(&client->dev, "%s failed, %d\n",
710                                         "teardown", ret);
711                         return ret;
712                 }
713         }
714
715         ret = gpiochip_remove(&chip->gpio_chip);
716         if (ret) {
717                 dev_err(&client->dev, "%s failed, %d\n",
718                                 "gpiochip_remove()", ret);
719                 return ret;
720         }
721
722         pca953x_irq_teardown(chip);
723         kfree(chip);
724         return 0;
725 }
726
727 static struct i2c_driver pca953x_driver = {
728         .driver = {
729                 .name   = "pca953x",
730         },
731         .probe          = pca953x_probe,
732         .remove         = pca953x_remove,
733         .id_table       = pca953x_id,
734 };
735
736 static int __init pca953x_init(void)
737 {
738         return i2c_add_driver(&pca953x_driver);
739 }
740 /* register after i2c postcore initcall and before
741  * subsys initcalls that may rely on these GPIOs
742  */
743 subsys_initcall(pca953x_init);
744
745 static void __exit pca953x_exit(void)
746 {
747         i2c_del_driver(&pca953x_driver);
748 }
749 module_exit(pca953x_exit);
750
751 MODULE_AUTHOR("eric miao <eric.miao@marvell.com>");
752 MODULE_DESCRIPTION("GPIO expander driver for PCA953x");
753 MODULE_LICENSE("GPL");