]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
i2c: pca954x: Defer probing due to reset GPIO
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tue, 14 Apr 2015 18:31:52 +0000 (11:31 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 16 Apr 2015 07:44:34 +0000 (09:44 +0200)
If a reset GPIO is specified but not available we must defer probing, as
the device could be held in reset. Use devm_gpiod_request_optional() to
handle this automatically.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/i2c/muxes/i2c-mux-pca954x.c

index ec11b404b433737657957ef9dd0e559a955b45aa..0042cf3d77db67e31b8b1cb6e469f610dd059f99 100644 (file)
@@ -201,9 +201,9 @@ static int pca954x_probe(struct i2c_client *client,
        i2c_set_clientdata(client, data);
 
        /* Get the mux out of reset if a reset GPIO is specified. */
-       gpio = devm_gpiod_get(&client->dev, "reset");
-       if (!IS_ERR(gpio))
-               gpiod_direction_output(gpio, 0);
+       gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
+       if (IS_ERR(gpio))
+               return PTR_ERR(gpio);
 
        /* Write the mux register at addr to verify
         * that the mux is in fact present. This also