[lm-sensors] PWMconfig problem with Asus P5B Deluxe / Winbond 83627DHG
Alexander Kiel
alexanderkiel at gmx.net
Fri Nov 16 00:15:21 CET 2007
Hi David,
> I understand the problem now. In the w83627ehf driver, there is this code:
> static ssize_t
> store_pwm_enable(struct device *dev, struct device_attribute *attr,
> const char *buf, size_t count)
>
> ...
>
> if (!val || (val > 2)) /* only modes 1 and 2 are supported */
> return -EINVAL;
>
> That is the "write error: invalid argument" error. The reason this
> code rejects a write of 0 to pwm_enable is because the w83627ehf does
> not have a true "disable" mode. Some other chips will set the pwm
> output to 100% when they are disabled. The w83627ehf doesn't have a
> disable mode. Of course, setting it to manual and storing 255 in the
> pwm would do the same thing.
>
> That's what pwmconfig (lm_sensors version 2.10.4) does:
> # Try pwmN_enable=0
> echo 0 > $ENABLE 2> /dev/null
> if [ "`cat $ENABLE`" -eq 0 ]
> then
> # Success
> return 0
> fi
>
> # It didn't work, try pwmN_enable=1 pwmN=255
> echo 1 > $ENABLE 2> /dev/null
> echo $MAX > $1
> if [ "`cat $ENABLE`" -eq 1 -a "`cat $1`" -ge 190 ]
> then
> # Success
> return 0
> fi
>
> So I *think* the problem is in pwmconfig. But yes, manually writing 0
> to pwm_enable will give you an -EINVAL.
>
> To be completely honest, I haven't run pwmconfig in a while. I know it
> generally works, but someone should probably post a patch to get it to
> work smoothly with w83627ehf and w83627dhg chips. (I could do that...
> given lots of time :-)
Ok the problem with pwmconfig is the following:
echo 0 > $ENABLE 2> /dev/null outputs actually 0. This is the 0 from the
echo. echo 3 > $ENABLE 2> /dev/null would output 3. I have no clue why
this is the case.
This 0 causes the line echo $MAX > $1 to set pwm1 to 0 instead of 255.
If I add a > /dev/null to the line echo 0 > $ENABLE 2> /dev/null it
works as it should.
So the diff is:
----------------------------------------------------------------------
127c127
< echo 0 > $ENABLE > /dev/null 2> /dev/null
---
> echo 0 > $ENABLE 2> /dev/null
----------------------------------------------------------------------
Can you submit this patch? I don't have a reasonable access to the
lm-sensors community.
Second: Can you please tell me what echo 2 > pwm1_enable does on this
chip? Is it an chip automatic fan control? It works great for me. It
puts my fan currently to a 155.
Regards
Alex
More information about the lm-sensors
mailing list