aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Brownell <dbrownell@users.sourceforge.net>2009-01-06 17:42:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:25 -0500
commitab5dc372021def8f40b34761babecad0bf868b1c (patch)
tree0ccc13782c79913e61d688f4f14522b249028d4a /drivers
parentcabb3fc4bd1628c37c37e054960eb3e4bf30dc26 (diff)
gpio: pca953x handles more chips, i2c fault codes
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpio/Kconfig7
-rw-r--r--drivers/gpio/pca953x.c12
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 48f49d93d249..3d2565441b36 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -95,7 +95,7 @@ config GPIO_MAX732X
95 number for these GPIOs. 95 number for these GPIOs.
96 96
97config GPIO_PCA953X 97config GPIO_PCA953X
98 tristate "PCA953x, PCA955x, and MAX7310 I/O ports" 98 tristate "PCA953x, PCA955x, TCA64xx, and MAX7310 I/O ports"
99 depends on I2C 99 depends on I2C
100 help 100 help
101 Say yes here to provide access to several register-oriented 101 Say yes here to provide access to several register-oriented
@@ -104,9 +104,10 @@ config GPIO_PCA953X
104 104
105 4 bits: pca9536, pca9537 105 4 bits: pca9536, pca9537
106 106
107 8 bits: max7310, pca9534, pca9538, pca9554, pca9557 107 8 bits: max7310, pca9534, pca9538, pca9554, pca9557,
108 tca6408
108 109
109 16 bits: pca9535, pca9539, pca9555 110 16 bits: pca9535, pca9539, pca9555, tca6416
110 111
111 This driver can also be built as a module. If so, the module 112 This driver can also be built as a module. If so, the module
112 will be called pca953x. 113 will be called pca953x.
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index 9ceeb89f1325..37f35388a2ae 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -33,7 +33,12 @@ static const struct i2c_device_id pca953x_id[] = {
33 { "pca9554", 8, }, 33 { "pca9554", 8, },
34 { "pca9555", 16, }, 34 { "pca9555", 16, },
35 { "pca9557", 8, }, 35 { "pca9557", 8, },
36
36 { "max7310", 8, }, 37 { "max7310", 8, },
38 { "pca6107", 8, },
39 { "tca6408", 8, },
40 { "tca6416", 16, },
41 /* NYET: { "tca6424", 24, }, */
37 { } 42 { }
38}; 43};
39MODULE_DEVICE_TABLE(i2c, pca953x_id); 44MODULE_DEVICE_TABLE(i2c, pca953x_id);
@@ -47,9 +52,6 @@ struct pca953x_chip {
47 struct gpio_chip gpio_chip; 52 struct gpio_chip gpio_chip;
48}; 53};
49 54
50/* NOTE: we can't currently rely on fault codes to come from SMBus
51 * calls, so we map all errors to EIO here and return zero otherwise.
52 */
53static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val) 55static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
54{ 56{
55 int ret; 57 int ret;
@@ -61,7 +63,7 @@ static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val)
61 63
62 if (ret < 0) { 64 if (ret < 0) {
63 dev_err(&chip->client->dev, "failed writing register\n"); 65 dev_err(&chip->client->dev, "failed writing register\n");
64 return -EIO; 66 return ret;
65 } 67 }
66 68
67 return 0; 69 return 0;
@@ -78,7 +80,7 @@ static int pca953x_read_reg(struct pca953x_chip *chip, int reg, uint16_t *val)
78 80
79 if (ret < 0) { 81 if (ret < 0) {
80 dev_err(&chip->client->dev, "failed reading register\n"); 82 dev_err(&chip->client->dev, "failed reading register\n");
81 return -EIO; 83 return ret;
82 } 84 }
83 85
84 *val = (uint16_t)ret; 86 *val = (uint16_t)ret;