Skip to contentSkip to conversation

pwmconfig fix

DISCUSSION [email protected] 2 participants 8 messages May 19, 2005

lore
Share & tools
lore
#0 lore raw

Hi,

[little bug report + fix]

On my Asus P4P800 motherboard with a w83627thf sensor chip, pwmconfig from lm_sensors-2.8.6 doesn't detect the pwm-files by default (2.6.6-rc3, module w83627hf). This is the listing of /sys/devices/platform/i2c-1/1-0290:

alarms        fan2_input  in0_min    in3_max    in8_max         temp2_max
beep_enable   fan2_min    in0_ref    in3_min    in8_min         temp2_max_hyst
beep_mask     fan2_pwm    in1_input  in4_input  name            temp2_type
detach_state  fan3_div    in1_max    in4_max    power           temp3_input
fan1_div      fan3_input  in1_min    in4_min    temp1_input     temp3_max
fan1_input    fan3_min    in2_input  in7_input  temp1_max       temp3_max_hyst
fan1_min      fan3_pwm    in2_max    in7_max    temp1_max_hyst  temp3_type
fan1_pwm      in0_input   in2_min    in7_min    temp1_type      vrm
fan2_div      in0_max     in3_input  in8_input  temp2_input

As you can see the pwm files are called 'fan[1-9]_pwm'. Likewise for the fan inputs, which are called fan[1-9]_input.

After changing this in pwmconfig to take those files into account, your script worked. Thanks.

Regards,
Rutger.

Signature · 3 lines
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
#1 lore raw
Quoted 11 lines

[little bug report + fix]

On my Asus P4P800 motherboard with a w83627thf sensor chip, pwmconfig from lm_sensors-2.8.6 doesn't detect the pwm-files by default (2.6.6-rc3, module w83627hf).
(...)
As you can see the pwm files are called 'fan[1-9]_pwm'. Likewise for the fan inputs, which are called fan[1-9]_input.

After changing this in pwmconfig to take those files into account, your script worked. Thanks.

I've changed that, hopefully in the proper way. Thanks for reporting. Unfortunately I don't have pwm-capable system to test with here. Would you please be kind enough and checkout the latest CVS version of the script, and ensure it works OK?

Thanks again.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#2 lore raw
In reply to [email protected]
Quoted 12 lines · Jean Delvare
Quoted 11 lines

[little bug report + fix]

On my Asus P4P800 motherboard with a w83627thf sensor chip, pwmconfig from lm_sensors-2.8.6 doesn't detect the pwm-files by default (2.6.6-rc3, module w83627hf).
(...)
As you can see the pwm files are called 'fan[1-9]_pwm'. Likewise for the fan inputs, which are called fan[1-9]_input.

After changing this in pwmconfig to take those files into account, your script worked. Thanks.

Quoted 6 lines

I've changed that, hopefully in the proper way. Thanks for reporting. Unfortunately I don't have pwm-capable system to test with here. Would you please be kind enough and checkout the latest CVS version of the script, and ensure it works OK?

Thanks again.

Latest version of lm_sensors2? I did a fresh checkout of lm_sensors2 which didn't solve anything (cvs -d :pserver:[email protected]:/home/cvs checkout lm_sensors2).

Signature · 3 lines
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
#3 lore raw
In reply to [email protected]
Quoted 3 lines

Latest version of lm_sensors2? I did a fresh checkout of lm_sensors2 which didn't solve anything (cvs -d :pserver:[email protected]:/home/cvs checkout lm_sensors2).

Hm, that's bad :(

That said, I just realized that I fixed only pwmconfig, while fancontrol needed a change too. Just changed that. And I had missed some changes in pwmconfig as well. I should really have been more careful, sorry.

Care to test again? It should be better.

Thanks.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#4 lore raw
In reply to [email protected]
Quoted 11 lines · Jean Delvare
Quoted 3 lines

Latest version of lm_sensors2? I did a fresh checkout of lm_sensors2 which didn't solve anything (cvs -d :pserver:[email protected]:/home/cvs checkout lm_sensors2).

Hm, that's bad :(

That said, I just realized that I fixed only pwmconfig, while fancontrol needed a change too. Just changed that. And I had missed some changes in pwmconfig as well. I should really have been more careful, sorry.

Care to test again? It should be better.

Ok, doing better now. Output attached.

Found the following PWM controls:
1-0290/fan1_pwm
1-0290/fan2_pwm
1-0290/fan3_pwm

Found the following fan sensors:

   1-0290/fan1_input     current speed: 0 ... skipping!
   1-0290/fan2_input     current speed: 2667 RPM
   1-0290/fan3_input     current speed: 0 ... skipping!

Testing pwm control 1-0290/fan1_pwm ...
1-0290/fan2_input ... speed was 2667 now 2700
no correlation

Testing pwm control 1-0290/fan2_pwm ...
1-0290/fan2_input ... speed was 2667 now 0
It appears that fan 1-0290/fan2_input
is controlled by pwm 1-0290/fan2_pwm
Would you like to generate a detailed correlation (y)? Would you like to generate a graphical plot using gnuplot (y)?

    PWM 255 FAN 2689
    PWM 240 FAN 2689
    PWM 225 FAN 0
    Fan Stopped at PWM = 225
    Hit return to continue...

Testing pwm control 1-0290/fan3_pwm ...
1-0290/fan2_input ... speed was 2667 now 2667
no correlation

The problem is fan2_pwm, where only 3 samples are taken. This is not enough in this case.

Bug in script:
Line 242:

		if [ "$S" = "0" -o "S" = "-1" ]

Shouldn't "S" be "$S" ?

pwmconfig delivers quite a dull gnuplot, but I do not understand the relation between the _pwm value and the fan speed myself.

Problems:
- at pwm 240, the fan speed reported in 0 while I still hear it turning.
- at pwm 200, is goes even faster than at 255, and it reports 3139 as rpm(!).

It appears the speed is also depending on the speed from which it came. Doing
echo 255 >fan2_pwm; sleep 2; echo 200 >fan2_pwm
will give me +-3100, while doing
echo 0 >fan2_pwm; sleep 2; echo 200 >fan2_pwm
will give me 0. Strange...

Where do I report such strange interaction?

Signature · 3 lines
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
#5 lore raw
In reply to [email protected]
Quoted 6 lines · Jean Delvare
Quoted 2 lines

The problem is fan2_pwm, where only 3 samples are taken. This is not enough in this case.

Most likely because you have a low fan divisor. Try increasing it and try again. You need a high divisor to be able to measure low speed fans, and lowering PWM lowers fan speed.

Ok, fan_divisor set to 64 and reran pwmconfig. I get a better curve now:

    PWM 255 FAN 2636
    PWM 240 FAN 3013
    PWM 225 FAN 2343
    PWM 210 FAN 2343
    PWM 195 FAN 2109
    PWM 180 FAN 1917
    PWM 165 FAN 1622
    PWM 150 FAN 1406
    PWM 135 FAN 1917
    PWM 120 FAN 1506
    PWM 105 FAN 1406
    PWM 90 FAN 1240
    PWM 75 FAN 0
Quoted 1 line

Maybe the script could take care of this?

Why not take the highest working divisor? You can check this I think by re-reading the fan*_div after echoing a new value. At least, that's what I did...

Quoted 7 lines
Quoted 2 lines

- at pwm 200, is goes even faster than at 255, and it reports 3139 as rpm(!).

Admittedly strange. Possibly some emergency mode of the chip. I don't know about the W83627HF, but I know similar chips with that functionality. On alert conditions (overtemperature...) manual PWM is disabled and fans are forced to full speed.

No, it's not the full speed. Some combinations entered manual give even higher values: I can get to 3500rpm.

Quoted 10 lines
Quoted 7 lines

It appears the speed is also depending on the speed from which it came. Doing
echo 255 >fan2_pwm; sleep 2; echo 200 >fan2_pwm
will give me +-3100, while doing
echo 0 >fan2_pwm; sleep 2; echo 200 >fan2_pwm
will give me 0. Strange...

No wonder to me. Fans have inertia, it's natural that the "original" speeds has an influence.

No, I monitor the RPMs with
while true; do cat fan2_input; sleep 2; done

Now I echo values in another xterm, and I see the fan stabilizing to different values depending on the sequence of value which I echo-d. So there is some kind of state somewhere.

So, in short:
echo 0 >fan2_pwm; sleep 5; echo 199 >fan2_pwm; sleep 5; cat fan2_input ..gives values 1917 and 2109 repeatedly.
echo 255 >fan2_pwm; sleep 5; echo 199 >fan2_pwm; sleep 5; cat fan2_input ..gives values 3013 and 3515 repeatedly. The fan also sounds 'faster'.

I can get to 4218rpm, which is very noisy..

Quoted 5 lines
Quoted 1 line

Where do I report such strange interaction?

Doesn't sound that strange to me. That said, I think that Marius is the most qualified of us all with PWM issues, so he's the one you want to address your questions to, if there's really a problem.

Ok, Marius left in the header...

Regards,
Rutger.

Signature · 3 lines
Rutger Nijlunsing ---------------------------- rutger ed tux tmfweb nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
#6 lore raw
In reply to [email protected]
Quoted 3 lines
Quoted 1 line

Care to test again? It should be better.

Ok, doing better now. Output attached.

Great :)

Quoted 9 lines

Found the following PWM controls:

   1-0290/fan1_pwm
   1-0290/fan2_pwm
   1-0290/fan3_pwm

Found the following fan sensors:

   1-0290/fan1_input     current speed: 0 ... skipping!
   1-0290/fan2_input     current speed: 2667 RPM
   1-0290/fan3_input     current speed: 0 ... skipping!

OK, so at least it finds the files. This is what the change was all about.

Quoted 16 lines

Testing pwm control 1-0290/fan1_pwm ...
1-0290/fan2_input ... speed was 2667 now 2700
no correlation

Testing pwm control 1-0290/fan2_pwm ...
1-0290/fan2_input ... speed was 2667 now 0
It appears that fan 1-0290/fan2_input
is controlled by pwm 1-0290/fan2_pwm
Would you like to generate a detailed correlation (y)? Would you like to generate a graphical plot using gnuplot (y)?

    PWM 255 FAN 2689
    PWM 240 FAN 2689
    PWM 225 FAN 0
    Fan Stopped at PWM = 225
    Hit return to continue...
Quoted 6 lines

Testing pwm control 1-0290/fan3_pwm ...
1-0290/fan2_input ... speed was 2667 now 2667
no correlation

The problem is fan2_pwm, where only 3 samples are taken. This is not enough in this case.

Most likely because you have a low fan divisor. Try increasing it and try again. You need a high divisor to be able to measure low speed fans, and lowering PWM lowers fan speed.

Maybe the script could take care of this?

Quoted 4 lines

Bug in script:
Line 242:

		if [ "$S" = "0" -o "S" = "-1" ]

Shouldn't "S" be "$S" ?

Correct, nice catching. I've fixed it, thanks.

Quoted 3 lines

Problems:
- at pwm 240, the fan speed reported in 0 while I still hear it turning.

Same reason: fan divisor must be too low.

Quoted 2 lines

- at pwm 200, is goes even faster than at 255, and it reports 3139 as rpm(!).

Admittedly strange. Possibly some emergency mode of the chip. I don't know about the W83627HF, but I know similar chips with that functionality. On alert conditions (overtemperature...) manual PWM is disabled and fans are forced to full speed.

Quoted 6 lines

It appears the speed is also depending on the speed from which it came. Doing
echo 255 >fan2_pwm; sleep 2; echo 200 >fan2_pwm
will give me +-3100, while doing
echo 0 >fan2_pwm; sleep 2; echo 200 >fan2_pwm
will give me 0. Strange...

No wonder to me. Fans have inertia, it's natural that the "original" speeds has an influence.

Quoted 1 line

Where do I report such strange interaction?

Doesn't sound that strange to me. That said, I think that Marius is the most qualified of us all with PWM issues, so he's the one you want to address your questions to, if there's really a problem.

Thanks.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#7 lore raw
In reply to [email protected]
Quoted 3 lines

Why not take the highest working divisor? You can check this I think by re-reading the fan*_div after echoing a new value. At least, that's what I did...

Because a higher divisor means a poor accuracy at higher speeds. The divisor is really a range vs. accuracy tradeoff. Read doc/fan-divisor for details, or doc/chips/pc87366 (in CVS).

Quoted 6 lines

No, it's not the full speed. Some combinations entered manual give even higher values: I can get to 3500rpm.
(...)
Now I echo values in another xterm, and I see the fan stabilizing to different values depending on the sequence of value which I echo-d. So there is some kind of state somewhere.

OK, that's strange ;)

PWM isn't as easy as it seems to be. The modulations are made on a base frequency. Maybe you fan doesn't like this frequency and behaves strangely because of that. Usually, drivers don't allow the user to tweak the frequency, but most chips are able to change it. Read the datasheet for your chip and try changing the value manually (using isaset or i2cset), maybe it'll help.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/