* [PATCH] Generate correct i2c address sequence for 10-bit target.
@ 2011-11-03 19:15 Jeffrey (Sheng-Hui) Chu
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541AE6855A097-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Jeffrey (Sheng-Hui) Chu @ 2011-11-03 19:15 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jean Delvare
>From 31eb33a1b648f380db284a59d7fa5b4c1a321651 Mon Sep 17 00:00:00 2001
From: Sheng-Hui J. Chu <jeffchu-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
Date: Thu, 3 Nov 2011 14:24:06 -0400
Subject: [PATCH] Generate correct i2c address sequence for 10-bit target.
Signed-off-by: Sheng-Hui J. Chu <jeffchu-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
---
drivers/i2c/algos/i2c-algo-bit.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 85584a5..525c734 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -488,7 +488,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
if (flags & I2C_M_TEN) {
/* a ten bit address */
- addr = 0xf0 | ((msg->addr >> 7) & 0x03);
+ addr = 0xf0 | ((msg->addr >> 7) & 0x06);
bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr);
/* try extended address code...*/
ret = try_address(i2c_adap, addr, retries);
@@ -498,7 +498,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
return -ENXIO;
}
/* the remaining 8 bit address */
- ret = i2c_outb(i2c_adap, msg->addr & 0x7f);
+ ret = i2c_outb(i2c_adap, msg->addr & 0xff);
if ((ret != 1) && !nak_ok) {
/* the chip did not ack / xmission error occurred */
dev_err(&i2c_adap->dev, "died at 2nd address code\n");
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread[parent not found: <B6A520E9CD57404AAFC0831E4FB39541AE6855A097-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] Generate correct i2c address sequence for 10-bit target. [not found] ` <B6A520E9CD57404AAFC0831E4FB39541AE6855A097-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org> @ 2011-11-07 9:30 ` Jean Delvare 0 siblings, 0 replies; 2+ messages in thread From: Jean Delvare @ 2011-11-07 9:30 UTC (permalink / raw) To: Jeffrey (Sheng-Hui) Chu; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Hi Sheng-Hui, On Thu, 3 Nov 2011 12:15:12 -0700, Jeffrey (Sheng-Hui) Chu wrote: > From 31eb33a1b648f380db284a59d7fa5b4c1a321651 Mon Sep 17 00:00:00 2001 > From: Sheng-Hui J. Chu <jeffchu-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> > Date: Thu, 3 Nov 2011 14:24:06 -0400 > Subject: [PATCH] Generate correct i2c address sequence for 10-bit target. > > Signed-off-by: Sheng-Hui J. Chu <jeffchu-dY08KVG/lbpWk0Htik3J/w@public.gmane.org> > --- > drivers/i2c/algos/i2c-algo-bit.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c > index 85584a5..525c734 100644 > --- a/drivers/i2c/algos/i2c-algo-bit.c > +++ b/drivers/i2c/algos/i2c-algo-bit.c > @@ -488,7 +488,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) > > if (flags & I2C_M_TEN) { > /* a ten bit address */ > - addr = 0xf0 | ((msg->addr >> 7) & 0x03); > + addr = 0xf0 | ((msg->addr >> 7) & 0x06); > bit_dbg(2, &i2c_adap->dev, "addr0: %d\n", addr); > /* try extended address code...*/ > ret = try_address(i2c_adap, addr, retries); > @@ -498,7 +498,7 @@ static int bit_doAddress(struct i2c_adapter *i2c_adap, struct i2c_msg *msg) > return -ENXIO; > } > /* the remaining 8 bit address */ > - ret = i2c_outb(i2c_adap, msg->addr & 0x7f); > + ret = i2c_outb(i2c_adap, msg->addr & 0xff); > if ((ret != 1) && !nak_ok) { > /* the chip did not ack / xmission error occurred */ > dev_err(&i2c_adap->dev, "died at 2nd address code\n"); Applied, thanks. I wanted to apply it before, but couldn't retrieve it from bugzilla before it went down. Thanks for resending it. Note that i2c-core will need some adjustment to properly deal with 7-bit and 10-bit addresses domains (their bus_id currently collide.) I'll post a proposal for this later today. -- Jean Delvare ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-07 9:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-03 19:15 [PATCH] Generate correct i2c address sequence for 10-bit target Jeffrey (Sheng-Hui) Chu
[not found] ` <B6A520E9CD57404AAFC0831E4FB39541AE6855A097-4wnuKdaqIVJdD26/7+am4baTQr+y5IJFqs7JOtOhHmkAvxtiuMwx3w@public.gmane.org>
2011-11-07 9:30 ` Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox