Linux Samsung SOC development
 help / color / mirror / Atom feed
From: Arnaud Patard (Rtp) <arnaud.patard@rtp-net.org>
To: ben-linux@fluff.org
Cc: linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org
Subject: [patch 1/1] i2c-s3c2410: Enable i2c clock only when doing some transfert
Date: Thu, 15 Jul 2010 15:06:14 +0200	[thread overview]
Message-ID: <20100715130636.136905589@rtp-net.org> (raw)

[-- Attachment #1: i2c_enable_clock_only_on_transfert.patch --]
[-- Type: text/plain, Size: 1330 bytes --]

This patch modify the s3c2410 i2c driver behaviour to enable the 
i2c clock only when needed. I'm not sure if this has a big impact
on power usage but at least it's fixing a bug with the uda1380
codec which needs to be hard reset'ed if the i2c clock is enabled
before it's powered on (at least on h1940).

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>

Index: linux-2.6/drivers/i2c/busses/i2c-s3c2410.c
===================================================================
--- linux-2.6.orig/drivers/i2c/busses/i2c-s3c2410.c	2010-07-03 22:47:14.473885834 +0200
+++ linux-2.6/drivers/i2c/busses/i2c-s3c2410.c	2010-07-03 22:48:43.261886656 +0200
@@ -555,18 +555,23 @@ static int s3c24xx_i2c_xfer(struct i2c_a
 	int retry;
 	int ret;
 
+	clk_enable(i2c->clk);
+
 	for (retry = 0; retry < adap->retries; retry++) {
 
 		ret = s3c24xx_i2c_doxfer(i2c, msgs, num);
 
-		if (ret != -EAGAIN)
+		if (ret != -EAGAIN) {
+			clk_disable(i2c->clk);
 			return ret;
+		}
 
 		dev_dbg(i2c->dev, "Retrying transmission (%d)\n", retry);
 
 		udelay(100);
 	}
 
+	clk_disable(i2c->clk);
 	return -EREMOTEIO;
 }
 
@@ -911,6 +916,7 @@ static int s3c24xx_i2c_probe(struct plat
 	platform_set_drvdata(pdev, i2c);
 
 	dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
+	clk_disable(i2c->clk);
 	return 0;
 
  err_cpufreq:

             reply	other threads:[~2010-07-15 13:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-15 13:06 Arnaud Patard [this message]
2010-07-23  9:02 ` [patch 1/1] i2c-s3c2410: Enable i2c clock only when doing some transfert Vasily Khoruzhick
2010-08-27 19:33   ` Vasily Khoruzhick
2010-10-01  6:34     ` Vasily Khoruzhick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100715130636.136905589@rtp-net.org \
    --to=arnaud.patard@rtp-net.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox