diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2017-12-20 13:17:49 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-12-31 00:09:39 +0100 |
commit | e53537653791b4aaa9ec88a9eb5fd187d44ff6ac (patch) | |
tree | a812a43d7b823d3e7ff33669ba2d67a848c0ff65 /drivers/i2c | |
parent | 7d42762d8cdff2974c3cfddeb480d467018f55fe (diff) | |
download | op-kernel-dev-e53537653791b4aaa9ec88a9eb5fd187d44ff6ac.zip op-kernel-dev-e53537653791b4aaa9ec88a9eb5fd187d44ff6ac.tar.gz |
i2c/ARM: davinci: Deep refactoring of I2C recovery
Alter the DaVinci GPIO recovery fetch to use descriptors
all the way down into the board files.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Sekhar Nori <nsekhar@ti.com>
Tested-by: Sekhar Nori <nsekhar@ti.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 2afb12a..cb24a3f 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -33,7 +33,7 @@ #include <linux/io.h> #include <linux/slab.h> #include <linux/cpufreq.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/of_device.h> #include <linux/platform_data/i2c-davinci.h> #include <linux/pm_runtime.h> @@ -869,19 +869,20 @@ static int davinci_i2c_probe(struct platform_device *pdev) if (dev->pdata->has_pfunc) adap->bus_recovery_info = &davinci_i2c_scl_recovery_info; - else if (dev->pdata->scl_pin) { + else if (dev->pdata->gpio_recovery) { rinfo = &davinci_i2c_gpio_recovery_info; adap->bus_recovery_info = rinfo; - r = gpio_request_one(dev->pdata->scl_pin, GPIOF_OPEN_DRAIN | - GPIOF_OUT_INIT_HIGH, "i2c-scl"); - if (r) + rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", + GPIOD_OUT_HIGH_OPEN_DRAIN); + if (IS_ERR(rinfo->scl_gpiod)) { + r = PTR_ERR(rinfo->scl_gpiod); goto err_unuse_clocks; - rinfo->scl_gpiod = gpio_to_desc(dev->pdata->scl_pin); - - r = gpio_request_one(dev->pdata->sda_pin, GPIOF_IN, "i2c-sda"); - if (r) + } + rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN); + if (IS_ERR(rinfo->sda_gpiod)) { + r = PTR_ERR(rinfo->sda_gpiod); goto err_unuse_clocks; - rinfo->sda_gpiod = gpio_to_desc(dev->pdata->scl_pin); + } } adap->nr = pdev->id; |