]> Pileus Git - ~andy/linux/blobdiff - drivers/gpio/max732x.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg...
[~andy/linux] / drivers / gpio / max732x.c
index 2053ba9cbfaeb3d8aba22da013c3d41790ee292e..9cad60f9e9620f249bf1c01f38346455476405bb 100644 (file)
@@ -232,6 +232,13 @@ static int max732x_gpio_direction_input(struct gpio_chip *gc, unsigned off)
                return -EACCES;
        }
 
+       /*
+        * Open-drain pins must be set to high impedance (which is
+        * equivalent to output-high) to be turned into an input.
+        */
+       if ((mask & chip->dir_output))
+               max732x_gpio_set_value(gc, off, 1);
+
        return 0;
 }
 
@@ -595,14 +602,14 @@ static int __devinit max732x_probe(struct i2c_client *client,
        switch (client->addr & 0x70) {
        case 0x60:
                chip->client_group_a = client;
-               if (nr_port > 7) {
+               if (nr_port > 8) {
                        c = i2c_new_dummy(client->adapter, addr_b);
                        chip->client_group_b = chip->client_dummy = c;
                }
                break;
        case 0x50:
                chip->client_group_b = client;
-               if (nr_port > 7) {
+               if (nr_port > 8) {
                        c = i2c_new_dummy(client->adapter, addr_a);
                        chip->client_group_a = chip->client_dummy = c;
                }
@@ -617,7 +624,7 @@ static int __devinit max732x_probe(struct i2c_client *client,
        mutex_init(&chip->lock);
 
        max732x_readb(chip, is_group_a(chip, 0), &chip->reg_out[0]);
-       if (nr_port > 7)
+       if (nr_port > 8)
                max732x_readb(chip, is_group_a(chip, 8), &chip->reg_out[1]);
 
        ret = max732x_irq_setup(chip, id);