1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0-or-later 2*4882a593Smuzhiyun 3*4882a593Smuzhiyun.. include:: <isonum.txt> 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunKernel driver dell-smm-hwmon 6*4882a593Smuzhiyun============================ 7*4882a593Smuzhiyun 8*4882a593Smuzhiyun:Copyright: |copy| 2002-2005 Massimo Dal Zotto <dz@debian.org> 9*4882a593Smuzhiyun:Copyright: |copy| 2019 Giovanni Mascellani <gio@debian.org> 10*4882a593Smuzhiyun 11*4882a593SmuzhiyunDescription 12*4882a593Smuzhiyun----------- 13*4882a593Smuzhiyun 14*4882a593SmuzhiyunOn many Dell laptops the System Management Mode (SMM) BIOS can be 15*4882a593Smuzhiyunqueried for the status of fans and temperature sensors. Userspace 16*4882a593Smuzhiyunutilities like ``sensors`` can be used to return the readings. The 17*4882a593Smuzhiyunuserspace suite `i8kutils`__ can also be used to read the sensors and 18*4882a593Smuzhiyunautomatically adjust fan speed (please notice that it currently uses 19*4882a593Smuzhiyunthe deprecated ``/proc/i8k`` interface). 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun __ https://github.com/vitorafsr/i8kutils 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun``sysfs`` interface 24*4882a593Smuzhiyun------------------- 25*4882a593Smuzhiyun 26*4882a593SmuzhiyunTemperature sensors and fans can be queried and set via the standard 27*4882a593Smuzhiyun``hwmon`` interface on ``sysfs``, under the directory 28*4882a593Smuzhiyun``/sys/class/hwmon/hwmonX`` for some value of ``X`` (search for the 29*4882a593Smuzhiyun``X`` such that ``/sys/class/hwmon/hwmonX/name`` has content 30*4882a593Smuzhiyun``dell_smm``). A number of other attributes can be read or written: 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun=============================== ======= ======================================= 33*4882a593SmuzhiyunName Perm Description 34*4882a593Smuzhiyun=============================== ======= ======================================= 35*4882a593Smuzhiyunfan[1-3]_input RO Fan speed in RPM. 36*4882a593Smuzhiyunfan[1-3]_label RO Fan label. 37*4882a593Smuzhiyunpwm[1-3] RW Control the fan PWM duty-cycle. 38*4882a593Smuzhiyunpwm1_enable WO Enable or disable automatic BIOS fan 39*4882a593Smuzhiyun control (not supported on all laptops, 40*4882a593Smuzhiyun see below for details). 41*4882a593Smuzhiyuntemp[1-10]_input RO Temperature reading in milli-degrees 42*4882a593Smuzhiyun Celsius. 43*4882a593Smuzhiyuntemp[1-10]_label RO Temperature sensor label. 44*4882a593Smuzhiyun=============================== ======= ======================================= 45*4882a593Smuzhiyun 46*4882a593SmuzhiyunDisabling automatic BIOS fan control 47*4882a593Smuzhiyun------------------------------------ 48*4882a593Smuzhiyun 49*4882a593SmuzhiyunOn some laptops the BIOS automatically sets fan speed every few 50*4882a593Smuzhiyunseconds. Therefore the fan speed set by mean of this driver is quickly 51*4882a593Smuzhiyunoverwritten. 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunThere is experimental support for disabling automatic BIOS fan 54*4882a593Smuzhiyuncontrol, at least on laptops where the corresponding SMM command is 55*4882a593Smuzhiyunknown, by writing the value ``1`` in the attribute ``pwm1_enable`` 56*4882a593Smuzhiyun(writing ``2`` enables automatic BIOS control again). Even if you have 57*4882a593Smuzhiyunmore than one fan, all of them are set to either enabled or disabled 58*4882a593Smuzhiyunautomatic fan control at the same time and, notwithstanding the name, 59*4882a593Smuzhiyun``pwm1_enable`` sets automatic control for all fans. 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunIf ``pwm1_enable`` is not available, then it means that SMM codes for 62*4882a593Smuzhiyunenabling and disabling automatic BIOS fan control are not whitelisted 63*4882a593Smuzhiyunfor your hardware. It is possible that codes that work for other 64*4882a593Smuzhiyunlaptops actually work for yours as well, or that you have to discover 65*4882a593Smuzhiyunnew codes. 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunCheck the list ``i8k_whitelist_fan_control`` in file 68*4882a593Smuzhiyun``drivers/hwmon/dell-smm-hwmon.c`` in the kernel tree: as a first 69*4882a593Smuzhiyunattempt you can try to add your machine and use an already-known code 70*4882a593Smuzhiyunpair. If, after recompiling the kernel, you see that ``pwm1_enable`` 71*4882a593Smuzhiyunis present and works (i.e., you can manually control the fan speed), 72*4882a593Smuzhiyunthen please submit your finding as a kernel patch, so that other users 73*4882a593Smuzhiyuncan benefit from it. Please see 74*4882a593Smuzhiyun:ref:`Documentation/process/submitting-patches.rst <submittingpatches>` 75*4882a593Smuzhiyunfor information on submitting patches. 76*4882a593Smuzhiyun 77*4882a593SmuzhiyunIf no known code works on your machine, you need to resort to do some 78*4882a593Smuzhiyunprobing, because unfortunately Dell does not publish datasheets for 79*4882a593Smuzhiyunits SMM. You can experiment with the code in `this repository`__ to 80*4882a593Smuzhiyunprobe the BIOS on your machine and discover the appropriate codes. 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun __ https://github.com/clopez/dellfan/ 83*4882a593Smuzhiyun 84*4882a593SmuzhiyunAgain, when you find new codes, we'd be happy to have your patches! 85*4882a593Smuzhiyun 86*4882a593SmuzhiyunModule parameters 87*4882a593Smuzhiyun----------------- 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun* force:bool 90*4882a593Smuzhiyun Force loading without checking for supported 91*4882a593Smuzhiyun models. (default: 0) 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun* ignore_dmi:bool 94*4882a593Smuzhiyun Continue probing hardware even if DMI data does not 95*4882a593Smuzhiyun match. (default: 0) 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun* restricted:bool 98*4882a593Smuzhiyun Allow fan control only to processes with the 99*4882a593Smuzhiyun ``CAP_SYS_ADMIN`` capability set or processes run 100*4882a593Smuzhiyun as root when using the legacy ``/proc/i8k`` 101*4882a593Smuzhiyun interface. In this case normal users will be able 102*4882a593Smuzhiyun to read temperature and fan status but not to 103*4882a593Smuzhiyun control the fan. If your notebook is shared with 104*4882a593Smuzhiyun other users and you don't trust them you may want 105*4882a593Smuzhiyun to use this option. (default: 1, only available 106*4882a593Smuzhiyun with ``CONFIG_I8K``) 107*4882a593Smuzhiyun 108*4882a593Smuzhiyun* power_status:bool 109*4882a593Smuzhiyun Report AC status in ``/proc/i8k``. (default: 0, 110*4882a593Smuzhiyun only available with ``CONFIG_I8K``) 111*4882a593Smuzhiyun 112*4882a593Smuzhiyun* fan_mult:uint 113*4882a593Smuzhiyun Factor to multiply fan speed with. (default: 114*4882a593Smuzhiyun autodetect) 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun* fan_max:uint 117*4882a593Smuzhiyun Maximum configurable fan speed. (default: 118*4882a593Smuzhiyun autodetect) 119*4882a593Smuzhiyun 120*4882a593SmuzhiyunLegacy ``/proc`` interface 121*4882a593Smuzhiyun-------------------------- 122*4882a593Smuzhiyun 123*4882a593Smuzhiyun.. warning:: This interface is obsolete and deprecated and should not 124*4882a593Smuzhiyun used in new applications. This interface is only 125*4882a593Smuzhiyun available when kernel is compiled with option 126*4882a593Smuzhiyun ``CONFIG_I8K``. 127*4882a593Smuzhiyun 128*4882a593SmuzhiyunThe information provided by the kernel driver can be accessed by 129*4882a593Smuzhiyunsimply reading the ``/proc/i8k`` file. For example:: 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun $ cat /proc/i8k 132*4882a593Smuzhiyun 1.0 A17 2J59L02 52 2 1 8040 6420 1 2 133*4882a593Smuzhiyun 134*4882a593SmuzhiyunThe fields read from ``/proc/i8k`` are:: 135*4882a593Smuzhiyun 136*4882a593Smuzhiyun 1.0 A17 2J59L02 52 2 1 8040 6420 1 2 137*4882a593Smuzhiyun | | | | | | | | | | 138*4882a593Smuzhiyun | | | | | | | | | +------- 10. buttons status 139*4882a593Smuzhiyun | | | | | | | | +--------- 9. AC status 140*4882a593Smuzhiyun | | | | | | | +-------------- 8. fan0 RPM 141*4882a593Smuzhiyun | | | | | | +------------------- 7. fan1 RPM 142*4882a593Smuzhiyun | | | | | +--------------------- 6. fan0 status 143*4882a593Smuzhiyun | | | | +----------------------- 5. fan1 status 144*4882a593Smuzhiyun | | | +-------------------------- 4. temp0 reading (Celsius) 145*4882a593Smuzhiyun | | +---------------------------------- 3. Dell service tag (later known as 'serial number') 146*4882a593Smuzhiyun | +-------------------------------------- 2. BIOS version 147*4882a593Smuzhiyun +------------------------------------------ 1. /proc/i8k format version 148*4882a593Smuzhiyun 149*4882a593SmuzhiyunA negative value, for example -22, indicates that the BIOS doesn't 150*4882a593Smuzhiyunreturn the corresponding information. This is normal on some 151*4882a593Smuzhiyunmodels/BIOSes. 152*4882a593Smuzhiyun 153*4882a593SmuzhiyunFor performance reasons the ``/proc/i8k`` doesn't report by default 154*4882a593Smuzhiyunthe AC status since this SMM call takes a long time to execute and is 155*4882a593Smuzhiyunnot really needed. If you want to see the ac status in ``/proc/i8k`` 156*4882a593Smuzhiyunyou must explictitly enable this option by passing the 157*4882a593Smuzhiyun``power_status=1`` parameter to insmod. If AC status is not 158*4882a593Smuzhiyunavailable -1 is printed instead. 159*4882a593Smuzhiyun 160*4882a593SmuzhiyunThe driver provides also an ioctl interface which can be used to 161*4882a593Smuzhiyunobtain the same information and to control the fan status. The ioctl 162*4882a593Smuzhiyuninterface can be accessed from C programs or from shell using the 163*4882a593Smuzhiyuni8kctl utility. See the source file of ``i8kutils`` for more 164*4882a593Smuzhiyuninformation on how to use the ioctl interface. 165