You are not logged in.

#1 2012-05-01 15:48:22

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Help Writing Thinkfan 0.8 Complex Configuration.

Hi,

Previously, Thinkfan 0.7 has used a simple configuration and now version 0.8 has switched to complex configuration.

0. I have a Lenovo Thinkpad T420i (4177-CTO).

1. Location of following sensor keeps on changing. It changes from hwmon0 to hwmon1 and back to hwmon0 which makes thinkfan fail and run at 3XXX RPM. How can I fix it?

sensor /sys/devices/virtual/hwmon/hwmon0/temp1_input
OR
sensor /sys/devices/virtual/hwmon/hwmon1/temp1_input

2. Coming back to complex configuration first step is specify temperature inputs

# This file shows how to use sensor-specific temperature limits.
# First of all, you need to specify temperature inputs. On a Thinkpad, you can
# just use:
#
sensor /proc/acpi/ibm/thermal  # provides us with 16 temperature inputs
 
# On other systems, you have to specify a file in /sys/class/hwmon for each
# sensor you want to use. They are numbered in their order of appearance.
# For example:
# sensor /sys/class/hwmon5/temp2_input           #1
# sensor /sys/class/hwmon0/device/temp3_input    #2
sensor /proc/acpi/ibm/thermal
bash:sensor command not found

The way I get my sensors is using following command from thinkwiki.

find /sys/devices -type f -name "temp*_input"
/sys/devices/platform/coretemp.0/temp1_input
/sys/devices/platform/coretemp.0/temp2_input
/sys/devices/platform/coretemp.0/temp3_input
/sys/devices/virtual/hwmon/hwmon1/temp1_input

3. Next section is as following.

# Next we specify the fan we want to use. On a Thinkpad, this is:
#
fan /proc/acpi/ibm/fan

#
# On anything other than a Thinkpad you'll probably use some PWM control file
# in /sys/class/hwmon. Remember that fan levels range from 0 to 255 and that
# they're just a number, not including the word "level" as seen below.
fan /proc/acpi/ibm/fan
bash: fan: command not found

4. Now the temperature table.

# Sensor count:
#    1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16
######################################################
{ "level 0"                                               # the fan level
    (0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0)      # LOWER limit
    (54 42 42 54 42 .  42 .  42 46 54 .  .  .  .  .)      # UPPER limit
}

{ "level 1"
    (46 39 39 48 39 .  39 .  41 44 46 .  .  .  .  .)
    (58 45 45 60 45 .  45 .  45 47 56 .  .  .  .  .)
}

{ "level 3"
    (52 43 43 57 43 .  43 .  43 45 51 .  .  .  .  .)
    (62 48 48 67 48 .  48 .  48 48 57 .  .  .  .  .)
}

{ "level 5"
    (56 46 46 65 46 .  46 .  46 46 52 .  .  .  .  .)
    (66 49 49 69 49 .  49 .  49 49 58 .  .  .  .  .)
}

{ "level 7"
    (63 47 47 67 47 .  47 .  47 47 50 .  .  .  .  .)
    (73 55 55 83 60 .  60 .  60 60 64 .  .  .  .  .)
}

{ "level disengaged" # nice idea: "level auto" can also be used.
    (69 50 50 75 55 .  55 .  55 55 55 .  .  .  .  .)
    (99 99 99 99 99 .  99 .  99 99 99 .  .  .  .  .)
}

If I understand correctly, sensor count in my case is going to be 4 unlike the author's 16. How can I ascertain appropriate temperature limits for each sensor?

Thank You.

PS: Sorry for the long post. I can remove quote to shorten the post as I have already linked to the sample files, if moderator find it inappropriate.

Offline

#2 2012-05-07 05:09:12

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Help Writing Thinkfan 0.8 Complex Configuration.

No help??

Offline

#3 2012-06-07 21:35:22

mloskot
Member
From: London, United Kingdom
Registered: 2012-06-01
Posts: 86
Website

Re: Help Writing Thinkfan 0.8 Complex Configuration.

Hi,

Your post is fairly dated, but I've just found it. As a user of T400, it's an intersting question to me.
I installed Arch a few days ago and I've been researching the ACPI capabilities for it, so it's good to collect some notes here.

donniezazen wrote:

0. I have a Lenovo Thinkpad T420i (4177-CTO).

I have Lenovo Thinkpad T400, and I've just started playing with thinkfan tool.

donniezazen wrote:

1. Location of following sensor keeps on changing. It changes from hwmon0 to hwmon1 and back to hwmon0 which makes thinkfan fail and run at 3XXX RPM. How can I fix it?

As explained in hwmon[0-3] not persistent, changes after reboot as well as in Ubuntu's thread hwmon0 and hwmon1 switch at boot, try to identify and blacklist related modules.

donniezazen wrote:

2. Coming back to complex configuration first step is specify temperature inputs

The method from the ThinkWiki looks OK and should work, assuming you have the hwmon[0-3] paths persistent.

donniezazen wrote:

3. Next section is as following.

fan /proc/acpi/ibm/fan
bash: fan: command not found

Check if you have thinkpad_acpi module loaded and configured:

$ grep ^MODULES /etc/rc.conf
MODULES=(thinkpad_acpi processor sbs thermal snd-usb-audio fuse)

$ cat /etc/modprobe.d/thinkpad_acpi.conf 
options thinkpad_acpi fan_control=1
donniezazen wrote:

4. Now the temperature table.
If I understand correctly, sensor count in my case is going to be 4 unlike the author's 16.
How can I ascertain appropriate temperature limits for each sensor?

Here is quote from Thermal Sensors article at ThinkWiki:

The primary means of accessing the thermal sensors is through the thinkpad-acpi module, up to 16 sensors are supported.

So, it is not uncommon to have less than 16. My T400 reports this (-128/-1indicates missing/inactive sensor):

$ cat /proc/acpi/ibm/thermal 
temperatures:	45 46 32 -1 52 -128 33 -128 37 46 39 -128 -128 -128 -128 -128

I hope it helps.


Mateusz Loskot | github | archlinux-config
Arch (x86-64) | ThinkPad T400  | Intel P8600| Intel i915
Arch (x86-64) | ThinkPad W700 | Intel T9600 | NVIDIA Quadro FX 2700M

Offline

#4 2012-06-07 21:42:00

count0
Member
Registered: 2011-09-28
Posts: 20

Re: Help Writing Thinkfan 0.8 Complex Configuration.

mloskot,

Sorry to derail, but is the thinkfan utility absolutely needed? The reason I ask is that I have an r400, and I think the thinkpad_acpi module adjust the fan speed out-of-the-box depending on whether it's plugged in or not. Can you confirm this?

Offline

#5 2012-06-07 23:22:09

mloskot
Member
From: London, United Kingdom
Registered: 2012-06-01
Posts: 86
Website

Re: Help Writing Thinkfan 0.8 Complex Configuration.

count0 wrote:

I think the thinkpad_acpi module adjust the fan speed out-of-the-box depending on whether it's plugged in or not. Can you confirm this?

Yes, you're thinking is correct.

As long as the ThinkWiki is correct, we can trust the firmware's fan algorithm as it is explained in How to control fan speed:

In automatic mode, the embedded controller sets the fan speed automatically according to system temperatures and some unknown algorithm.

It works for me too:


[root@dog ~]# /etc/rc.d/thinkfan start
:: Starting thinkfan                                                         [DONE] 
[root@dog ~]# cat /proc/acpi/ibm/fan | egrep '^(status|speed|level)'
status:		enabled
speed:		2968
level:		4

[root@dog ~]# /etc/rc.d/thinkfan stop
:: Stopping thinkfan                                                         [DONE] 
[root@dog ~]# cat /proc/acpi/ibm/fan | egrep '^(status|speed|level)'
status:		enabled
speed:		2970
level:		auto

However, thinkfan and other similar utilities are used to gain more control over fan, to refine temperature and speed levels, etc.

To get more control, one needs to switch this capability in the thinkpad_acpi module with option:

fan_control=1

and then use favourite utility to contorl the fan.

One of simplest tools is a two-liner function in bash (from Mixu's blog How to: thinkpad_acpi and fan control on Arch) put in .bashrc:

function fan() {
  sensors
  echo level $@ | sudo tee /proc/acpi/ibm/fan
}

Then you can manually set fan level (speed):

$ fan 7

There is a nice feaure of such manual control - you can temporarily boost fan speed if you need. Switch to disengaged mode:

$ fan disengaged

and watch the fan speed and mode for 10-20 seconds:

$ watch cat /proc/acpi/ibm/fan

Quick test on my T400, fan gradually gained speed:

status:         enabled
speed:          4738
level:          disengaged

and automatically turned into this after 10-15 seconds:

status:         enabled
speed:          2893
level:          auto

I hope it makes sense.

Last edited by mloskot (2012-06-07 23:33:03)


Mateusz Loskot | github | archlinux-config
Arch (x86-64) | ThinkPad T400  | Intel P8600| Intel i915
Arch (x86-64) | ThinkPad W700 | Intel T9600 | NVIDIA Quadro FX 2700M

Offline

#6 2012-06-08 02:24:54

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Help Writing Thinkfan 0.8 Complex Configuration.

@count0 Thinkpad_acpi module runs fan at auto level which makes it run at 3XXX RPM irrespective of low or high temperature. Using a fan control mechanism will make my system more quietly. At the moment my system runs at minimum 2XXX using thinkfan and even a slight jump in temp between range 50-60 will spike noisy fan from 2XXX to 4XXX. I would like to keep my system quite at a safe temp. My understanding is anything under 60C for overall system and 45C for hard drive is safe.

@mloskot I load thinkpad_acpi tp_smapi through rc.conf module section and coretemp is detected by sensors-detect and started through sensors daemon. I think all three are required and I do not know if blacklisting anyone will be helpful or necessary.

Basic Info

grep ^MODULES /etc/rc.conf
MODULES=(thinkpad_acpi tp_smapi usblp fuse)
cat /etc/modprobe.d/modprobe.conf
options thinkpad_acpi fan_control=1

Back to complex configuration. I think I figured it out. Their are three steps in setting complex configuration.

1. Sensors.

/proc/acpi/fan/thermal is now depricated and removed. It is not available in my system. I just need sensors. I use following command from thinkwiki.

find /sys/devices -type f -name "temp*_input"
/sys/devices/platform/coretemp.0/temp1_input
/sys/devices/platform/coretemp.0/temp2_input
/sys/devices/platform/coretemp.0/temp3_input
/sys/devices/virtual/hwmon/hwmon1/temp1_input

2. Fan.
This works our of box.

fan /proc/acpi/ibm/fan

   

3. Temperature Limits.

# Then you need to specify the temperature limits for each of the sensors.
# A dot means that the corresponding sensor should be ignored. The length of the
# UPPER and LOWER limits must be the same as the number of temperatures. In this
# example, /proc/acpi/ibm/thermal contains 16 sensors (on older thinkpads,
# there may be only 8), some of which are unused (hence the dots).
# A sysfs temperature input always contains only one sensor, so if you specify
# 5 sysfs files above, the length of your limits must be 5, too.
#
# I've come up with these preliminary settings for my Thinkpad T61p. They probably
# don't make sense for anything else, so you most definitely have to work
# something out for yourself.
#
# Sensor count:
#    1  2  3  4  
######################################################
{ "level 0"            # the fan level
    (0   0   0   0)   # LOWER limit
    (54 42 42 54)   # UPPER limit
}

{ "level 1"
    (46 39 39 48)
    (58 45 45 60)
}

{ "level 3"
    (52 43 43 57)
    (62 48 48 67)
}

{ "level 5"
    (56 46 46 65)
    (66 49 49 69)
}

{ "level 7"
    (63 47 47 67)
    (73 55 55 83)
}

{ "level disengaged" # nice idea: "level auto" can also be used.
    (69 50 50 75)
    (99 99 99 99)
}

Problems
1. I need to figure out which sensor is for which chip/hardrive to set appropriate temperature limits.
2. I need to fix hwmon problem to this file remains valid and I take account of the chips/sensors temperature values.

I am not sure how these temperatures are set. For example, level 0 upper limit is 54 and for level 1 lower limit for same sensor is 46, what level is the fan running between 46-54. If it steps up to level 1 at 46 what does it mean to have level 0 lower limit 54. Why not keep it simple 0-46 then 46-54 and so on.

This quick config is of course doesn't make any sense of my system but it works.

Thanks for reviving this thread.

Last edited by donniezazen (2012-06-08 02:33:32)

Offline

#7 2012-06-14 06:27:42

donniezazen
Member
From: Salt Lake City
Registered: 2011-06-24
Posts: 671
Website

Re: Help Writing Thinkfan 0.8 Complex Configuration.

I found this article which suggests setting daemon arguments to following to avoid  increased fan speed because momentary increase in temperature.

DAEMON_ARGS="-q -b 2"

Offline

Board footer

Powered by FluxBB