diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 17:48:31 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 17:48:31 -0400 |
commit | b57ab7632b8fc1eef139bbbb7a89002be61f99e1 (patch) | |
tree | 19d4eeea0dbf721312c4e33a423ed29ff70aff88 /drivers/gpio/pcf857x.c | |
parent | f12c03722045882a50c270f6332cf2c7b16a83d2 (diff) | |
parent | 3760f736716f74bdc62a4ba5406934338da93eb2 (diff) |
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
i2c: Convert most new-style drivers to use module aliasing
i2c: Add support for device alias names
i2c-amd756-s4882: Fix an error path
i2c: Drop unused RTC driver IDs
i2c/tps65010: Add missing intialization of client data
i2c-sis5595: Minor cleanups in sis5595_access
i2c-piix4: Minor cleanups
i2c: Spelling fix (successful)
i2c-stub: No newline in parameter description
Diffstat (limited to 'drivers/gpio/pcf857x.c')
-rw-r--r-- | drivers/gpio/pcf857x.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c index 1106aa15ac79..aa6cc8b2a2bc 100644 --- a/drivers/gpio/pcf857x.c +++ b/drivers/gpio/pcf857x.c | |||
@@ -26,6 +26,21 @@ | |||
26 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
27 | 27 | ||
28 | 28 | ||
29 | static const struct i2c_device_id pcf857x_id[] = { | ||
30 | { "pcf8574", 8 }, | ||
31 | { "pca8574", 8 }, | ||
32 | { "pca9670", 8 }, | ||
33 | { "pca9672", 8 }, | ||
34 | { "pca9674", 8 }, | ||
35 | { "pcf8575", 16 }, | ||
36 | { "pca8575", 16 }, | ||
37 | { "pca9671", 16 }, | ||
38 | { "pca9673", 16 }, | ||
39 | { "pca9675", 16 }, | ||
40 | { } | ||
41 | }; | ||
42 | MODULE_DEVICE_TABLE(i2c, pcf857x_id); | ||
43 | |||
29 | /* | 44 | /* |
30 | * The pcf857x, pca857x, and pca967x chips only expose one read and one | 45 | * The pcf857x, pca857x, and pca967x chips only expose one read and one |
31 | * write register. Writing a "one" bit (to match the reset state) lets | 46 | * write register. Writing a "one" bit (to match the reset state) lets |
@@ -142,7 +157,8 @@ static void pcf857x_set16(struct gpio_chip *chip, unsigned offset, int value) | |||
142 | 157 | ||
143 | /*-------------------------------------------------------------------------*/ | 158 | /*-------------------------------------------------------------------------*/ |
144 | 159 | ||
145 | static int pcf857x_probe(struct i2c_client *client) | 160 | static int pcf857x_probe(struct i2c_client *client, |
161 | const struct i2c_device_id *id) | ||
146 | { | 162 | { |
147 | struct pcf857x_platform_data *pdata; | 163 | struct pcf857x_platform_data *pdata; |
148 | struct pcf857x *gpio; | 164 | struct pcf857x *gpio; |
@@ -172,13 +188,8 @@ static int pcf857x_probe(struct i2c_client *client) | |||
172 | * | 188 | * |
173 | * NOTE: we don't distinguish here between *4 and *4a parts. | 189 | * NOTE: we don't distinguish here between *4 and *4a parts. |
174 | */ | 190 | */ |
175 | if (strcmp(client->name, "pcf8574") == 0 | 191 | gpio->chip.ngpio = id->driver_data; |
176 | || strcmp(client->name, "pca8574") == 0 | 192 | if (gpio->chip.ngpio == 8) { |
177 | || strcmp(client->name, "pca9670") == 0 | ||
178 | || strcmp(client->name, "pca9672") == 0 | ||
179 | || strcmp(client->name, "pca9674") == 0 | ||
180 | ) { | ||
181 | gpio->chip.ngpio = 8; | ||
182 | gpio->chip.direction_input = pcf857x_input8; | 193 | gpio->chip.direction_input = pcf857x_input8; |
183 | gpio->chip.get = pcf857x_get8; | 194 | gpio->chip.get = pcf857x_get8; |
184 | gpio->chip.direction_output = pcf857x_output8; | 195 | gpio->chip.direction_output = pcf857x_output8; |
@@ -198,13 +209,7 @@ static int pcf857x_probe(struct i2c_client *client) | |||
198 | * | 209 | * |
199 | * NOTE: we don't distinguish here between '75 and '75c parts. | 210 | * NOTE: we don't distinguish here between '75 and '75c parts. |
200 | */ | 211 | */ |
201 | } else if (strcmp(client->name, "pcf8575") == 0 | 212 | } else if (gpio->chip.ngpio == 16) { |
202 | || strcmp(client->name, "pca8575") == 0 | ||
203 | || strcmp(client->name, "pca9671") == 0 | ||
204 | || strcmp(client->name, "pca9673") == 0 | ||
205 | || strcmp(client->name, "pca9675") == 0 | ||
206 | ) { | ||
207 | gpio->chip.ngpio = 16; | ||
208 | gpio->chip.direction_input = pcf857x_input16; | 213 | gpio->chip.direction_input = pcf857x_input16; |
209 | gpio->chip.get = pcf857x_get16; | 214 | gpio->chip.get = pcf857x_get16; |
210 | gpio->chip.direction_output = pcf857x_output16; | 215 | gpio->chip.direction_output = pcf857x_output16; |
@@ -313,6 +318,7 @@ static struct i2c_driver pcf857x_driver = { | |||
313 | }, | 318 | }, |
314 | .probe = pcf857x_probe, | 319 | .probe = pcf857x_probe, |
315 | .remove = pcf857x_remove, | 320 | .remove = pcf857x_remove, |
321 | .id_table = pcf857x_id, | ||
316 | }; | 322 | }; |
317 | 323 | ||
318 | static int __init pcf857x_init(void) | 324 | static int __init pcf857x_init(void) |