aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-s3c2410.c
diff options
context:
space:
mode:
authorAbhilash Kesavan <a.kesavan@samsung.com>2012-11-19 05:17:17 -0500
committerWolfram Sang <w.sang@pengutronix.de>2012-11-19 05:54:55 -0500
commit658122fe5e3a72940631ceda3efcb841054d91dc (patch)
tree629d39121fa1babca9e4fbe585734c8d096cc7b6 /drivers/i2c/busses/i2c-s3c2410.c
parent3b2f3ceb3c7f4a8c2d11aa7652842e5ce1b0dcc3 (diff)
i2c: s3c2410: Add fix for i2c suspend/resume
The I2C driver makes a gpio_request during initialization. This request happens again on resume and fails due to the earlier successful request. Re-factor the code to only initialize the gpios during probe. Errors on resume without this: [ 16.020000] s3c-i2c s3c2440-i2c.0: gpio [42] request failed [ 16.020000] s3c-i2c s3c2440-i2c.1: gpio [44] request failed [ 16.020000] s3c-i2c s3c2440-i2c.2: gpio [6] request failed Signed-off-by: Abhilash Kesavan <a.kesavan@samsung.com> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-s3c2410.c')
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 16592e5ab08a..d784c76ae3e8 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -908,13 +908,6 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
908 908
909 pdata = i2c->pdata; 909 pdata = i2c->pdata;
910 910
911 /* inititalise the gpio */
912
913 if (pdata->cfg_gpio)
914 pdata->cfg_gpio(to_platform_device(i2c->dev));
915 else if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c))
916 return -EINVAL;
917
918 /* write slave address */ 911 /* write slave address */
919 912
920 writeb(pdata->slave_addr, i2c->regs + S3C2410_IICADD); 913 writeb(pdata->slave_addr, i2c->regs + S3C2410_IICADD);
@@ -1055,6 +1048,15 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
1055 1048
1056 i2c->pctrl = devm_pinctrl_get_select_default(i2c->dev); 1049 i2c->pctrl = devm_pinctrl_get_select_default(i2c->dev);
1057 1050
1051 /* inititalise the i2c gpio lines */
1052
1053 if (i2c->pdata->cfg_gpio) {
1054 i2c->pdata->cfg_gpio(to_platform_device(i2c->dev));
1055 } else if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c)) {
1056 ret = -EINVAL;
1057 goto err_clk;
1058 }
1059
1058 /* initialise the i2c controller */ 1060 /* initialise the i2c controller */
1059 1061
1060 ret = s3c24xx_i2c_init(i2c); 1062 ret = s3c24xx_i2c_init(i2c);