Kernel driver dell-smm-hwmon

Copyright:© 2002-2005 Massimo Dal Zotto <dz@debian.org>
Copyright:© 2019 Giovanni Mascellani <gio@debian.org>

Description

On many Dell laptops the System Management Mode (SMM) BIOS can bequeried for the status of fans and temperature sensors. Userspaceutilities likesensors can be used to return the readings. Theuserspace suitei8kutils can also be used to read the sensors andautomatically adjust fan speed (please notice that it currently usesthe deprecated/proc/i8k interface).

sysfs interface

Temperature sensors and fans can be queried and set via the standardhwmon interface onsysfs, under the directory/sys/class/hwmon/hwmonX for some value ofX (search for theX such that/sys/class/hwmon/hwmonX/name has contentdell_smm). A number of other attributes can be read or written:

NamePermDescription
fan[1-3]_inputROFan speed in RPM.
fan[1-3]_labelROFan label.
pwm[1-3]RWControl the fan PWM duty-cycle.
pwm1_enableWOEnable or disable automatic BIOS fancontrol (not supported on all laptops,see below for details).
temp[1-10]_inputROTemperature reading in milli-degreesCelsius.
temp[1-10]_labelROTemperature sensor label.

Disabling automatic BIOS fan control

On some laptops the BIOS automatically sets fan speed every fewseconds. Therefore the fan speed set by mean of this driver is quicklyoverwritten.

There is experimental support for disabling automatic BIOS fancontrol, at least on laptops where the corresponding SMM command isknown, by writing the value1 in the attributepwm1_enable(writing2 enables automatic BIOS control again). Even if you havemore than one fan, all of them are set to either enabled or disabledautomatic fan control at the same time and, notwithstanding the name,pwm1_enable sets automatic control for all fans.

Ifpwm1_enable is not available, then it means that SMM codes forenabling and disabling automatic BIOS fan control are not whitelistedfor your hardware. It is possible that codes that work for otherlaptops actually work for yours as well, or that you have to discovernew codes.

Check the listi8k_whitelist_fan_control in filedrivers/hwmon/dell-smm-hwmon.c in the kernel tree: as a firstattempt you can try to add your machine and use an already-known codepair. If, after recompiling the kernel, you see thatpwm1_enableis present and works (i.e., you can manually control the fan speed),then please submit your finding as a kernel patch, so that other userscan benefit from it. Please seeDocumentation/process/submitting-patches.rstfor information on submitting patches.

If no known code works on your machine, you need to resort to do someprobing, because unfortunately Dell does not publish datasheets forits SMM. You can experiment with the code inthis repository toprobe the BIOS on your machine and discover the appropriate codes.

Again, when you find new codes, we’d be happy to have your patches!

Module parameters

  • force:bool
    Force loading without checking for supportedmodels. (default: 0)
  • ignore_dmi:bool
    Continue probing hardware even if DMI data does notmatch. (default: 0)
  • restricted:bool
    Allow fan control only to processes with theCAP_SYS_ADMIN capability set or processes runas root when using the legacy/proc/i8kinterface. In this case normal users will be ableto read temperature and fan status but not tocontrol the fan. If your notebook is shared withother users and you don’t trust them you may wantto use this option. (default: 1, only availablewithCONFIG_I8K)
  • power_status:bool
    Report AC status in/proc/i8k. (default: 0,only available withCONFIG_I8K)
  • fan_mult:uint
    Factor to multiply fan speed with. (default:autodetect)
  • fan_max:uint
    Maximum configurable fan speed. (default:autodetect)

Legacy/proc interface

Warning

This interface is obsolete and deprecated and should notused in new applications. This interface is onlyavailable when kernel is compiled with optionCONFIG_I8K.

The information provided by the kernel driver can be accessed bysimply reading the/proc/i8k file. For example:

$ cat /proc/i8k1.0 A17 2J59L02 52 2 1 8040 6420 1 2

The fields read from/proc/i8k are:

1.0 A17 2J59L02 52 2 1 8040 6420 1 2|   |   |       |  | | |    |    | ||   |   |       |  | | |    |    | +------- 10. buttons status|   |   |       |  | | |    |    +--------- 9.  AC status|   |   |       |  | | |    +-------------- 8.  fan0 RPM|   |   |       |  | | +------------------- 7.  fan1 RPM|   |   |       |  | +--------------------- 6.  fan0 status|   |   |       |  +----------------------- 5.  fan1 status|   |   |       +-------------------------- 4.  temp0 reading (Celsius)|   |   +---------------------------------- 3.  Dell service tag (later known as 'serial number')|   +-------------------------------------- 2.  BIOS version+------------------------------------------ 1.  /proc/i8k format version

A negative value, for example -22, indicates that the BIOS doesn’treturn the corresponding information. This is normal on somemodels/BIOSes.

For performance reasons the/proc/i8k doesn’t report by defaultthe AC status since this SMM call takes a long time to execute and isnot really needed. If you want to see the ac status in/proc/i8kyou must explictitly enable this option by passing thepower_status=1 parameter to insmod. If AC status is notavailable -1 is printed instead.

The driver provides also an ioctl interface which can be used toobtain the same information and to control the fan status. The ioctlinterface can be accessed from C programs or from shell using thei8kctl utility. See the source file ofi8kutils for moreinformation on how to use the ioctl interface.