Creating Model Configurations

To create a model configuration file for NBFC-Linux, you need to analyze the DSDT of your ACPI firmware to discover the registers and methods for controlling the fan.
This guide walks you through:

Introduction

About the Embedded Controller

Modern laptops rely on an Embedded Controller (EC) to manage a wide range of low-level hardware functions. These typically include keyboard, battery, power management, fan and thermal control, status LEDs, and display backlight control.

Caution When Writing to Registers

Accessing EC registers requires extreme care. Never experiment on registers or methods that are not clearly understood.

Safe System State During Configuration

When creating or testing a new configuration, the laptop should be in a state where no data can be lost. While interacting with the EC, the system may shut down unexpectedly or become unresponsive.

Battery Safety

For maximum safety, the laptop battery should be physically removed if possible. The Embedded Controller directly manages battery logic, and incorrect EC interaction can permanently damage or brick the battery.

Resetting the Embedded Controller

In most cases, a misconfigured Embedded Controller can be reset by fully rebooting the laptop, restoring it to its default state. This should not be relied upon as a safety mechanism — careful and deliberate EC interaction is essential.

Required Technical Skills

Interacting with the terminal and having a solid understanding of basic Unix commands is essential for following this guide. You should also be comfortable reading and modifying Bash scripts, as well as working with JSON configuration files. Familiarity with these tools is required to safely and effectively create and test model configurations.

Installing Required Tools

Install the following programs and kernel modules

Operating System Command
Arch Linux
sudo pacman -S acpica acpi_call stress
Debian
sudo apt install acpica-tools acpi-call stress
Fedora
sudo dnf install acpica-tools stress
The acpi_call kernel module must be installed manually.
OpenSuse
sudo zypper install acpica stress
The acpi_call kernel module must be installed manually.

Analyzing the Firmware

The nbfc acpi-dump command acts as a wrapper around acpiexec and iasl. It is also possible to use these tools directly.

Extracting the Firmware

This command creates the file dsdt.dsl. You can view it with your favorite text editor.

sudo nbfc acpi-dump dsl > dsdt.dsl

Get a list of ACPI methods

sudo nbfc acpi-dump methods
Example Output
[...]
\_SB.PC00.LPCB.EC0.KFCL args=2
\_SB.PC00.LPCB.EC0.KSFS args=1
\_SB.PC00.LPCB.EC0.KGFS args=0
\_SB.PC00.LPCB.EC0.SFSD args=1
\_SB.PC00.LPCB.EC0.GFSD args=0
\_SB.PC00.LPCB.EC0.GSHK args=0
\_SB.PC00.LPCB.EC0.SSHK args=1
[...]

Get a list of embedded controller registers

sudo nbfc acpi-dump ec-registers
Example Output
[...]
\_SB.PC00.LPCB.EC0.TMPO [ECRM] byte=44 byte_hex=0x2C bit=0 total_bit=352 len=8 acc=1
\_SB.PC00.LPCB.EC0.AFAN [ECRM] byte=45 byte_hex=0x2D bit=0 total_bit=360 len=8 acc=1
\_SB.PC00.LPCB.EC0.FRDC [ECRM] byte=46 byte_hex=0x2E bit=0 total_bit=368 len=8 acc=1
\_SB.PC00.LPCB.EC0.FTGC [ECRM] byte=47 byte_hex=0x2F bit=0 total_bit=376 len=8 acc=1
\_SB.PC00.LPCB.EC0.PLTP [ECRM] byte=48 byte_hex=0x30 bit=0 total_bit=384 len=8 acc=1
\_SB.PC00.LPCB.EC0.DTMP [ECRM] byte=50 byte_hex=0x32 bit=0 total_bit=400 len=8 acc=1
\_SB.PC00.LPCB.EC0.FR2C [ECRM] byte=53 byte_hex=0x35 bit=0 total_bit=424 len=8 acc=1
\_SB.PC00.LPCB.EC0.FT2C [ECRM] byte=54 byte_hex=0x36 bit=0 total_bit=432 len=8 acc=1
\_SB.PC00.LPCB.EC0.BCVD [ECRM] byte=55 byte_hex=0x37 bit=0 total_bit=440 len=8 acc=1
\_SB.PC00.LPCB.EC0.SNMD [ECRM] byte=63 byte_hex=0x3F bit=0 total_bit=504 len=8 acc=1
\_SB.PC00.LPCB.EC0.FRPS [SSRM] byte=9 byte_hex=0x9 bit=0 total_bit=72 len=8 acc=1
[...]

Finding Methods and Registers

When reading the DSDT, try to identify registers and methods with names like:

Registers: SFAN, CFAN, PFAN, FAN1, FSW1, FRDC, FTGC, RPM1, RPM2
Methods: FANG, FANW, GFSD, SFSD, SFNV, FRSP, STMM, GFRM

Probing Registers and Methods

You can access EC registers and invoke ACPI methods using the ec_probe tool:

Reading a register

sudo ec_probe read 0xD6

For a two-byte register:

sudo ec_probe read -w 0xD6

Writing to a register

sudo ec_probe write 0xD7 0x0

For a two-byte register:

sudo ec_probe write -w 0xD7 0xDEAD

Calling ACPI methods

You can also invoke ACPI methods:

sudo ec_probe acpi_call '\_SB.PCI0.LPCB.EC0.GFSD'

With arguments:

sudo ec_probe acpi_call '\_SB.PCI0.LPCB.EC0.SFSD' 100

Examples

Below are real-world examples, along with a detailed explanation of how the configuration files were created.

Model Registers Methods
ASUSTeK COMPUTER INC. X5511CA \_SB.PCI0.LPCB.EC0.RRAM 6151 (read), \_SB.PCI0.LPCB.EC0.SFNV 1 $ (write)
Acer Aspire E1-570G \_SB_.PCI0.LPCB.EC0.FANG 33026 (read), \_SB_.PCI0.LPCB.EC0.FANW 33026 $ (write), \_SB_.PCI0.LPCB.EC0.FANW 33030 0xFF (misc)
Acer Aspire ES1-711 0x55 (read+write), CTMP (misc)
HP 620 CFAN (read), PFAN (write)
HP EliteBook 8560w FRDC (read), FTGC (write), CRZN (misc), TEMP (misc)
HP Laptop 17-bs0xx FAN1 (read), FSW1 (write), FSH1 (misc)
HP Pavilion 17 Notebook PC SFAN (write) \_TZ.TZ01.FRSP (read)
Packard Bell EasyNote TK85 \_SB.PCI0.LPCB.EC0.FANG 33026 (read), \_SB.PCI0.LPCB.EC0.FANW 33026 $ (write)