From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Linux I2C <linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 2/2] i2c-algo-bit: Complain about masters which can't read SCL
Date: Tue, 7 Dec 2010 11:07:05 +0100 [thread overview]
Message-ID: <20101207110705.69792a1a@endymion.delvare> (raw)
The I2C specification explicitly describes both SDA and SCL as
bidirectional lines. An I2C master with a read-only SCL is thus not
compliant. If a slow slave stretches the clock, errors will happen,
so the bus can't be considered as reliable.
Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
---
drivers/i2c/algos/i2c-algo-bit.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
--- linux-2.6.37-rc5.orig/drivers/i2c/algos/i2c-algo-bit.c 2010-12-07 11:02:38.000000000 +0100
+++ linux-2.6.37-rc5/drivers/i2c/algos/i2c-algo-bit.c 2010-12-07 11:03:23.000000000 +0100
@@ -604,9 +604,10 @@ static int __i2c_bit_add_bus(struct i2c_
int (*add_adapter)(struct i2c_adapter *))
{
struct i2c_algo_bit_data *bit_adap = adap->algo_data;
+ int ret;
if (bit_test) {
- int ret = test_bus(bit_adap, adap->name);
+ ret = test_bus(bit_adap, adap->name);
if (ret < 0)
return -ENODEV;
}
@@ -615,7 +616,16 @@ static int __i2c_bit_add_bus(struct i2c_
adap->algo = &i2c_bit_algo;
adap->retries = 3;
- return add_adapter(adap);
+ ret = add_adapter(adap);
+ if (ret < 0)
+ return ret;
+
+ /* Complain if SCL can't be read */
+ if (bit_adap->getscl == NULL) {
+ dev_warn(&adap->dev, "Not I2C compliant: can't read SCL\n");
+ dev_warn(&adap->dev, "Bus may be unreliable\n");
+ }
+ return 0;
}
int i2c_bit_add_bus(struct i2c_adapter *adap)
--
Jean Delvare
next reply other threads:[~2010-12-07 10:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-07 10:07 Jean Delvare [this message]
[not found] ` <20101207110705.69792a1a-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-12-07 11:53 ` [PATCH 2/2] i2c-algo-bit: Complain about masters which can't read SCL Ben Dooks
[not found] ` <20101207115325.GN20097-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-12-07 15:07 ` Jean Delvare
[not found] ` <20101207160739.0d7141f3-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-12-08 4:01 ` Ben Dooks
2010-12-07 12:10 ` Mark Brown
[not found] ` <20101207121009.GD10722-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2010-12-07 12:30 ` Ben Dooks
[not found] ` <20101207123011.GO20097-SMNkleLxa3Z6Wcw2j4pizdi2O/JbrIOy@public.gmane.org>
2010-12-07 15:29 ` Jean Delvare
[not found] ` <20101207162933.3ad206a8-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2010-12-07 15:35 ` Mark Brown
2010-12-08 4:03 ` Ben Dooks
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=20101207110705.69792a1a@endymion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.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