Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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