aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-s3c2410.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-s3c2410.c')
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index bf831bf81587..f84a63c6dd97 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -24,7 +24,6 @@
24#include <linux/module.h> 24#include <linux/module.h>
25 25
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/i2c-id.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/time.h> 28#include <linux/time.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
@@ -249,12 +248,12 @@ static inline int is_msgend(struct s3c24xx_i2c *i2c)
249 return i2c->msg_ptr >= i2c->msg->len; 248 return i2c->msg_ptr >= i2c->msg->len;
250} 249}
251 250
252/* i2s_s3c_irq_nextbyte 251/* i2c_s3c_irq_nextbyte
253 * 252 *
254 * process an interrupt and work out what to do 253 * process an interrupt and work out what to do
255 */ 254 */
256 255
257static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat) 256static int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
258{ 257{
259 unsigned long tmp; 258 unsigned long tmp;
260 unsigned char byte; 259 unsigned char byte;
@@ -265,7 +264,6 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
265 case STATE_IDLE: 264 case STATE_IDLE:
266 dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__); 265 dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__);
267 goto out; 266 goto out;
268 break;
269 267
270 case STATE_STOP: 268 case STATE_STOP:
271 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__); 269 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__);
@@ -445,7 +443,7 @@ static irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id)
445 /* pretty much this leaves us with the fact that we've 443 /* pretty much this leaves us with the fact that we've
446 * transmitted or received whatever byte we last sent */ 444 * transmitted or received whatever byte we last sent */
447 445
448 i2s_s3c_irq_nextbyte(i2c, status); 446 i2c_s3c_irq_nextbyte(i2c, status);
449 447
450 out: 448 out:
451 return IRQ_HANDLED; 449 return IRQ_HANDLED;
@@ -555,18 +553,23 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
555 int retry; 553 int retry;
556 int ret; 554 int ret;
557 555
556 clk_enable(i2c->clk);
557
558 for (retry = 0; retry < adap->retries; retry++) { 558 for (retry = 0; retry < adap->retries; retry++) {
559 559
560 ret = s3c24xx_i2c_doxfer(i2c, msgs, num); 560 ret = s3c24xx_i2c_doxfer(i2c, msgs, num);
561 561
562 if (ret != -EAGAIN) 562 if (ret != -EAGAIN) {
563 clk_disable(i2c->clk);
563 return ret; 564 return ret;
565 }
564 566
565 dev_dbg(i2c->dev, "Retrying transmission (%d)\n", retry); 567 dev_dbg(i2c->dev, "Retrying transmission (%d)\n", retry);
566 568
567 udelay(100); 569 udelay(100);
568 } 570 }
569 571
572 clk_disable(i2c->clk);
570 return -EREMOTEIO; 573 return -EREMOTEIO;
571} 574}
572 575
@@ -911,6 +914,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
911 platform_set_drvdata(pdev, i2c); 914 platform_set_drvdata(pdev, i2c);
912 915
913 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); 916 dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
917 clk_disable(i2c->clk);
914 return 0; 918 return 0;
915 919
916 err_cpufreq: 920 err_cpufreq:
@@ -978,7 +982,9 @@ static int s3c24xx_i2c_resume(struct device *dev)
978 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); 982 struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
979 983
980 i2c->suspended = 0; 984 i2c->suspended = 0;
985 clk_enable(i2c->clk);
981 s3c24xx_i2c_init(i2c); 986 s3c24xx_i2c_init(i2c);
987 clk_disable(i2c->clk);
982 988
983 return 0; 989 return 0;
984} 990}