aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Reid2017-11-02 10:40:29 +0800
committerWolfram Sang2017-11-27 18:39:51 +0100
commitcd2428c368a66c4d61cd416a4f0ad453ce6d57cd (patch)
tree9b77df305bbc968eadca5b45e41d19fd63134ff3
parentad36a27959cabb27dfde35ff103d03b22f6ddb36 (diff)
i2c: davinci: switch to using gpiod for bus recovery gpios
Change the driver to use the gpio descriptors for the bus recovery information instead of the deprecated integer interface. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Phil Reid <preid@electromag.com.au> Reviewed-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-davinci.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
index 2ead9b9eebb7..2afb12a89eb3 100644
--- a/drivers/i2c/busses/i2c-davinci.c
+++ b/drivers/i2c/busses/i2c-davinci.c
@@ -294,7 +294,7 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev)
}
/*
- * This routine does i2c bus recovery by using i2c_generic_gpio_recovery
+ * This routine does i2c bus recovery by using i2c_generic_scl_recovery
* which is provided by I2C Bus recovery infrastructure.
*/
static void davinci_i2c_prepare_recovery(struct i2c_adapter *adap)
@@ -316,7 +316,7 @@ static void davinci_i2c_unprepare_recovery(struct i2c_adapter *adap)
}
static struct i2c_bus_recovery_info davinci_i2c_gpio_recovery_info = {
- .recover_bus = i2c_generic_gpio_recovery,
+ .recover_bus = i2c_generic_scl_recovery,
.prepare_recovery = davinci_i2c_prepare_recovery,
.unprepare_recovery = davinci_i2c_unprepare_recovery,
};
@@ -769,6 +769,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
struct davinci_i2c_dev *dev;
struct i2c_adapter *adap;
struct resource *mem;
+ struct i2c_bus_recovery_info *rinfo;
int r, irq;
irq = platform_get_irq(pdev, 0);
@@ -869,9 +870,18 @@ 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) {
- adap->bus_recovery_info = &davinci_i2c_gpio_recovery_info;
- adap->bus_recovery_info->scl_gpio = dev->pdata->scl_pin;
- adap->bus_recovery_info->sda_gpio = dev->pdata->sda_pin;
+ 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)
+ 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)
+ goto err_unuse_clocks;
+ rinfo->sda_gpiod = gpio_to_desc(dev->pdata->scl_pin);
}
adap->nr = pdev->id;