* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
@ 2005-06-09 18:52 ` Jean Delvare
2005-06-09 22:04 ` BGardner
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2005-06-09 18:52 UTC (permalink / raw)
To: lm-sensors
Hi Ben,
> I have a custom motherboard with four i2c devices on it.
> - lm83 @ 0x4c
Let me know if you have problems with this one. There aren't many LM83s
out there, so it might not have been fully tested.
> - max6875 @ 0x50
> - pca9539 @ 0x74
> - ds2484 @ 0x18
>
> Right now it takes 15.5 seconds to load those four modules.
> I see the "i2c-adapter i2c-0: timeout is state write" kernel message
> ten times.
> When I build those modules with only the correct addresses, the load
> time is 5.5 seconds.
scx200_acb bus driver? Even 5.5 seconds is more than I would accept. I
suspect that you still have a 4 timeouts on the second i2c adapter (one
per address you kept).
> So, it takes 10 seconds to probe addresses that don't exist.
>
> I'd like to speed up the module loading without modifying the source.
>
> Is there a way to tell an i2c module to load only for a specific
> address?
> I looked at the i2c_detect() function and did not see a way, but
> perhaps I just missed it.
You can't remove the default address list altogether. However, there is
a way to ignore addresses. Try for example:
modprobe lm83 ignore=0,0x18,0,0x19,0,0x1a,0,0x29,0,0x2a,0,0x2b,0,0x4d,0,0x4e
Not exactly convenient to type (/etc/modprobe.conf will help), but it
should work. And you should do the same with all addresses on bus 1,
else you'll have timeout on this one too.
The other way would be to lower the timeout in the scx200_acb. It is
currently set to 1 second:
#define POLL_TIMEOUT (HZ)
Changing this to say HZ/10 would be more reasonable.
Also, in scx200_acb_poll(), polling is done first, then msleep(10), then
retry if needed. I would do some stats on the number of cycles actually
required to retrieve a value. If it happens to be one cycle most of the
time (which I suspect), performance could probably be improved by
lowering the msleep value and possibly swapping the test and the msleep.
SMBus drivers which use polling (i2c-i801, i2c-viapro) do msleep(1)
first, and poll the value after that.
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
2005-06-09 18:52 ` Jean Delvare
@ 2005-06-09 22:04 ` BGardner
2005-06-09 22:27 ` Jean Delvare
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BGardner @ 2005-06-09 22:04 UTC (permalink / raw)
To: lm-sensors
Jean,
Thank you for your response.
I am using an AMD CS5535 chip, which is a "companion" chip to the AMD
Geode GX processor.
It is register-identical to the scx200, so I just copied that driver and
modified it work with the CS5535.
The detection is totally different - the scx200 is a PCI device, while
the CS5535 uses MSRs.
I'll probably send out a patch for that (cs5535 driver) in a few days,
once I have a chance to clean it up.
I swapped the poll & wait and reduced the POLL_TIMEOUT as you suggested.
With no other changes, the load time went down to 4.6 seconds.
I've timed the poll loop - typically it takes about 100us to send a
byte, so I changed the msleep(10) to wait_event_interruptible_timeout()
with a timeout of 1.
The hope there is that if I can figure out how to enable interrupts, the
ISR can just wake_up() the sleeping thread. But I haven't had any luck
so far.
Anyway, I added all the ignore and force parameters, ie:
modprobe lm83 force=0,0x4c
ignore=0,0x18,0,0x19,0,0x1a,0,0x29,0,0x2a,0,0x2b,0,0x4d,0,0x4e
And the total module load time (of everything) is down to 3.4 seconds.
=)
I'm happy with that.
Detailed modprobe times for i2c modules:
lm83=0.38s ds2482=0.57s max6875=0.55s pca9539=0.62s
Is that closer to what is expected?
Oh, I'm using the lm83 driver with a lm82 chip - and it works great.
Thanks,
Ben
-----Original Message-----
From: Jean Delvare [mailto:khali@linux-fr.org]
Sent: Thursday, June 09, 2005 11:51 AM
To: Gardner, Ben
Cc: lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] How can I skip i2c detection?
Hi Ben,
> I have a custom motherboard with four i2c devices on it.
> - lm83 @ 0x4c
Let me know if you have problems with this one. There aren't many LM83s
out there, so it might not have been fully tested.
> - max6875 @ 0x50
> - pca9539 @ 0x74
> - ds2484 @ 0x18
>
> Right now it takes 15.5 seconds to load those four modules.
> I see the "i2c-adapter i2c-0: timeout is state write" kernel message
> ten times.
> When I build those modules with only the correct addresses, the load
> time is 5.5 seconds.
scx200_acb bus driver? Even 5.5 seconds is more than I would accept. I
suspect that you still have a 4 timeouts on the second i2c adapter (one
per address you kept).
> So, it takes 10 seconds to probe addresses that don't exist.
>
> I'd like to speed up the module loading without modifying the source.
>
> Is there a way to tell an i2c module to load only for a specific
> address?
> I looked at the i2c_detect() function and did not see a way, but
> perhaps I just missed it.
You can't remove the default address list altogether. However, there is
a way to ignore addresses. Try for example:
modprobe lm83
ignore=0,0x18,0,0x19,0,0x1a,0,0x29,0,0x2a,0,0x2b,0,0x4d,0,0x4e
Not exactly convenient to type (/etc/modprobe.conf will help), but it
should work. And you should do the same with all addresses on bus 1,
else you'll have timeout on this one too.
The other way would be to lower the timeout in the scx200_acb. It is
currently set to 1 second:
#define POLL_TIMEOUT (HZ)
Changing this to say HZ/10 would be more reasonable.
Also, in scx200_acb_poll(), polling is done first, then msleep(10), then
retry if needed. I would do some stats on the number of cycles actually
required to retrieve a value. If it happens to be one cycle most of the
time (which I suspect), performance could probably be improved by
lowering the msleep value and possibly swapping the test and the msleep.
SMBus drivers which use polling (i2c-i801, i2c-viapro) do msleep(1)
first, and poll the value after that.
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
2005-06-09 18:52 ` Jean Delvare
2005-06-09 22:04 ` BGardner
@ 2005-06-09 22:27 ` Jean Delvare
2005-06-09 22:55 ` BGardner
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2005-06-09 22:27 UTC (permalink / raw)
To: lm-sensors
Hi Ben,
> Detailed modprobe times for i2c modules:
> lm83=0.38s ds2482=0.57s max6875=0.55s pca9539=0.62s
>
> Is that closer to what is expected?
Yes, sounds more reasonable.
> Oh, I'm using the lm83 driver with a lm82 chip - and it works great.
The lm83 driver could easily be extended to natively support the LM82.
It wasn't done so far because no LM82 chip was ever seen, but now you
seem to have one. If you want support, just ask and I'll add it.
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (2 preceding siblings ...)
2005-06-09 22:27 ` Jean Delvare
@ 2005-06-09 22:55 ` BGardner
2005-06-09 23:08 ` Jean Delvare
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BGardner @ 2005-06-09 22:55 UTC (permalink / raw)
To: lm-sensors
Hi Jean,
<clip>
> > Oh, I'm using the lm83 driver with a lm82 chip - and it works great.
>
> The lm83 driver could easily be extended to natively support the LM82.
> It wasn't done so far because no LM82 chip was ever seen, but now you
> seem to have one. If you want support, just ask and I'll add it.
<clip>
Well, if it's not too much of a bother, I'd like that.
Using hwmon-sysfs.h would clean that module up a bit, too. =)
I looked into doing this briefly, but didn't see a clean way to support
both chips.
As for detection...
On the LM82, temperatures 2 and 4 always read 127. (The spec says
otherwise.)
Register 0xFF (the stepping) is 3 (same as LM83) so that can't be used.
So maybe the detection could be to read temp 2 & 4 and if they are both
127, then it is a lm82?
I hope that helps.
Thanks,
Ben
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (3 preceding siblings ...)
2005-06-09 22:55 ` BGardner
@ 2005-06-09 23:08 ` Jean Delvare
2005-06-09 23:47 ` BGardner
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2005-06-09 23:08 UTC (permalink / raw)
To: lm-sensors
Hi Ben,
> Well, if it's not too much of a bother, I'd like that.
> Using hwmon-sysfs.h would clean that module up a bit, too. =)
Patch is already on its way to -mm :)
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/gregkh-02-i2c/i2c-device-attr-lm83.patch
> I looked into doing this briefly, but didn't see a clean way to
> support both chips.
I'll look into it, but I can't see any difficulty. What do you think
they are? It should only be a matter of not creating the sysfs files
which aren't needed on the LM82 (which is a subset of the LM83 IIRC).
> As for detection...
> On the LM82, temperatures 2 and 4 always read 127. (The spec says
> otherwise.)
> Register 0xFF (the stepping) is 3 (same as LM83) so that can't be
> used. So maybe the detection could be to read temp 2 & 4 and if they
> are both 127, then it is a lm82?
> I hope that helps.
Yes it does, but I'm a bit surprised. You said you had to force the lm83
driver. If the LM82 and LM83 chips have the same ID, this shouldn't be
needed. Could you please check which test made by the lm83 driver was
failing? This may be used to differenciate between both chips. Using the
temperatures may not work, as a LM83 with no diodes connected would
probably have 127 too.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (4 preceding siblings ...)
2005-06-09 23:08 ` Jean Delvare
@ 2005-06-09 23:47 ` BGardner
2005-06-10 9:22 ` Jean Delvare
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BGardner @ 2005-06-09 23:47 UTC (permalink / raw)
To: lm-sensors
Hi Jean,
If I do 'modprobe lm83' from the command line, it always works with the
lm82.
I added the 'force' param because when I added the 'ignore' params to my
'load modules' script, _sometimes_ it wouldn't detect the lm82. When
that occurs, I see a timeout in the scx200/cs5535 driver.
I added some logs to lm83.c and found out that it doesn't call
lm83_detect() when detection fails, so there's nothing wrong with the
lm83 driver.
If, after it fails to detect, I do a 'rmmod lm83' and then re-run the
same modprobe as is in the script, it detects fine.
So, it's probably a timing bug in the scx200/cs5535 driver. Or maybe it
is because the ds2482 is in the middle of a w1 search when the lm83 is
loaded.
Either way, the force parameter gets around that problem.
Good point about the 127.
Perhaps there isn't a reliable way to distinguish the two chips. =(
Thanks,
Ben
-----Original Message-----
From: Jean Delvare [mailto:khali@linux-fr.org]
Sent: Thursday, June 09, 2005 4:08 PM
To: Gardner, Ben
Cc: lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] How can I skip i2c detection?
Hi Ben,
> Well, if it's not too much of a bother, I'd like that.
> Using hwmon-sysfs.h would clean that module up a bit, too. =)
Patch is already on its way to -mm :)
http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/gregkh-0
2-i2c/i2c-device-attr-lm83.patch
> I looked into doing this briefly, but didn't see a clean way to
> support both chips.
I'll look into it, but I can't see any difficulty. What do you think
they are? It should only be a matter of not creating the sysfs files
which aren't needed on the LM82 (which is a subset of the LM83 IIRC).
> As for detection...
> On the LM82, temperatures 2 and 4 always read 127. (The spec says
> otherwise.)
> Register 0xFF (the stepping) is 3 (same as LM83) so that can't be
> used. So maybe the detection could be to read temp 2 & 4 and if they
> are both 127, then it is a lm82?
> I hope that helps.
Yes it does, but I'm a bit surprised. You said you had to force the lm83
driver. If the LM82 and LM83 chips have the same ID, this shouldn't be
needed. Could you please check which test made by the lm83 driver was
failing? This may be used to differenciate between both chips. Using the
temperatures may not work, as a LM83 with no diodes connected would
probably have 127 too.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (5 preceding siblings ...)
2005-06-09 23:47 ` BGardner
@ 2005-06-10 9:22 ` Jean Delvare
2005-06-10 16:55 ` BGardner
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2005-06-10 9:22 UTC (permalink / raw)
To: lm-sensors
Hi Ben,
> Good point about the 127.
> Perhaps there isn't a reliable way to distinguish the two chips. =(
Does sensors-detect find an LM82, or an LM83? Or both? Or none?
Could you please provide a dump of your LM82 chip (use i2cdump)? I could
compare with my LM83.
If there really is no way to differenciate between both chips, well,
we'll simply document that fact, and invite LM82 owners to ignore the
two irrelevant temperature channels.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (6 preceding siblings ...)
2005-06-10 9:22 ` Jean Delvare
@ 2005-06-10 16:55 ` BGardner
2005-06-10 20:43 ` Jean Delvare
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: BGardner @ 2005-06-10 16:55 UTC (permalink / raw)
To: lm-sensors
Jean,
Here's the i2cdump output.
I did not run sensors-detect on my target, as perl isn't installed.
Ben
~ # i2cdump 0 0x4c
No size specified (using byte-data access)
WARNING! This program can confuse your I2C bus, cause data loss and
worse!
I will probe file /dev/i2c/0, address 0x4c, mode byte
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: 20 2f 00 3c 00 2d 2d 50 50 50 50 50 50 50 50 50 /.<.--PPPPPPPPP
10: 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 PPPPPPPPPPPPPPPP
20: 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 PPPPPPPPPPPPPPPP
30: 7f 7f 7f 7f 7f 24 24 24 7f 7f 7f 7f 7f 7f 7f 7f ?????$$$????????
40: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
50: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
60: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
70: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
80: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
90: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
a0: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
b0: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
c0: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
d0: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
e0: 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f ????????????????
f0: 00 01 0f 34 26 26 26 00 0d 03 02 02 02 02 01 03 .??4&&&.????????
Wow, i2cdump runs MUCH faster with those timing changes!
-----Original Message-----
From: Jean Delvare [mailto:khali@linux-fr.org]
Sent: Friday, June 10, 2005 2:13 AM
To: Gardner, Ben
Cc: LM Sensors
Subject: RE: [lm-sensors] How can I skip i2c detection?
Hi Ben,
> Good point about the 127.
> Perhaps there isn't a reliable way to distinguish the two chips. =(
Does sensors-detect find an LM82, or an LM83? Or both? Or none?
Could you please provide a dump of your LM82 chip (use i2cdump)? I could
compare with my LM83.
If there really is no way to differenciate between both chips, well,
we'll simply document that fact, and invite LM82 owners to ignore the
two irrelevant temperature channels.
Thanks,
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (7 preceding siblings ...)
2005-06-10 16:55 ` BGardner
@ 2005-06-10 20:43 ` Jean Delvare
2005-06-10 21:49 ` BGardner
2005-06-12 9:15 ` Jean Delvare
10 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2005-06-10 20:43 UTC (permalink / raw)
To: lm-sensors
Hi Ben,
> ~ # i2cdump 0 0x4c
> (...)
> 30: 7f 7f 7f 7f 7f 24 24 24 7f 7f 7f 7f 7f 7f 7f 7f
Hm, this is becoming even weirder. Same ID as the LM83 (which doesn't
match the datasheet...), and additionally register 0x35 reads 0x24,
which means D1 and D3 open on the LM83, while this register is
supposedly 0 on the LM82. This also corroborates the 127 degrees C you
report for temp2 and temp4, which is the documented LM83's behavior when
no diode is connected, while the LM82 datasheet suggests 0 for these
registers.
So I start wondering... are you *absolutely certain* that what you have
is an LM82 and NOT an LM83?
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (8 preceding siblings ...)
2005-06-10 20:43 ` Jean Delvare
@ 2005-06-10 21:49 ` BGardner
2005-06-12 9:15 ` Jean Delvare
10 siblings, 0 replies; 12+ messages in thread
From: BGardner @ 2005-06-10 21:49 UTC (permalink / raw)
To: lm-sensors
Jean,
I am as certain as I can be that I am using a LM82.
The chip is on two different motherboards, one is from Avantech and one
is a custom job.
Our schematic calls out a LM82 and the chip has this text on it: 43AB
82CI MQA
I don't know what "43AB" refers to, but "82CIMQA" is part of the order
number "LM82CIMQA".
The Avantech demo board has the same chip, except that the first number
is "42AB".
The BIOS on the Avantech board calls it a LM82.
It could be that the LM82 and LM83 have an identical uC inside and just
the packaging is different.
Ben
-----Original Message-----
From: Jean Delvare [mailto:khali@linux-fr.org]
Sent: Friday, June 10, 2005 1:43 PM
To: Gardner, Ben
Cc: lm-sensors@lm-sensors.org
Subject: Re: [lm-sensors] How can I skip i2c detection?
Hi Ben,
> ~ # i2cdump 0 0x4c
> (...)
> 30: 7f 7f 7f 7f 7f 24 24 24 7f 7f 7f 7f 7f 7f 7f 7f
Hm, this is becoming even weirder. Same ID as the LM83 (which doesn't
match the datasheet...), and additionally register 0x35 reads 0x24,
which means D1 and D3 open on the LM83, while this register is
supposedly 0 on the LM82. This also corroborates the 127 degrees C you
report for temp2 and temp4, which is the documented LM83's behavior when
no diode is connected, while the LM82 datasheet suggests 0 for these
registers.
So I start wondering... are you *absolutely certain* that what you have
is an LM82 and NOT an LM83?
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread* [lm-sensors] How can I skip i2c detection?
2005-06-09 17:52 [lm-sensors] How can I skip i2c detection? BGardner
` (9 preceding siblings ...)
2005-06-10 21:49 ` BGardner
@ 2005-06-12 9:15 ` Jean Delvare
10 siblings, 0 replies; 12+ messages in thread
From: Jean Delvare @ 2005-06-12 9:15 UTC (permalink / raw)
To: lm-sensors
Hi Ben,
> I am as certain as I can be that I am using a LM82.
> The chip is on two different motherboards, one is from Avantech and
> one is a custom job.
>
> Our schematic calls out a LM82 and the chip has this text on it: 43AB
> 82CI MQA
> I don't know what "43AB" refers to, but "82CIMQA" is part of the order
> number "LM82CIMQA".
>
> The Avantech demo board has the same chip, except that the first
> number is "42AB".
> The BIOS on the Avantech board calls it a LM82.
>
> It could be that the LM82 and LM83 have an identical uC inside and
> just the packaging is different.
My guess exactly. So I updated our sensors-detect script accordingly, it
won't try to differenciate between LM82 and LM83 anymore. I do not plan
to update the lm83 driver for now, as it seems that the LM82 is already
supported by the driver, it would only be a matter of updating the
documentation to say so. I'll try to get additional information before I
do.
Thanks for the report!
--
Jean Delvare
^ permalink raw reply [flat|nested] 12+ messages in thread