]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
gpio: pca953x handles more chips, i2c fault codes
authorDavid Brownell <dbrownell@users.sourceforge.net>
Tue, 6 Jan 2009 22:42:27 +0000 (14:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:25 +0000 (15:59 -0800)
Minor updates to the pca953x GPIO expander driver: handle several more
compatible parts, and stop assuming that the I2C layer's return codes are
garbage (that's now been fixed).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpio/Kconfig
drivers/gpio/pca953x.c

index 48f49d93d249d8155fbdc1973310fab28319e6f3..3d2565441b3691786c373a2ef49922aa743de737 100644 (file)
@@ -95,7 +95,7 @@ config GPIO_MAX732X
          number for these GPIOs.
 
 config GPIO_PCA953X
-       tristate "PCA953x, PCA955x, and MAX7310 I/O ports"
+       tristate "PCA953x, PCA955x, TCA64xx, and MAX7310 I/O ports"
        depends on I2C
        help
          Say yes here to provide access to several register-oriented
@@ -104,9 +104,10 @@ config GPIO_PCA953X
 
          4 bits:       pca9536, pca9537
 
-         8 bits:       max7310, pca9534, pca9538, pca9554, pca9557
+         8 bits:       max7310, pca9534, pca9538, pca9554, pca9557,
+                       tca6408
 
-         16 bits:      pca9535, pca9539, pca9555
+         16 bits:      pca9535, pca9539, pca9555, tca6416
 
          This driver can also be built as a module.  If so, the module
          will be called pca953x.
index 9ceeb89f1325ea776bf47c1e89fbcb5b81b8eeec..37f35388a2aeb7094b559bfde1a851159e9ae59f 100644 (file)
@@ -33,7 +33,12 @@ static const struct i2c_device_id pca953x_id[] = {
        { "pca9554", 8, },
        { "pca9555", 16, },
        { "pca9557", 8, },
+
        { "max7310", 8, },
+       { "pca6107", 8, },
+       { "tca6408", 8, },
+       { "tca6416", 16, },
+       /* NYET:  { "tca6424", 24, }, */
        { }
 };
 MODULE_DEVICE_TABLE(i2c, pca953x_id);
@@ -47,9 +52,6 @@ struct pca953x_chip {
        struct gpio_chip gpio_chip;
 };
 
-/* NOTE:  we can't currently rely on fault codes to come from SMBus
- * calls, so we map all errors to EIO here and return zero otherwise.
- */
 static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
 {
        int ret;
@@ -61,7 +63,7 @@ static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
 
        if (ret < 0) {
                dev_err(&chip->client->dev, "failed writing register\n");
-               return -EIO;
+               return ret;
        }
 
        return 0;
@@ -78,7 +80,7 @@ static int pca953x_read_reg(struct pca953x_chip *chip, int reg, uint16_t *val)
 
        if (ret < 0) {
                dev_err(&chip->client->dev, "failed reading register\n");
-               return -EIO;
+               return ret;
        }
 
        *val = (uint16_t)ret;