From d19e470b6605c900db21fc7b34c66b6891a79983 Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Fri, 13 Dec 2019 15:48:40 -0800 Subject: ACPI: fan: Expose fan performance state information When _FPS indicates variable speed fan support, the thermal cooling device for fan shows max performance state count as "max_state" (greater than or equal to 1). But the thermal cooling device doesn't expose the properties of each performance state. This is not enough for smart fan control user space software, which also considers speed, power and noise level. This change exposes the properties of the fan performance states in the sysfs directory of the ACPI device representing the fan, that is /sys/bus/acpi/devices/devices/INT3404:00 or /sys/bus/platform/devices/PNP0C0B:00. For example: $ ls /sys/bus/acpi/devices/INT3404\:00 description path state0 state11 state4 state7 status hid physical_node state1 state2 state5 state8 subsystem modalias power state10 state3 state6 state9 uevent uid wakeup where each state* attribute lists the properties of a fan performance state in the following format: control_percent:trip_point:speed_rpm:noise_level_mdb:power_mw $ cat /sys/bus/acpi/devices/INT3404\:00/state10 95:0:11600:47500:4500 as documented in Documentation/admin-guide/acpi/fan_performance_states.rst While at it, return the correct error code from acpi_fan_probe() when acpi_fan_get_fps() or acpi_fan_get_fif() fails. Suggested-by: Rafael J. Wysocki Signed-off-by: Srinivas Pandruvada [ rjw: Subject, changelog, documentation ] Signed-off-by: Rafael J. Wysocki --- .../admin-guide/acpi/fan_performance_states.rst | 62 ++++++++++++++++++++++ Documentation/admin-guide/acpi/index.rst | 1 + 2 files changed, 63 insertions(+) create mode 100644 Documentation/admin-guide/acpi/fan_performance_states.rst (limited to 'Documentation') diff --git a/Documentation/admin-guide/acpi/fan_performance_states.rst b/Documentation/admin-guide/acpi/fan_performance_states.rst new file mode 100644 index 000000000000..21d233ca50d8 --- /dev/null +++ b/Documentation/admin-guide/acpi/fan_performance_states.rst @@ -0,0 +1,62 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=========================== +ACPI Fan Performance States +=========================== + +When the optional _FPS object is present under an ACPI device representing a +fan (for example, PNP0C0B or INT3404), the ACPI fan driver creates additional +"state*" attributes in the sysfs directory of the ACPI device in question. +These attributes list properties of fan performance states. + +For more information on _FPS refer to the ACPI specification at: + +http://uefi.org/specifications + +For instance, the contents of the INT3404 ACPI device sysfs directory +may look as follows:: + + $ ls -l /sys/bus/acpi/devices/INT3404:00/ + total 0 +... + -r--r--r-- 1 root root 4096 Dec 13 20:38 state0 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state1 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state10 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state11 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state2 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state3 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state4 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state5 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state6 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state7 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state8 + -r--r--r-- 1 root root 4096 Dec 13 20:38 state9 + -r--r--r-- 1 root root 4096 Dec 13 01:00 status + ... + +where each of the "state*" files represents one performance state of the fan +and contains a colon-separated list of 5 integer numbers (fields) with the +following interpretation:: + +control_percent:trip_point_index:speed_rpm:noise_level_mdb:power_mw + +* ``control_percent``: The percent value to be used to set the fan speed to a + specific level using the _FSL object (0-100). + +* ``trip_point_index``: The active cooling trip point number that corresponds + to this performance state (0-9). + +* ``speed_rpm``: Speed of the fan in rotations per minute. + +* ``noise_level_mdb``: Audible noise emitted by the fan in this state in + millidecibels. + +* ``power_mw``: Power draw of the fan in this state in milliwatts. + +For example:: + + $cat /sys/bus/acpi/devices/INT3404:00/state1 + 25:0:3200:12500:1250 + +When a given field is not populated or its value provided by the platform +firmware is invalid, the "not-defined" string is shown instead of the value. diff --git a/Documentation/admin-guide/acpi/index.rst b/Documentation/admin-guide/acpi/index.rst index 4d13eeea1eca..71277689ad97 100644 --- a/Documentation/admin-guide/acpi/index.rst +++ b/Documentation/admin-guide/acpi/index.rst @@ -12,3 +12,4 @@ the Linux ACPI support. dsdt-override ssdt-overlays cppc_sysfs + fan_performance_states -- cgit v1.2.3 From 0435bcd9e185803402a2566e78c1067c615bc579 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Tue, 17 Dec 2019 12:48:56 +0200 Subject: docs: firmware-guide: ACPI: Replace dma_request_slave_channel() with dma_request_chan() dma_request_chan() is the preferred API to request slave channels. Signed-off-by: Peter Ujfalusi [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki --- Documentation/firmware-guide/acpi/enumeration.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Documentation') diff --git a/Documentation/firmware-guide/acpi/enumeration.rst b/Documentation/firmware-guide/acpi/enumeration.rst index 0a72b6321f5f..c13fee8b02ba 100644 --- a/Documentation/firmware-guide/acpi/enumeration.rst +++ b/Documentation/firmware-guide/acpi/enumeration.rst @@ -71,8 +71,8 @@ DMA support DMA controllers enumerated via ACPI should be registered in the system to provide generic access to their resources. For example, a driver that would like to be accessible to slave devices via generic API call -dma_request_slave_channel() must register itself at the end of the probe -function like this:: +dma_request_chan() must register itself at the end of the probe function like +this:: err = devm_acpi_dma_controller_register(dev, xlate_func, dw); /* Handle the error if it's not a case of !CONFIG_ACPI */ @@ -112,15 +112,15 @@ could look like:: } #endif -dma_request_slave_channel() will call xlate_func() for each registered DMA -controller. In the xlate function the proper channel must be chosen based on +dma_request_chan() will call xlate_func() for each registered DMA controller. +In the xlate function the proper channel must be chosen based on information in struct acpi_dma_spec and the properties of the controller provided by struct acpi_dma. -Clients must call dma_request_slave_channel() with the string parameter that -corresponds to a specific FixedDMA resource. By default "tx" means the first -entry of the FixedDMA resource array, "rx" means the second entry. The table -below shows a layout:: +Clients must call dma_request_chan() with the string parameter that corresponds +to a specific FixedDMA resource. By default "tx" means the first entry of the +FixedDMA resource array, "rx" means the second entry. The table below shows a +layout:: Device (I2C0) { -- cgit v1.2.3