# have pwm but can't set fan speed [solved]

## discowombat

I'm using i2c and all the usual sensors stuff to monitor temperature and fans, etc, but I can't change my fan speed.  I'm using w83637hf and have the following in the appropriate /sys folder:

```

jonny@tuxbox /sys/devices/platform/i2c-9191/9191-0290 $ ls

alarms       fan1_input  fan3_min      in1_min    in4_input  in8_max  temp1_input     temp2_type

beep_enable  fan1_min    hwmon:hwmon0  in2_input  in4_max    in8_min  temp1_max       temp3_input

beep_mask    fan2_div    in0_input     in2_max    in4_min    name     temp1_max_hyst  temp3_max

bus          fan2_input  in0_max       in2_min    in7_input  power    temp1_type      temp3_max_hyst

cpu0_vid     fan2_min    in0_min       in3_input  in7_max    pwm1     temp2_input     temp3_type

driver       fan3_div    in1_input     in3_max    in7_min    pwm2     temp2_max       uevent

fan1_div     fan3_input  in1_max       in3_min    in8_input  pwm3     temp2_max_hyst  vrm

```

I have 3 pwm devices listed, but changing the values does absolutely nothing.  There is no error upon changing the values, but the files retain their previous values.  Using pwmconfig to auto-detect the pwm finds them but doesn't stop any fans, so it claims that my fans must not be plugged into the pwm.  However, they are 3 wire fans and I can control them using SpeedFan under Windoze.  The pwm type must be set to manual rather than thermal cruising or whatever they call it for it to work in SpeedFan though.

Any ideas how to make this work under linux?  I've searched fairly extensively and the only answer i've seen is that the fan was not connected to the PWM, which i know isn't the case here.

I have a sony vaio desktop, and I can't control the fan thru ACPI, nothing shows up there.  I've tried both the 2.6.14 and 2.6.15 kernels, and have sensors version 2.9.2 with libsensors version 2.9.2.

Let me know if there's anything else useful that I can post, or if anybody has any ideas for me to try.

----------

## mbar

EDIT: Sorry, I think that sensor chip does not have pwm implemented in kernel driver.

----------

## bollucks

The pwm1 I can control on mine also has a file called pwm1_enable which I have to set first. Looks like yours is not software adjustable in linux (yet).

----------

## discowombat

The lm_sensors site doesn't say that it has any issues with the pwm, and the driver has been around for long enough that you'd think a half-completed pwm implementation would be either finished or made mention of.  Winbond makes their specs available, so if they found the right bits for the pwm value, I'd assume they could find the right ones to enable the pwm too.

I guess the next thing to do is to enable the debugging messages relating to i2c in the kernel and see if they have anything to say when i try to change the pwm* values in /sys.  Maybe i'll get an error or a definite something to the effect of Not Implemented.

bollucks, are you using w83637hf or another chip driver?  It looks like which /sys files you get depends on what driver you're using.

----------

## discowombat

Well, i've got the issue solved... ish.  Debug mode was woefully silent, but I discovered the isadump and isaset commands, along with a PDF of the official specs for this chip.  It told me which register contained the pwm mode, so I could change it between manual, thermal cruise, and fan speed cruise by using isaset and flipping the proper bits myself.  Once it is in manual mode, changing the pwm values in /sys actually worked.  So while the driver doesn't seem to provide a /sys interface to change modes, it was a simple task for me to create a shell script to switch between modes.  That's good enough for me.

----------

## tnt

 *discowombat wrote:*   

> Well, i've got the issue solved... ish.  Debug mode was woefully silent, but I discovered the isadump and isaset commands, along with a PDF of the official specs for this chip.  It told me which register contained the pwm mode, so I could change it between manual, thermal cruise, and fan speed cruise by using isaset and flipping the proper bits myself.  Once it is in manual mode, changing the pwm values in /sys actually worked.  So while the driver doesn't seem to provide a /sys interface to change modes, it was a simple task for me to create a shell script to switch between modes.  That's good enough for me.

 

Well great!

Could you share your scritps witsh us or at least give us PDF with specs and/or register that should be altered?

----------

## discowombat

no problem...

I forget where the PDF was, but I got it off the official WinBond site.  Here are the actual commands I used...

To set your pwm to allow manual speed setting (Allows you to change the values in the /sys pwm files):

```

isaset -y 0x0295 0x0296 0x04 0x00

```

To set it to "thermal cruise" (which sounds like it would set your fan speed automatically based on temperature, but doesn't do anything on mine):

```

isaset -y 0x0295 0x0296 0x04 0x14

```

Drop those into shell scripts, put them in your local.start, or whatever you want to do with them.

USE AT YOUR OWN RISK!  Blindly setting isa values can cause Bad Things to happen.  Use 

```

isadump 0x295 0x296

```

to see what you're actually changing.  And make sure you do have a winbond chip, or else who knows what you're setting.

----------

## tnt

Thank you very much!

One more question: are those addresses (register) for changing pwm1, pwm2 or pwm3 ?

(guess there are separate registers fore each one)

----------

## discowombat

Actually, there are only 2 PWM's implemented on the chip.  The 3rd fan doesn't get controlled by a pwm, my fan only has 2 wires going to it.  Both have their modes set in the 0x04 register.  Bits 5-4 set the mode for PWM 2 and bits 3-2 set the mode for PWM 1.  A value of 00 is manual, and 01 is thermal cruising.  Thus, setting the register to 0 (assuming the rest of the bits should be 0, as it is in my case) will set both PWM's into manual mode.  Setting both to 01 gives a value of 00010100, giving 20 or 0x14 to put both into thermal cruise.  If you wanted fan speed cruise instead, that value is 10, giving a register value of 00101000, or 40, or 0x28.  If you want to see what you're currently set at, use the isadump command of my previous post and look at your value, convert it to binary, and see what bits you have set.  If you'd like to see these specs in more detail yourself, or see what else you can change, I found the PDF at http://www.winbond.com/e-winbondhtm/partner/PDFResult.asp?Pname=886.  Look near page 69, as numbered in the pdf, for the above information.

----------

## tnt

Your settup ('isaset -y 0x0295 0x0296 0x04 0x00') did the trick.

Thank you once more!

----------

