aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/pcf857x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpio/pcf857x.c')
-rw-r--r--drivers/gpio/pcf857x.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/drivers/gpio/pcf857x.c b/drivers/gpio/pcf857x.c
index 8856870dd738..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
29static 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};
42MODULE_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
@@ -173,13 +188,8 @@ static int pcf857x_probe(struct i2c_client *client,
173 * 188 *
174 * NOTE: we don't distinguish here between *4 and *4a parts. 189 * NOTE: we don't distinguish here between *4 and *4a parts.
175 */ 190 */
176 if (strcmp(client->name, "pcf8574") == 0 191 gpio->chip.ngpio = id->driver_data;
177 || strcmp(client->name, "pca8574") == 0 192 if (gpio->chip.ngpio == 8) {
178 || strcmp(client->name, "pca9670") == 0
179 || strcmp(client->name, "pca9672") == 0
180 || strcmp(client->name, "pca9674") == 0
181 ) {
182 gpio->chip.ngpio = 8;
183 gpio->chip.direction_input = pcf857x_input8; 193 gpio->chip.direction_input = pcf857x_input8;
184 gpio->chip.get = pcf857x_get8; 194 gpio->chip.get = pcf857x_get8;
185 gpio->chip.direction_output = pcf857x_output8; 195 gpio->chip.direction_output = pcf857x_output8;
@@ -199,13 +209,7 @@ static int pcf857x_probe(struct i2c_client *client,
199 * 209 *
200 * NOTE: we don't distinguish here between '75 and '75c parts. 210 * NOTE: we don't distinguish here between '75 and '75c parts.
201 */ 211 */
202 } else if (strcmp(client->name, "pcf8575") == 0 212 } else if (gpio->chip.ngpio == 16) {
203 || strcmp(client->name, "pca8575") == 0
204 || strcmp(client->name, "pca9671") == 0
205 || strcmp(client->name, "pca9673") == 0
206 || strcmp(client->name, "pca9675") == 0
207 ) {
208 gpio->chip.ngpio = 16;
209 gpio->chip.direction_input = pcf857x_input16; 213 gpio->chip.direction_input = pcf857x_input16;
210 gpio->chip.get = pcf857x_get16; 214 gpio->chip.get = pcf857x_get16;
211 gpio->chip.direction_output = pcf857x_output16; 215 gpio->chip.direction_output = pcf857x_output16;
@@ -314,6 +318,7 @@ static struct i2c_driver pcf857x_driver = {
314 }, 318 },
315 .probe = pcf857x_probe, 319 .probe = pcf857x_probe,
316 .remove = pcf857x_remove, 320 .remove = pcf857x_remove,
321 .id_table = pcf857x_id,
317}; 322};
318 323
319static int __init pcf857x_init(void) 324static int __init pcf857x_init(void)