diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-s3c2410.c')
-rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index bff20a589621..958c8db4ec30 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -785,14 +785,16 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, | |||
785 | int ret; | 785 | int ret; |
786 | 786 | ||
787 | pm_runtime_get_sync(&adap->dev); | 787 | pm_runtime_get_sync(&adap->dev); |
788 | clk_prepare_enable(i2c->clk); | 788 | ret = clk_enable(i2c->clk); |
789 | if (ret) | ||
790 | return ret; | ||
789 | 791 | ||
790 | for (retry = 0; retry < adap->retries; retry++) { | 792 | for (retry = 0; retry < adap->retries; retry++) { |
791 | 793 | ||
792 | ret = s3c24xx_i2c_doxfer(i2c, msgs, num); | 794 | ret = s3c24xx_i2c_doxfer(i2c, msgs, num); |
793 | 795 | ||
794 | if (ret != -EAGAIN) { | 796 | if (ret != -EAGAIN) { |
795 | clk_disable_unprepare(i2c->clk); | 797 | clk_disable(i2c->clk); |
796 | pm_runtime_put(&adap->dev); | 798 | pm_runtime_put(&adap->dev); |
797 | return ret; | 799 | return ret; |
798 | } | 800 | } |
@@ -802,7 +804,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, | |||
802 | udelay(100); | 804 | udelay(100); |
803 | } | 805 | } |
804 | 806 | ||
805 | clk_disable_unprepare(i2c->clk); | 807 | clk_disable(i2c->clk); |
806 | pm_runtime_put(&adap->dev); | 808 | pm_runtime_put(&adap->dev); |
807 | return -EREMOTEIO; | 809 | return -EREMOTEIO; |
808 | } | 810 | } |
@@ -1197,7 +1199,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1197 | 1199 | ||
1198 | clk_prepare_enable(i2c->clk); | 1200 | clk_prepare_enable(i2c->clk); |
1199 | ret = s3c24xx_i2c_init(i2c); | 1201 | ret = s3c24xx_i2c_init(i2c); |
1200 | clk_disable_unprepare(i2c->clk); | 1202 | clk_disable(i2c->clk); |
1201 | if (ret != 0) { | 1203 | if (ret != 0) { |
1202 | dev_err(&pdev->dev, "I2C controller init failed\n"); | 1204 | dev_err(&pdev->dev, "I2C controller init failed\n"); |
1203 | return ret; | 1205 | return ret; |
@@ -1210,6 +1212,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1210 | i2c->irq = ret = platform_get_irq(pdev, 0); | 1212 | i2c->irq = ret = platform_get_irq(pdev, 0); |
1211 | if (ret <= 0) { | 1213 | if (ret <= 0) { |
1212 | dev_err(&pdev->dev, "cannot find IRQ\n"); | 1214 | dev_err(&pdev->dev, "cannot find IRQ\n"); |
1215 | clk_unprepare(i2c->clk); | ||
1213 | return ret; | 1216 | return ret; |
1214 | } | 1217 | } |
1215 | 1218 | ||
@@ -1218,6 +1221,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1218 | 1221 | ||
1219 | if (ret != 0) { | 1222 | if (ret != 0) { |
1220 | dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq); | 1223 | dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq); |
1224 | clk_unprepare(i2c->clk); | ||
1221 | return ret; | 1225 | return ret; |
1222 | } | 1226 | } |
1223 | } | 1227 | } |
@@ -1225,6 +1229,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1225 | ret = s3c24xx_i2c_register_cpufreq(i2c); | 1229 | ret = s3c24xx_i2c_register_cpufreq(i2c); |
1226 | if (ret < 0) { | 1230 | if (ret < 0) { |
1227 | dev_err(&pdev->dev, "failed to register cpufreq notifier\n"); | 1231 | dev_err(&pdev->dev, "failed to register cpufreq notifier\n"); |
1232 | clk_unprepare(i2c->clk); | ||
1228 | return ret; | 1233 | return ret; |
1229 | } | 1234 | } |
1230 | 1235 | ||
@@ -1241,6 +1246,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) | |||
1241 | if (ret < 0) { | 1246 | if (ret < 0) { |
1242 | dev_err(&pdev->dev, "failed to add bus to i2c core\n"); | 1247 | dev_err(&pdev->dev, "failed to add bus to i2c core\n"); |
1243 | s3c24xx_i2c_deregister_cpufreq(i2c); | 1248 | s3c24xx_i2c_deregister_cpufreq(i2c); |
1249 | clk_unprepare(i2c->clk); | ||
1244 | return ret; | 1250 | return ret; |
1245 | } | 1251 | } |
1246 | 1252 | ||
@@ -1262,6 +1268,8 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) | |||
1262 | { | 1268 | { |
1263 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); | 1269 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); |
1264 | 1270 | ||
1271 | clk_unprepare(i2c->clk); | ||
1272 | |||
1265 | pm_runtime_disable(&i2c->adap.dev); | 1273 | pm_runtime_disable(&i2c->adap.dev); |
1266 | pm_runtime_disable(&pdev->dev); | 1274 | pm_runtime_disable(&pdev->dev); |
1267 | 1275 | ||
@@ -1293,13 +1301,16 @@ static int s3c24xx_i2c_resume_noirq(struct device *dev) | |||
1293 | { | 1301 | { |
1294 | struct platform_device *pdev = to_platform_device(dev); | 1302 | struct platform_device *pdev = to_platform_device(dev); |
1295 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); | 1303 | struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); |
1304 | int ret; | ||
1296 | 1305 | ||
1297 | if (!IS_ERR(i2c->sysreg)) | 1306 | if (!IS_ERR(i2c->sysreg)) |
1298 | regmap_write(i2c->sysreg, EXYNOS5_SYS_I2C_CFG, i2c->sys_i2c_cfg); | 1307 | regmap_write(i2c->sysreg, EXYNOS5_SYS_I2C_CFG, i2c->sys_i2c_cfg); |
1299 | 1308 | ||
1300 | clk_prepare_enable(i2c->clk); | 1309 | ret = clk_enable(i2c->clk); |
1310 | if (ret) | ||
1311 | return ret; | ||
1301 | s3c24xx_i2c_init(i2c); | 1312 | s3c24xx_i2c_init(i2c); |
1302 | clk_disable_unprepare(i2c->clk); | 1313 | clk_disable(i2c->clk); |
1303 | i2c->suspended = 0; | 1314 | i2c->suspended = 0; |
1304 | 1315 | ||
1305 | return 0; | 1316 | return 0; |