diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2017-12-20 07:17:49 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-12-30 18:09:39 -0500 |
commit | e53537653791b4aaa9ec88a9eb5fd187d44ff6ac (patch) | |
tree | a812a43d7b823d3e7ff33669ba2d67a848c0ff65 /drivers/i2c | |
parent | 7d42762d8cdff2974c3cfddeb480d467018f55fe (diff) |
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 2afb12a89eb3..cb24a3ffdfa2 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/io.h> | 33 | #include <linux/io.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/cpufreq.h> | 35 | #include <linux/cpufreq.h> |
36 | #include <linux/gpio.h> | 36 | #include <linux/gpio/consumer.h> |
37 | #include <linux/of_device.h> | 37 | #include <linux/of_device.h> |
38 | #include <linux/platform_data/i2c-davinci.h> | 38 | #include <linux/platform_data/i2c-davinci.h> |
39 | #include <linux/pm_runtime.h> | 39 | #include <linux/pm_runtime.h> |
@@ -869,19 +869,20 @@ static int davinci_i2c_probe(struct platform_device *pdev) | |||
869 | 869 | ||
870 | if (dev->pdata->has_pfunc) | 870 | if (dev->pdata->has_pfunc) |
871 | adap->bus_recovery_info = &davinci_i2c_scl_recovery_info; | 871 | adap->bus_recovery_info = &davinci_i2c_scl_recovery_info; |
872 | else if (dev->pdata->scl_pin) { | 872 | else if (dev->pdata->gpio_recovery) { |
873 | rinfo = &davinci_i2c_gpio_recovery_info; | 873 | rinfo = &davinci_i2c_gpio_recovery_info; |
874 | adap->bus_recovery_info = rinfo; | 874 | adap->bus_recovery_info = rinfo; |
875 | r = gpio_request_one(dev->pdata->scl_pin, GPIOF_OPEN_DRAIN | | 875 | rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", |
876 | GPIOF_OUT_INIT_HIGH, "i2c-scl"); | 876 | GPIOD_OUT_HIGH_OPEN_DRAIN); |
877 | if (r) | 877 | if (IS_ERR(rinfo->scl_gpiod)) { |
878 | r = PTR_ERR(rinfo->scl_gpiod); | ||
878 | goto err_unuse_clocks; | 879 | goto err_unuse_clocks; |
879 | rinfo->scl_gpiod = gpio_to_desc(dev->pdata->scl_pin); | 880 | } |
880 | 881 | rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN); | |
881 | r = gpio_request_one(dev->pdata->sda_pin, GPIOF_IN, "i2c-sda"); | 882 | if (IS_ERR(rinfo->sda_gpiod)) { |
882 | if (r) | 883 | r = PTR_ERR(rinfo->sda_gpiod); |
883 | goto err_unuse_clocks; | 884 | goto err_unuse_clocks; |
884 | rinfo->sda_gpiod = gpio_to_desc(dev->pdata->scl_pin); | 885 | } |
885 | } | 886 | } |
886 | 887 | ||
887 | adap->nr = pdev->id; | 888 | adap->nr = pdev->id; |