Skip to contentSkip to conversation

smsc47m1 ported to Linux 2.6

DISCUSSION Jean Delvare 3 participants 20 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi all,

I just finished a preliminary version of the smsc47m1 driver to Linux 2.6. Patch is available here:

http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-alpha2.diff

It's basically Gabriele Gorla's version, updated to reflect recent changes to the kernel and fixes to the 2.4 driver, plus some minor tweaks. As the name says, it's built against 2.6.8-rc2, but any recent kernel tree (>=2.6.7) should do too.

Note that the patch is completely untested since I don't own a compatible device myself. But I felt that the port had been pending for too long and I know that there is an impatient crowd waiting for this driver to be part of Linux 2.6, so I tried to complete the existing code into something people could finally try.

Please test if possible, and tell me how it fails for you ;)

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#2 lore raw
In reply to Jean Delvare

BTW, I think that there's still something broken in the 2.4 smsc47m1 driver. If I read the datasheets correctly, pwm_enable currently does what you tell it not to do, ie: 1 will force fan to full speed while 0 will enable PWM.

Can someone (Mark?) confirm?

Thanks,

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#3 lore raw
In reply to Jean Delvare

Hi Jean,

Sorry for the long delay.
I was a little busy here.
I got the package.
It patched (no *.rej) and compiled fine.
Attached is a file with some output from my environment. If you need more information, please, tell me. I will try to get it
to you.
Thank you.

Cheers,

Freitas

Quoted 4 lines

Just updated my smsc47m1 patch after I found some errors in the previous versions. You can get it here:

http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-alpha3.diff

-------------- next part --------------
A non-text attachment was scrubbed...
Name: probs.txt
Type: application/octet-stream
Size: 2273 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040724/ceac300c/probs.obj

#4 lore raw
In reply to Jean Delvare

Hi Jean,

Quoted 9 lines

After both of you reported that fan1 was working OK but fan2 wasn't, I had to admit that there could be a problem in the driver. It is theoretically possible that the board maker decides to enable fan1 and disable fan2 (which is why I didn't react after the first report) but two reports by two different testers were too much ;)

There was actually a bug in the driver, I wasn't watching the correct registers when deciding whether to ebable fans or not. Same for PWM outputs.

1) I was reading my mainboard manual and I found that there is a
third fan connector (1 processor fan and 2 chassis fans). I have just
two: 1 processor and 1 chassis). I confirmed at the mainboard and the third connector is really there. I can't test it for now.
2)Sorry, I didn't understand about PWM outputs. Sorry. :-|

Quoted 10 lines

This is now fixed in patch tagged beta1:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-beta1.diff

Please test and confirm that both of you now have fan 1 and 2 working, and two pwm file sets as well (whether they have an actual effect on fans is yet another matter).

(You can revert the first patch using "patch -R" before applying this one, so that you won't waste your time getting a fresh new tree.)

I did patch -p1 -R.
I applied the new one. Applied and compiled fine. Please, take a look at probs2.txt attached.

Quoted 1 line

Thanks a lot for testing my code.

Thanks a lot for coding it. :-)

Quoted 4 lines

Among things that can be done to test the driver more actively:

1* Change fan limits in /etc/sensors.conf, run "sensors -s" and check that the limits have been set properly. Ditto for divisors.

As you can see at probs2.txt, I tried some values and there are
diffs between them. (sensors.conf and sensors output)

Quoted 3 lines

2* Change the fan limits through sysfs directly. Testing of corner cases is welcome (large values, negative values, zero). Ditto for divisors.

I tried to put values in fan1_min.
It didn't accepted values less than 1299 and treated it as 1300. I tried negative values and it didn't accept it.
(if you "cat fan1_min" or use sensors command, the output is the
same: 1300)
(see probs2.txt also)

Quoted 2 lines

3* Play with PWM (enable/disable, change speed). Be careful not to stop your fans completely, systems usually don't like that much.

As I said, I am not using PWM (power management?), so I don't know
how to try this. Sorry.
Oh, I am using gkrellm and I can get fans there too. (both) :-)

If you need more information, please just tell me.

Quoted 1 line

Thanks again.

Thanks again, too. :-)

Cheers,

Freitas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: probs2.txt
Type: application/octet-stream
Size: 3461 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040724/eb616bc5/probs2.obj

#5 lore raw
In reply to Jean Delvare

Hi Jean,

I tried some other things.
I am a little confused. :-)
I tried some options in /etc/sensors.conf and executed sensors -s
and sensors commands.
Please, take a look at probs3.txt (attached).
If you need more information, please tell me.
Thank you.

Cheers,

Freitas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: probs3.txt
Type: application/octet-stream
Size: 2368 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040724/c707fcc5/probs3.obj

#6 lore raw
In reply to Jean Delvare
Quoted 2 lines

Sorry for the long delay.
I was a little busy here.

No problem :)

Quoted 3 lines

I got the package.
It patched (no *.rej) and compiled fine. Attached is a file with some output from my environment.

After both of you reported that fan1 was working OK but fan2 wasn't, I had to admit that there could be a problem in the driver. It is theoretically possible that the board maker decides to enable fan1 and disable fan2 (which is why I didn't react after the first report) but two reports by two different testers were too much ;)

There was actually a bug in the driver, I wasn't watching the correct registers when deciding whether to ebable fans or not. Same for PWM outputs.

This is now fixed in patch tagged beta1:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-beta1.diff

Please test and confirm that both of you now have fan 1 and 2 working, and two pwm file sets as well (whether they have an actual effect on fans is yet another matter).

(You can revert the first patch using "patch -R" before applying this one, so that you won't waste your time getting a fresh new tree.)

Thanks a lot for testing my code.

Among things that can be done to test the driver more actively:

1* Change fan limits in /etc/sensors.conf, run "sensors -s" and check that the limits have been set properly. Ditto for divisors.

2* Change the fan limits through sysfs directly. Testing of corner cases is welcome (large values, negative values, zero). Ditto for divisors.

3* Play with PWM (enable/disable, change speed). Be careful not to stop your fans completely, systems usually don't like that much.

Thanks again.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#7 lore raw
In reply to Jean Delvare
Quoted 4 lines

1) I was reading my mainboard manual and I found that there is a third fan connector (1 processor fan and 2 chassis fans). I have just
two: 1 processor and 1 chassis). I confirmed at the mainboard and the third connector is really there. I can't test it for now.

I've read the manual too, and it says that fan3 control is optional, depending on whether you have a 47M132 or 47M142 chip. They also say that the CPU fan can be monitored but not controled, and that the System fan can be monitored and controled.

Quoted 2 lines

As you can see at probs2.txt, I tried some values and there are diffs between them. (sensors.conf and sensors output)

This is expected. The fan monitoring has limited resolution due to the way it works. So there's nothing wrong with asking for, say, 2000 and get 1996 or 2008 in return. It's even more true if you use a high fan clock divider (say 8).

Quoted 5 lines

I tried to put values in fan1_min.
It didn't accepted values less than 1299 and treated it as 1300. I tried negative values and it didn't accept it.
(if you "cat fan1_min" or use sensors command, the output is the
same: 1300)

Fine, that's exactly what was supposed to happen.

Note that the actual min depends on the fan clock divider. I guess you had a divider of 4.

Quoted 2 lines

As I said, I am not using PWM (power management?), so I don't know how to try this. Sorry.

PWM means for "pulse width modulation" and not related to power management at all. It's a way to control the speed of your fans.

In /sys/bus/i2c/devices/1-0800 you should see files named fan1_pwm and fan1_pwm_enable. You can change their values to control how fast you want your fan to spin. That's interesting if your system is not too hot but a bit noisy. It basically lets you select a temperature/noise tradeoff.

fan1_pwm_enable can take two values: 0 and 1. 0 means that the fan is always running at full speed. 1 means that you can control the speed with the second file, fan1_pwm. fan1_pwm value is between 0 (fan off, not recommended) and 255 (full speed).

Note that depending on how the motherboard is wires, fan1_pwm can control fan1 OR a different fan, there's no way to know. Anyway, according to your motherboard docs, cpu fan speed is not controlable, so you should be able to play safely with this feature (unless your fans are not plugged in the correct headers).

If fan1_pwm doesn't seem to have any effect you can try fan2_pwm.

A test sequence would be:
echo 255 > fan1_pwm
cat fan1_pwm (should read 252)
echo 1 > fan1_pwm_enable
cat fan1_pwm_enable (should read 1)
echo 160 > fan1_pwm
cat fan1_pwm (should read 160, fan should slow down)
echo 0 > fan1_pwm_enable
cat fan1_pwm_enable (should read 0, fan should go back to full speed)

You should wait 2 seconds between each command to make sure you read the values from the chip and not from the cache.

Quoted 1 line

If you need more information, please just tell me.

Yes. I've updated the patch:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-beta2.diff

I've fixed a number of corner cases, and also added some code so that changing the fan clock divider should preserve the corresponding fan min. I'd like you to try that:

echo 8 > fan1_div
cat fan1_div (should read 8)
echo 3000 > fan1_min
cat fan1_min (should read around, but not exactly, 3000) echo 2 > fan1_div
cat fan1_div (should read 2)
cat fan1_min (should read around, but not exactly, 3000) echo 4 > fan1_div
cat fan1_div (should read 4)
cat fan1_min (should read around, but not exactly, 3000)

Also, about the logs you sent, I'm a bit surprised about the alarms. You seem to be as well... Looks like they trigger more often than they should (i.e. if the fan speed is little above the limit). Could you please provide a dump of your chip so that I can check why this happens?

isadump -f 0x800 0x80

And if possible the corresponding output of "sensors" with such an alarm set.

Quoted 1 line

compute fan2_min (@+4), (@+4)

You can discard that, it's not worth it IMHO. Fan speeds are not exact values, some noise is expected.

Thanks!

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#8 lore raw
In reply to Jean Delvare

Jean,

Quoted 9 lines
Quoted 4 lines

1) I was reading my mainboard manual and I found that there is a third fan connector (1 processor fan and 2 chassis fans). I have just two: 1 processor and 1 chassis). I confirmed at the mainboard and the third connector is really there. I can't test it for now.

I've read the manual too, and it says that fan3 control is optional, depending on whether you have a 47M132 or 47M142 chip. They also say that the CPU fan can be monitored but not controled, and that the System fan can be monitored and controled.

Great. I was reading the short manual (printed version) I was just looking for fan connectors position. But this information
is interesting.

Quoted 10 lines
Quoted 5 lines

I tried to put values in fan1_min.
It didn't accepted values less than 1299 and treated it as 1300. I tried negative values and it didn't accept it.
(if you "cat fan1_min" or use sensors command, the output is the
same: 1300)

Fine, that's exactly what was supposed to happen.

Note that the actual min depends on the fan clock divider. I guess you had a divider of 4.

Yes, divider equals to 4. :-)

Quoted 11 lines
Quoted 2 lines

As I said, I am not using PWM (power management?), so I don't know how to try this. Sorry.

PWM means for "pulse width modulation" and not related to power management at all. It's a way to control the speed of your fans.

In /sys/bus/i2c/devices/1-0800 you should see files named fan1_pwm and fan1_pwm_enable. You can change their values to control how fast you want your fan to spin. That's interesting if your system is not too hot but a bit noisy. It basically lets you select a temperature/noise tradeoff.

I had already seen this files, but I didn't know about PWM meaning.
Thank you.
I tried to change fan2 and, as we could see, fan2 here, at my
mainboard, means processor fan and, as you told, it can't be turned off. :-)

Quoted 24 lines

fan1_pwm_enable can take two values: 0 and 1. 0 means that the fan is always running at full speed. 1 means that you can control the speed with the second file, fan1_pwm. fan1_pwm value is between 0 (fan off, not recommended) and 255 (full speed).

Note that depending on how the motherboard is wires, fan1_pwm can control fan1 OR a different fan, there's no way to know. Anyway, according to your motherboard docs, cpu fan speed is not controlable, so you should be able to play safely with this feature (unless your fans are not plugged in the correct headers).

If fan1_pwm doesn't seem to have any effect you can try fan2_pwm.

A test sequence would be:
echo 255 > fan1_pwm
cat fan1_pwm (should read 252)
echo 1 > fan1_pwm_enable
cat fan1_pwm_enable (should read 1)
echo 160 > fan1_pwm
cat fan1_pwm (should read 160, fan should slow down) echo 0 > fan1_pwm_enable
cat fan1_pwm_enable (should read 0, fan should go back to full speed)

Quoted 2 lines

You should wait 2 seconds between each command to make sure you read the values from the chip and not from the cache.

I patched -R the last diff.
I patched with the file below.
Compiled fine.
I tried the commands above.
Just an strange behavior with sensors command information. Please, take a look at probs4.txt attached.

Quoted 24 lines

Yes. I've updated the patch:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-beta2.diff

I've fixed a number of corner cases, and also added some code so that changing the fan clock divider should preserve the corresponding fan min. I'd like you to try that:

echo 8 > fan1_div
cat fan1_div (should read 8)
echo 3000 > fan1_min
cat fan1_min (should read around, but not exactly, 3000) echo 2 > fan1_div
cat fan1_div (should read 2)
cat fan1_min (should read around, but not exactly, 3000) echo 4 > fan1_div
cat fan1_div (should read 4)
cat fan1_min (should read around, but not exactly, 3000)

Also, about the logs you sent, I'm a bit surprised about the alarms. You seem to be as well... Looks like they trigger more often than they should (i.e. if the fan speed is little above the limit). Could you please provide a dump of your chip so that I can check why this happens?

Quoted 4 lines

isadump -f 0x800 0x80

And if possible the corresponding output of "sensors" with such an alarm set.

Please, take a look at results_jean.txt and results_jean_dump.txt.

Quoted 4 lines
Quoted 1 line

compute fan2_min (@+4), (@+4)

You can discard that, it's not worth it IMHO. Fan speeds are not exact values, some noise is expected.

Discarded. :-)
All tests I did were made without this line.
If you need more information, please tell me.
From today, I can delay a little more to answer because I am back to
college classes. (The end of vacation)

P.S. My english is not good enough. :-)

Thank you.

Cheers,

Freitas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: probs4.txt
Type: application/octet-stream
Size: 4235 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040726/8c902c84/probs4.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: results_jean.txt
Type: application/octet-stream
Size: 4483 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040726/8c902c84/results_jean.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: results_jean_dump.txt
Type: application/octet-stream
Size: 725 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040726/8c902c84/results_jean_dump.obj

#9 lore raw
In reply to Jean Delvare
Quoted 2 lines

I finally got hands on that system, which appeared to be D815EEA, not D815EEA2

I don't think this makes much difference, does it?

Quoted 4 lines

It has only one fan (CPU) connected to fan3. Fan1 and fan2 are not connected (according to labels on motherboard). however, fan3 is 3-wire. I do not know what else I could test as testing fan1 and fan2 imo makes no sense.

Labels on the motherboad do not necessarily match those of the SMSC chip (which is what lm_sensors use), but the 0 readings suggest that fans 1 and 2 on one side are 1 and 2 on the other side (exact matching unknown), i.e. fan 3 (as labeled on your motherboard) is not monitored, and most probably not controlable either.

If you have a spare 3-wire fan, you can just plug it into either fan 1 or 2 (as labeled on your motherboard) and see what happens. If not, well, I guess that your testing is over.

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#10 lore raw
In reply to Jean Delvare
Quoted 1 line

Please, take a look at probs4.txt attached.

The good point is that you seem to be able to control fan 1's speed. But the reported value goes weird as soon as the fan is stopped. Either the value isn't updated anymore (i.e. last value is reported) or random values are reported. Since it reported 5851 RPM once, which doesn't seem possibe, I would opt for the second case. However, I would like you to do some more tests to confirm that.

Please stop the fan (pwm_enable=1, pwm=0) and run sensors several times in a row, with some delay between each run. Check if the (obviously wrong value) which is reported is the same each time, or not.

Quoted 1 line

Please, take a look at results_jean.txt

My code was obviously bogus, fan min was not preserved at all when changining fan div. I just took a look and have to say I'm a bit ashamed, since it was caused by... a misplaced parenthesis.

Fixed patch is available:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-beta3.diff
if you can please test again using the same script. Oh, BTW:

Quoted 5 lines

modprobe i2c_sensor
modprobe i2c-i801
modprobe i2c-isa
modprobe adm1025
modprobe smsc47m1

You don't need to explicitly modprobe i2c_sensor, it'll be loaded as needed automatically.

Quoted 1 line

and results_jean_dump.txt.

Fan alarms are not set on the dump you sent, so there's nothing I can check. The case I'm interested in is when "sensors" show an alarm which you think should not be there. If you provide both the output of "sensors" and the dump at that instant, I may be able to check if sensors' output matches the registers dump or not. If you are not able to reproduce that corner case or are not worried about it, just forget about it, it's not critical.

Quoted 2 lines

From today, I can delay a little more to answer because I am back to college classes. (The end of vacation)

Oh, I wish you well then :)

Quoted 1 line

P.S. My english is not good enough. :-)

Like mine is perfect? ;) Come on, you must be kidding, your English is honest to say the least. You have no idea what bad English is.

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#11 lore raw
In reply to Jean Delvare
Quoted 4 lines

BTW, I think that there's still something broken in the 2.4 smsc47m1 driver. If I read the datasheets correctly, pwm_enable currently does what you tell it not to do, ie: 1 will force fan to full speed while 0 will enable PWM.

I did the change, hope it was correct.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#12 lore raw
In reply to Jean Delvare
Quoted 6 lines

the cup fan wire is way too short to connect to either fan1 or 2 :( well, my testing wasn't too useful
anyway, i appreciate your great work. for me this motherboard reports temperatures now
with best regards,
Ivars

Well, your help was still better than nothing :)

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#13 lore raw
In reply to Jean Delvare

the cup fan wire is way too short to connect to either fan1 or 2 :( well, my testing wasn't too useful
anyway, i appreciate your great work. for me this motherboard reports temperatures now
with best regards,
Ivars

Quoted 30 lines · Jean Delvare
Quoted 4 lines

I finally got hands on that system, which appeared to be D815EEA, not D815EEA2

I don't think this makes much difference, does it?

Quoted 6 lines

It has only one fan (CPU) connected to fan3. Fan1 and fan2 are not connected (according to labels on motherboard). however, fan3 is 3-wire. I do not know what else I could test as testing fan1 and fan2 imo makes no sense.

Labels on the motherboad do not necessarily match those of the SMSC chip (which is what lm_sensors use), but the 0 readings suggest that fans 1 and 2 on one side are 1 and 2 on the other side (exact matching unknown), i.e. fan 3 (as labeled on your motherboard) is not monitored, and most probably not controlable either.

If you have a spare 3-wire fan, you can just plug it into either fan 1 or 2 (as labeled on your motherboard) and see what happens. If not, well, I guess that your testing is over.

Thanks.

#14 lore raw
In reply to Jean Delvare

Hi Jean,

Uff, finally I ran the tests.
As usually, I patched -R beta2.diff, patched -p1 beta3.diff and
make bzImage, make install, make modules, make modules_install.
Everything was fine. No .rej.

Quoted 24 lines
Quoted 1 line

Please, take a look at probs4.txt attached.

The good point is that you seem to be able to control fan 1's speed. But the reported value goes weird as soon as the fan is stopped. Either the value isn't updated anymore (i.e. last value is reported) or random values are reported. Since it reported 5851 RPM once, which doesn't seem possibe, I would opt for the second case. However, I would like you to do some more tests to confirm that.

Please stop the fan (pwm_enable=1, pwm=0) and run sensors several times in a row, with some delay between each run. Check if the (obviously wrong value) which is reported is the same each time, or not.

Quoted 1 line

Please, take a look at results_jean.txt

My code was obviously bogus, fan min was not preserved at all when changining fan div. I just took a look and have to say I'm a bit ashamed, since it was caused by... a misplaced parenthesis.

Fixed patch is available:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-beta3.diff
if you can please test again using the same script. Oh, BTW:

Quoted 8 lines
Quoted 5 lines

modprobe i2c_sensor
modprobe i2c-i801
modprobe i2c-isa
modprobe adm1025
modprobe smsc47m1

You don't need to explicitly modprobe i2c_sensor, it'll be loaded as needed automatically.

Forgive me for the giant quote.
You can see at j1 (jean.tar.bz2) directory, the results you asked
for. Please take a look.

Quoted 9 lines
Quoted 1 line

and results_jean_dump.txt.

Fan alarms are not set on the dump you sent, so there's nothing I can check. The case I'm interested in is when "sensors" show an alarm which you think should not be there. If you provide both the output of"sensors" and the dump at that instant, I may be able to check if sensors' output matches the registers dump or not. If you are not able to reproduce that corner case or are not worried about it, just forget about it, it's not critical.

Please, take a look at j2 (jean.tar.bz2) directory. There are the
tests you asked for. Oh, check if the .sh is ok to you.
I don't matter about the ALARMS. I just tried to give you
the more information I could.

Quoted 4 lines
Quoted 2 lines

From today, I can delay a little more to answer because I am back to college classes. (The end of vacation)

Oh, I wish you well then :)

So do I. Thank you. :-)

Quoted 4 lines
Quoted 1 line

P.S. My english is not good enough. :-)

Like mine is perfect? ;) Come on, you must be kidding, your English is honest to say the least. You have no idea what bad English is.

Well, if you are understanding what I write, it is fine. :-) Please, if you need more information, tell me.
I was wondering, are there some other things that can influence the
behaviour of sensors? I mean, that could be affecting the results?
Thanks.

Freitas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean.tar.bz2
Type: application/octet-stream
Size: 2275 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040803/45e281c7/jean.tar.obj

#15 lore raw
In reply to Jean Delvare
Quoted 2 lines

You can see at j1 (jean.tar.bz2) directory, the results you asked for. Please take a look.

Makes me think that fan speed stops being monitored when PWM is enabled and have value (duty cycle) 0. I would call it a design flaw since it will make the driver code more complex and becomes bogus if the fan being monitored and the fan being controled are not the same one (which is the case with somt revisions of that Intel board, it seems).

Nevermind, we'll have to handle this. Could you please try the following test to confirm my point?

echo 1 > fan2_pwm_enable
for i in 252 236 220 204 188 172 156 140 124 108 92 76 60 44 28 12 0 do
echo $i > fan2_pwm
sleep 4
cat fan2_input
done

I think I will have to force the fan reading to 0 when PWM is enabled and PWM value is 0, regardless of what the register holds.

Quoted 4 lines

Please, take a look at j2 (jean.tar.bz2) directory. There are the tests you asked for. Oh, check if the .sh is ok to you. I don't matter about the ALARMS. I just tried to give you the more information I could.

That one looks fine, min limit is preserved as it should :)

Quoted 3 lines

I was wondering, are there some other things that can influence the behaviour of sensors? I mean, that could be affecting the results?

Well, ambient temperature obviously affects the temperature readings. The heavy use of specific devices (such as the graphics adapter) may have an impact on voltage readings. For the rest, it shouldn't change unless you explicitely ask for it (changing PWM values, changing the CPU speed, etc...)

Thanks.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#16 lore raw
In reply to Jean Delvare

WARNING: This e-mail has been altered by MIMEDefang. Following this
paragraph are indications of the actual changes made. For more
information about your site's MIMEDefang policy, contact
andrew.net.au Postmaster <[email protected]>. For more information about MIMEDefang, see:

http://www.roaringpenguin.com/mimedefang/enduser.php3

An attachment named jean_1.sh was removed from this document as it constituted a security hazard. If you require this document, please contact the sender and arrange an alternate means of receiving it.

-------------- next part --------------

Quoted 21 lines
Quoted 2 lines

You can see at j1 (jean.tar.bz2) directory, the results you asked for. Please take a look.

Makes me think that fan speed stops being monitored when PWM is enabled and have value (duty cycle) 0. I would call it a design flaw since it will make the driver code more complex and becomes bogus if the fan being monitored and the fan being controled are not the same one (which is the case with somt revisions of that Intel board, it seems).

Nevermind, we'll have to handle this. Could you please try the following test to confirm my point?

echo 1 > fan2_pwm_enable
for i in 252 236 220 204 188 172 156 140 124 108 92 76 60 44 28 12 0 do
echo $i > fan2_pwm
sleep 4
cat fan2_input
done

Quoted 2 lines

I think I will have to force the fan reading to 0 when PWM is enabled and PWM value is 0, regardless of what the register holds.

The results are attached, including the shell script I used. I sent you the results for fan2, as you asked, and for fan1, because
fan2 here appears to be the CPU cooler. Anyway, using fan1 the corresponding fan was stopped at the end of the script. :-)

Quoted 6 lines
Quoted 4 lines

Please, take a look at j2 (jean.tar.bz2) directory. There are the tests you asked for. Oh, check if the .sh is ok to you. I don't matter about the ALARMS. I just tried to give you the more information I could.

That one looks fine, min limit is preserved as it should :)

It is a good thing. :-)

Quoted 9 lines
Quoted 3 lines

I was wondering, are there some other things that can influence the behaviour of sensors? I mean, that could be affecting the results?

Well, ambient temperature obviously affects the temperature readings. The heavy use of specific devices (such as the graphics adapter) may have an impact on voltage readings. For the rest, it shouldn't change unless you explicitely ask for it (changing PWM values, changing the CPU speed, etc...)

Ok. I was just wondering if some strange values could be the result
of some interference.
When you need more information, please, tell me. :-)

Thanks.

Freitas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean_results_for_fan1.txt
Type: application/octet-stream
Size: 58 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040804/8071008b/jean_results_for_fan1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean_results_for_fan2.txt
Type: application/octet-stream
Size: 85 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040804/8071008b/jean_results_for_fan2.obj

#17 lore raw
In reply to Jean Delvare
Quoted 5 lines

The results are attached, including the shell script I used. I sent you the results for fan2, as you asked, and for fan1, because fan2 here appears to be the CPU cooler. Anyway, using fan1 the corresponding fan was stopped at the end of the script. :-)

OK, so it must be working. I should have told you to set the fan clock divider to 8 before starting the test, but the results are still significant.

I've updated the driver:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-rc1.diff

It should now force the fan speed reading to 0 when PWM is enabled with a duty cycle of 0%. So for example the following sequence should work fine:

echo 0 > fan1_pwm_enable
echo 0 > fan1_pwm
sleep 4
cat fan1_input (should return 3000 or so)
echo 1 > fan1_pwm_enable (fan should stop)
sleep 3
cat fan1_input (should return 0)

With the previous version if would have returned the last known speed or some other random non-zero value (it seems) while the fan would clearly be stopped.

If you confirm that this version of the driver works fine for you, I'll submit it for incorporation into Greg's tree.

Quoted 2 lines

Ok. I was just wondering if some strange values could be the result of some interference.

Unless you refer to interference in the designers brains, I don't think so ;)

Thanks a lot for testing, it looks like we finally came to a working 2.6 driver.

Signature · 2 lines
Jean "Khali" Delvare
http://khali.linux-fr.org/
#18 lore raw
In reply to Jean Delvare

WARNING: This e-mail has been altered by MIMEDefang. Following this
paragraph are indications of the actual changes made. For more
information about your site's MIMEDefang policy, contact
andrew.net.au Postmaster <[email protected]>. For more information about MIMEDefang, see:

http://www.roaringpenguin.com/mimedefang/enduser.php3

An attachment named jean.sh was removed from this document as it constituted a security hazard. If you require this document, please contact the sender and arrange an alternate means of receiving it.

An attachment named jean_1.sh was removed from this document as it constituted a security hazard. If you require this document, please contact the sender and arrange an alternate means of receiving it.

An attachment named woops.sh was removed from this document as it constituted a security hazard. If you require this document, please contact the sender and arrange an alternate means of receiving it.

-------------- next part --------------
Jean,

Quoted 25 lines
Quoted 5 lines

The results are attached, including the shell script I used. I sent you the results for fan2, as you asked, and for fan1, because fan2 here appears to be the CPU cooler. Anyway, using fan1 the corresponding fan was stopped at the end of the script. :-)

OK, so it must be working. I should have told you to set the fan clock divider to 8 before starting the test, but the results are still significant.

I've updated the driver:
http://khali.linux-fr.org/devel/i2c/linux-2.6/linux-2.6.8-rc2-i2c-smsc47m1-rc1.diff

It should now force the fan speed reading to 0 when PWM is enabled with a duty cycle of 0%. So for example the following sequence should work fine:

echo 0 > fan1_pwm_enable
echo 0 > fan1_pwm
sleep 4
cat fan1_input (should return 3000 or so)
echo 1 > fan1_pwm_enable (fan should stop)
sleep 3
cat fan1_input (should return 0)

Quoted 3 lines

With the previous version if would have returned the last known speed or some other random non-zero value (it seems) while the fan would clearly be stopped.

patch -R -p1 beta3.diff
patch -p1 < rc1.diff
Worked. Compiled fine.
The tests above worked, as you can see at attached file (*rc1.txt).

Just for curiosity I tried to use 90 as fan1_pwm value. I opened the
case to confirm if fan was still running.
As you will see at *woops.txt (result of woops.sh), I found a
strange behaviour. I don't know if it is important, but I thought you should know.
I made another test (attached) trying to help.

Quoted 2 lines

If you confirm that this version of the driver works fine for you, I'll submit it for incorporation into Greg's tree.

I am trying to give you the best information I can, to help as much
as I can, but I am worried about disturbing you a lot.
I mean, I have never helped testing software like this, so I am
always thinking if I am being a problem more than a helper. :-)

Quoted 5 lines
Quoted 2 lines

Ok. I was just wondering if some strange values could be the result of some interference.

Unless you refer to interference in the designers brains, I don't think so ;)

Hahahahahahahahaha. :-D

Quoted 2 lines

Thanks a lot for testing, it looks like we finally came to a working 2.6 driver.

It is working here. My gkrellm is always showing my fans and voltages
(just vid does not appear there, but it doesn't matter). I am happy.
I noticed the behaviour above, but I don't know if it is important.
And, anyway, I can turn off my fan. :-)
As I say, I want to help, but I don't want to disturb you or became a
problem. When you fell it is ready, so it is ready. :-)
If you need more information, just tell me.
Thank you for coding the driver.

Cheers,

Cassio Freitas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean_is_running.txt
Type: application/octet-stream
Size: 24652 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040805/29ef13f4/jean_is_running.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean_results_rc1.txt
Type: application/octet-stream
Size: 7 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040805/29ef13f4/jean_results_rc1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jean_results_woops.txt
Type: application/octet-stream
Size: 4548 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20040805/29ef13f4/jean_results_woops.obj

#19 lore raw
In reply to Jean Delvare
Quoted 7 lines

Just for curiosity I tried to use 90 as fan1_pwm value. I opened the case to confirm if fan was still running.
As you will see at *woops.txt (result of woops.sh), I found a strange behaviour. I don't know if it is important, but I thought you should know.
I made another test (attached) trying to help.

I think that you refer to the fact that sometimes the driver will report 0 RPM while you can still see the fan (slowly) spin. This is a hardware design limitation, common to almost all hardware monitoring chipsets. This is not a problem in this specific driver.

Fan speeds are not measured directly. Instead, the chipsets will count how many cycles of a given clock can fit between two turns (or, partically, two half turns) of the fan. The result is stored in a register and some maths are needed to get the RPM value.

The problem here is that the registers are almost alwats 8-bit wide. This means that the greater count that can fit is 255. As a result, if the chipset uses for example a 1 MHz clock and the fan emits to ticks/revolution (standard), the lowest speed you can measure is 1000000/(2*255) = 1960 RPM

To allow for slower fan monitoring, chipsets can usually divide the source clock by 2, 4, 8 or even more. With a divider of 8, the lowest speed you can measure would be 1000000/(8*2*255) = 245 RPM which is far better. The drawback is that you then lose resolution on higher speeds, which is why the highest dividers are usually not used by default.

So you can try increasing the divider to 8 and should be able to monitor much slower fans.

The SMSC chips have the particularity that the fan min also influences the lowest measurable fan speed (for other chips, only the divider matters) so things are even more complex. For a clock of 983040*2 Hz, divider of 8, you should be able to specify the min speed down to 640 RPM. If you do, the lowest fan speed you will be able to measure is 483 RPM. Below this, the driver will return 0. If you set the min speed to 1000 RPM, the lowest fan speed you will be able to measure is 702 RPM.

You may read the SMSC LPC47M14x datasheet for calculation details if you are interested.

I plan to modifiy the driver at a later time so that it can select the best divider automatically. That way, the end user won't have to know anything about the internals. But for now I prefer to have the driver merged into the main tree. Improvements can be added later.

Quoted 4 lines

I am trying to give you the best information I can, to help as much as I can, but I am worried about disturbing you a lot.
I mean, I have never helped testing software like this, so I am always thinking if I am being a problem more than a helper. :-)

You do very well. I consider the testing over and will send the patch to Greg as soon as I am back home.

Quoted 1 line

Thank you for coding the driver.

Thanks again for testing :)

Jean Delvare