Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp563748ybc; Tue, 19 Nov 2019 05:52:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyrX65uQ7KIwAoGtjD82lqmuGR8zzU7quDfxkeik60HEj5AN/cBgJjhTe9zUFlOPTy96oS8 X-Received: by 2002:a17:906:c314:: with SMTP id s20mr35426710ejz.118.1574171572629; Tue, 19 Nov 2019 05:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574171572; cv=none; d=google.com; s=arc-20160816; b=mLb7RlWlzrct3Q0glCDec2K64ddzXMAPhdeJTYTMTloLhdIRrX7G7schELKSJQprA6 zTpQHADxPxqLJ8mGI4C0VtFKkI/xqtIsz2KhaDBflnO/gfF2ykaFv2bdnrK56s0PxXWV M1NwvI0t0L6SE8ahD7ZwjpmhQMwhj7rMRZojS/REaFfaujf5oh1DRYjQi1bwBHU00kXV S63kfJXro+G0P+eZkRMTSjYbPh6WDDnwMKgtyoVtDiqqbaY1/fKCnDfr9Lyn6lW+nyLZ Le9NntSG64kT3dLTcJ62MCh2+X7k6mcyFDbqe2IG2nrPYi2T4PYkmL5pHgVokwe4F+q7 GNjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=T+djzb9J8kXlaOHdpB2R/PEKrBs1hA34i/q2RHF64/g=; b=dID2euC67xmC15I1K/Vw971ChMgnsG682leb9VA1nfE27LQkLWs9wCyR48U6sORu26 Dqn0+6vhsv6zybJ+eA/0JH3wG4MwKx2Aaf9WSla0CqRNaa8yGu1S9RhIUfOvTHg/RgY3 Ob2ElT3bLreWCTsqTW6IvYp3aANoNVRwTg0Uk7GMOBdwBnAVvunq41lnAMJbdfeVJc7b qKIbDgAcmnwXfooReyUgd+rSwLUqj/zBStsxH+4zGdOwafhdL+9BLcNa7P3/hYx9s79z GM9LJPoxK8L65ZWrCGxZxSPA7pXc9LPosUaDIxezvfxWOFQvVqV1NczI4b74bZNEccth V20Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m23si14485184ejj.164.2019.11.19.05.52.28; Tue, 19 Nov 2019 05:52:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727255AbfKSNti (ORCPT + 99 others); Tue, 19 Nov 2019 08:49:38 -0500 Received: from pietrobattiston.it ([92.243.7.39]:43790 "EHLO jauntuale.pietrobattiston.it" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726185AbfKSNti (ORCPT ); Tue, 19 Nov 2019 08:49:38 -0500 Received: from amalgama (pno-math-19.ulb.ac.be [164.15.133.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: giovanni) by jauntuale.pietrobattiston.it (Postfix) with ESMTPSA id 8CAC3E054B; Tue, 19 Nov 2019 14:49:34 +0100 (CET) Received: by amalgama (Postfix, from userid 1000) id 2D0BE3C238D; Tue, 19 Nov 2019 14:49:34 +0100 (CET) From: Giovanni Mascellani To: Jean Delvare , Guenter Roeck , Jonathan Corbet , =?UTF-8?q?Pali=20Roh=C3=A1r?= , linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Giovanni Mascellani Subject: [PATCH v5 2/2] dell-smm-hwmon: Add documentation Date: Tue, 19 Nov 2019 14:49:21 +0100 Message-Id: <20191119134921.168424-2-gio@debian.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119134921.168424-1-gio@debian.org> References: <20191119134921.168424-1-gio@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Part of the documentation is taken from the README of the userspace utils (https://github.com/vitorafsr/i8kutils). The license is GPL-2+ and the author Massimo Dal Zotto is already credited as author of the module. Therefore there should be no copyright problem. I also added a paragraph with specific information on the experimental support for automatic BIOS fan control. Signed-off-by: Giovanni Mascellani --- Documentation/hwmon/dell-smm-hwmon.rst | 157 +++++++++++++++++++++++++ Documentation/hwmon/index.rst | 1 + 2 files changed, 158 insertions(+) create mode 100644 Documentation/hwmon/dell-smm-hwmon.rst diff --git a/Documentation/hwmon/dell-smm-hwmon.rst b/Documentation/hwmon/dell-smm-hwmon.rst new file mode 100644 index 000000000000..25bd8f8e89b5 --- /dev/null +++ b/Documentation/hwmon/dell-smm-hwmon.rst @@ -0,0 +1,157 @@ +Kernel driver dell-smm-hwmon +============================ + +Description +----------- + +On many Dell laptops the System Management Mode (SMM) BIOS can be +queried for the status of fans and temperature sensors. Userspace +utilities like ``sensors`` can be used to return the readings. The +userspace suite `i8kutils`__ can also be used to read the sensors and +automatically adjust fan speed (please notice that it currently uses +the deprecated ``/proc/i8k`` interface). + + __ https://github.com/vitorafsr/i8kutils + +``sysfs`` interface +------------------- + +Temperature sensors and fans can be queried and set via the standard +``hwmon`` interface on ``sysfs``, under the directory +``/sys/class/hwmon/hwmonX`` for some value of ``X`` (search for the +``X`` such that ``/sys/class/hwmon/hwmonX/name`` has content +``dell_smm``). A number of other attributes can be read or written: + +=============================== ======= ======================================= +Name Perm Description +=============================== ======= ======================================= +fan[1-3]_input RO Fan speed in RPM. +fan[1-3]_label RO Fan label. +pwm[1-3] RW Control the fan PWM duty-cycle. +pwm1_enable WO Enable or disable automatic BIOS fan + control (not supported on all laptops, + see below for details). +temp[1-10]_input RO Temperature reading in milli-degrees + Celsius. +temp[1-10]_label RO Temperature sensor label. +=============================== ======= ======================================= + +Disabling automatic BIOS fan control +------------------------------------ + +On some laptops the BIOS automatically sets fan speed every few +seconds. Therefore the fan speed set by mean of this driver is quickly +overwritten. + +There is experimental support for disabling automatic BIOS fan +control, at least on laptops where the corresponding SMM command is +known, by writing the value ``1`` in the attribute ``pwm1_enable`` +(writing ``2`` enables automatic BIOS control again). Even if you have +more than one fan, all of them are set to either enabled or disabled +automatic fan control at the same time and, notwithstanding the name, +``pwm1_enable`` sets automatic control for all fans. + +If ``pwm1_enable`` is not available, then it means that SMM codes for +enabling and disabling automatic BIOS fan control are not whitelisted +for your hardware. It is possible that codes that work for other +laptops actually work for yours as well, or that you have to discover +new codes. + +Check the list ``i8k_whitelist_fan_control`` in file +``drivers/hwmon/dell-smm-hwmon.c`` in the kernel tree: as a first +attempt you can try to add your machine and use an already-known code +pair. If, after recompiling the kernel, you see that ``pwm1_enable`` +is present and works (i.e., you can manually control the fan speed), +then please submit your finding as a kernel patch, so that other users +can benefit from it. Please see +:ref:`Documentation/process/submitting-patches ` +for information on submitting patches. + +If no known code works on your machine, you need to resort to do some +probing, because unfortunately Dell does not publish datasheets for +its SMM. You can experiment with the code in `this repository`__ to +probe the BIOS on your machine and discover the appropriate codes. + + __ https://github.com/clopez/dellfan/ + +Again, when you find new codes, we'd be happy to have your patches! + +Module parameters +----------------- + +* force:bool + Force loading without checking for supported + models. (default: 0) + +* ignore_dmi:bool + Continue probing hardware even if DMI data does not + match. (default: 0) + +* restricted:bool + Allow fan control only to processes with the + ``CAP_SYS_ADMIN`` capability set or processes run + as root when using the legacy ``/proc/i8k`` + interface. In this case normal users will be able + to read temperature and fan status but not to + control the fan. If your notebook is shared with + other users and you don't trust them you may want + to use this option. (default: 1, only available + with ``CONFIG_I8K``) + +* power_status:bool + Report AC status in ``/proc/i8k``. (default: 0, + only available with ``CONFIG_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 not + used in new applications. This interface is only + available when kernel is compiled with option + ``CONFIG_I8K``. + +The information provided by the kernel driver can be accessed by +simply reading the ``/proc/i8k`` file. For example:: + + $ cat /proc/i8k + 1.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't +return the corresponding information. This is normal on some +models/BIOSes. + +For performance reasons the ``/proc/i8k`` doesn't report by default +the AC status since this SMM call takes a long time to execute and is +not really needed. If you want to see the ac status in ``/proc/i8k`` +you must explictitly enable this option by passing the +``power_status=1`` parameter to insmod. If AC status is not +available -1 is printed instead. + +The driver provides also an ioctl interface which can be used to +obtain the same information and to control the fan status. The ioctl +interface can be accessed from C programs or from shell using the +i8kctl utility. See the source file of ``i8kutils`` for more +information on how to use the ioctl interface. diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst index 230ad59b462b..092435ad6bb8 100644 --- a/Documentation/hwmon/index.rst +++ b/Documentation/hwmon/index.rst @@ -44,6 +44,7 @@ Hardware Monitoring Kernel Drivers coretemp da9052 da9055 + dell-smm-hwmon dme1737 ds1621 ds620 -- 2.24.0