aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2014-07-29 03:24:43 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-08-28 08:19:40 -0400
commit4bb93349d9d001f565aafe2a1890cbb6e4476b58 (patch)
treecbe162da07ce25393e7333edf58b58eb80321217 /drivers/gpio
parent52addcf9d6669fa439387610bc65c92fa0980cef (diff)
gpio: pca953x: Drop deprecated DT bindings
Drop deprecated DT bindings and use automaticly assigned gpio and irq bases. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-pca953x.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index f9961eea2120..e2da64abbccd 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -520,7 +520,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
520 struct i2c_client *client = chip->client; 520 struct i2c_client *client = chip->client;
521 int ret, i, offset = 0; 521 int ret, i, offset = 0;
522 522
523 if (irq_base != -1 523 if (client->irq && irq_base != -1
524 && (id->driver_data & PCA_INT)) { 524 && (id->driver_data & PCA_INT)) {
525 525
526 switch (chip->chip_type) { 526 switch (chip->chip_type) {
@@ -586,50 +586,6 @@ static int pca953x_irq_setup(struct pca953x_chip *chip,
586} 586}
587#endif 587#endif
588 588
589/*
590 * Handlers for alternative sources of platform_data
591 */
592#ifdef CONFIG_OF_GPIO
593/*
594 * Translate OpenFirmware node properties into platform_data
595 * WARNING: This is DEPRECATED and will be removed eventually!
596 */
597static void
598pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
599{
600 struct device_node *node;
601 const __be32 *val;
602 int size;
603
604 *gpio_base = -1;
605
606 node = client->dev.of_node;
607 if (node == NULL)
608 return;
609
610 val = of_get_property(node, "linux,gpio-base", &size);
611 WARN(val, "%s: device-tree property 'linux,gpio-base' is deprecated!", __func__);
612 if (val) {
613 if (size != sizeof(*val))
614 dev_warn(&client->dev, "%s: wrong linux,gpio-base\n",
615 node->full_name);
616 else
617 *gpio_base = be32_to_cpup(val);
618 }
619
620 val = of_get_property(node, "polarity", NULL);
621 WARN(val, "%s: device-tree property 'polarity' is deprecated!", __func__);
622 if (val)
623 *invert = *val;
624}
625#else
626static void
627pca953x_get_alt_pdata(struct i2c_client *client, int *gpio_base, u32 *invert)
628{
629 *gpio_base = -1;
630}
631#endif
632
633static int device_pca953x_init(struct pca953x_chip *chip, u32 invert) 589static int device_pca953x_init(struct pca953x_chip *chip, u32 invert)
634{ 590{
635 int ret; 591 int ret;
@@ -704,12 +660,8 @@ static int pca953x_probe(struct i2c_client *client,
704 invert = pdata->invert; 660 invert = pdata->invert;
705 chip->names = pdata->names; 661 chip->names = pdata->names;
706 } else { 662 } else {
707 pca953x_get_alt_pdata(client, &chip->gpio_start, &invert); 663 chip->gpio_start = -1;
708#ifdef CONFIG_OF_GPIO 664 irq_base = 0;
709 /* If I2C node has no interrupts property, disable GPIO interrupts */
710 if (of_find_property(client->dev.of_node, "interrupts", NULL) == NULL)
711 irq_base = -1;
712#endif
713 } 665 }
714 666
715 chip->client = client; 667 chip->client = client;