diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2014-06-03 07:15:26 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-06-03 08:24:20 -0400 |
commit | 4807e8459bce425973c6c6a4f3bb2bb9b7aa0a36 (patch) | |
tree | 375ac15e46074ac2e8b45d12b7bd2556be6e9be4 /drivers/i2c | |
parent | d49019a0696b0a234d304a7b3e1e545e850f4691 (diff) |
i2c: mux: pca954x: Use the descriptor-based GPIO API
The ID-based GPIO API pushes handling of GPIO polarity to drivers.
Simplify the driver by switching to the descriptor-based GPIO API.
This also fixes a mismatch between the pca954x DT bindings that document
a "reset-gpios" property and the driver that requests a "reset-gpio"
property.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/muxes/i2c-mux-pca954x.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c index 550bd36aa5d6..c2c443f66407 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c | |||
@@ -186,7 +186,7 @@ static int pca954x_probe(struct i2c_client *client, | |||
186 | { | 186 | { |
187 | struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); | 187 | struct i2c_adapter *adap = to_i2c_adapter(client->dev.parent); |
188 | struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); | 188 | struct pca954x_platform_data *pdata = dev_get_platdata(&client->dev); |
189 | struct device_node *np = client->dev.of_node; | 189 | struct gpio_desc *gpio; |
190 | int num, force, class; | 190 | int num, force, class; |
191 | struct pca954x *data; | 191 | struct pca954x *data; |
192 | int ret; | 192 | int ret; |
@@ -200,21 +200,10 @@ static int pca954x_probe(struct i2c_client *client, | |||
200 | 200 | ||
201 | i2c_set_clientdata(client, data); | 201 | i2c_set_clientdata(client, data); |
202 | 202 | ||
203 | if (IS_ENABLED(CONFIG_OF) && np) { | 203 | /* Get the mux out of reset if a reset GPIO is specified. */ |
204 | enum of_gpio_flags flags; | 204 | gpio = devm_gpiod_get(&client->dev, "reset"); |
205 | int gpio; | 205 | if (!IS_ERR(gpio)) |
206 | 206 | gpiod_direction_output(gpio, 0); | |
207 | /* Get the mux out of reset if a reset GPIO is specified. */ | ||
208 | gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags); | ||
209 | if (gpio_is_valid(gpio)) { | ||
210 | ret = devm_gpio_request_one(&client->dev, gpio, | ||
211 | flags & OF_GPIO_ACTIVE_LOW ? | ||
212 | GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW, | ||
213 | "pca954x reset"); | ||
214 | if (ret < 0) | ||
215 | return ret; | ||
216 | } | ||
217 | } | ||
218 | 207 | ||
219 | /* Write the mux register at addr to verify | 208 | /* Write the mux register at addr to verify |
220 | * that the mux is in fact present. This also | 209 | * that the mux is in fact present. This also |