diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-01-06 17:42:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:25 -0500 |
commit | ab5dc372021def8f40b34761babecad0bf868b1c (patch) | |
tree | 0ccc13782c79913e61d688f4f14522b249028d4a /drivers/gpio/pca953x.c | |
parent | cabb3fc4bd1628c37c37e054960eb3e4bf30dc26 (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/gpio/pca953x.c')
-rw-r--r-- | drivers/gpio/pca953x.c | 12 |
1 files changed, 7 insertions, 5 deletions
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 | }; |
39 | MODULE_DEVICE_TABLE(i2c, pca953x_id); | 44 | MODULE_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 | */ | ||
53 | static int pca953x_write_reg(struct pca953x_chip *chip, int reg, uint16_t val) | 55 | static 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; |