Blame
|
1 | # Power Mode and Fan Control |
||||||
| 2 | ||||||||
| 3 | ### Problem |
|||||||
|
4 | No fan and power mode control is available is available for Linux or Windows on Sixunited's AXB35 board. |
||||||
|
5 | |||||||
|
6 | ### Solution for Linux |
||||||
|
7 | There is a [ec-su_axb35-linux kernel module](https://github.com/cmetz/ec-su_axb35-linux) written by Christoph Metz. |
||||||
| 8 | ||||||||
| 9 | It allows you to: |
|||||||
| 10 | - read current fan speeds and modes |
|||||||
| 11 | - switch modes of each of the three available fans |
|||||||
| 12 | - control fan speed in `fixed` mode |
|||||||
| 13 | - control fan speed with custom curves in `curve` mode |
|||||||
| 14 | - read current power mode |
|||||||
| 15 | - change current power mode |
|||||||
| 16 | - read current APU temperature |
|||||||
| 17 | ||||||||
|
18 | #### Generic Installation (no secure boot) |
||||||
|
19 | 1. Install module building dependencies (depends on your distro, on debian/ubuntu install `build-essential` and `linux-headers-$(uname -r)` packages). |
||||||
|
20 | 2. Clone the repo with `git clone https://github.com/cmetz/ec-su_axb35-linux.git`. |
||||||
|
21 | 3. Build and install the module with `cd ec-su_axb35-linux && sudo make install`. |
||||||
|
22 | 4. Try loading the module with `modprobe ec_su_axb35` and check your `dmesg` afterwards. You should see the `Sixunited AXB35-02 EC driver loaded` message. |
||||||
| 23 | 5. Run `scripts/info.sh` and check that all information is there. |
|||||||
| 24 | 6. Run `scripts/test_fan_mode_fixed.sh`, it should test your fans on all 6 fixed levels. |
|||||||
|
25 | 7. If everything is good, you can make the module automatically load on system boot with `sudo echo ec_su_axb35 >> /etc/modules`. If it says "permission denied", drop into root console with `su` or `sudo su -` and try again. |
||||||
|
26 | |||||||
|
27 | #### Installation with secure boot on Fedora |
||||||
| 28 | Check that secure boot is enabled: |
|||||||
| 29 | ``` |
|||||||
| 30 | $ mokutil --sb-state |
|||||||
| 31 | SecureBoot enabled |
|||||||
| 32 | ``` |
|||||||
| 33 | Generate a new self-signed certificate for MOK and request it to be added to your UEFI keys: |
|||||||
| 34 | ``` |
|||||||
| 35 | sudo dnf install dkms openssl sbsigntools |
|||||||
| 36 | sudo dkms generate_mok |
|||||||
| 37 | MOK_PASSWD=test1 |
|||||||
| 38 | sudo mokutil -i /var/lib/dkms/mok.pub << EOI |
|||||||
| 39 | ${MOK_PASSWD} |
|||||||
| 40 | ${MOK_PASSWD} |
|||||||
| 41 | EOI |
|||||||
| 42 | sudo systemctl reboot |
|||||||
| 43 | ``` |
|||||||
| 44 | During reboot the blue Shim UEFI key management screen appears. Press a key. |
|||||||
| 45 | Select “Enroll MOK”, choose “Continue”, select “Yes”, enter the password "test1" from above. Note that the password must be no more than 5 characters long. Your keyboard will probably be in a US keyboard layout at this point. |
|||||||
| 46 | ||||||||
| 47 | Build the ec_su_axb35 kernel module: |
|||||||
| 48 | ``` |
|||||||
| 49 | git clone https://github.com/cmetz/ec-su_axb35-linux.git |
|||||||
| 50 | cd ec-su_axb35-linux |
|||||||
| 51 | make |
|||||||
| 52 | sudo make install |
|||||||
| 53 | ``` |
|||||||
|
54 | Sign the kernel module file you just compiled and then load it (as root): |
||||||
|
55 | ``` |
||||||
| 56 | /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 /var/lib/dkms/mok.key /var/lib/dkms/mok.pub /lib/modules/$(uname -r)/updates/ec_su_axb35.ko |
|||||||
| 57 | modprobe ec_su_axb35 |
|||||||
| 58 | dmesg|tail |
|||||||
| 59 | ``` |
|||||||
| 60 | Hopefully you will see this: |
|||||||
| 61 | ``` |
|||||||
| 62 | [ 123.02] ec_su_axb35: loading out-of-tree module taints kernel. |
|||||||
| 63 | [ 123.03] ec_su_axb35: Sixunited AXB35-02 EC driver loaded |
|||||||
| 64 | ``` |
|||||||
| 65 | ||||||||
|
66 | #### Usage |
||||||
| 67 | Reading and writing all of the parameters happens through sysfs with `/sys/class/ec_su_axb35` path. You can find detailed information in [the repo's readme file](https://github.com/cmetz/ec-su_axb35-linux/blob/main/README.md). |
|||||||
| 68 | ||||||||
| 69 | Some examples: |
|||||||
| 70 | - `cat /sys/class/ec_su_axb35/fan2/rpm` to get current rpm of fan2 |
|||||||
| 71 | - `echo fixed > /sys/class/ec_su_axb35/fan3/mode && echo 2 > /sys/class/ec_su_axb35/fan3/level` to switch fan3 to fixed mode and set speed to level 2 |
|||||||
| 72 | - `echo balanced > /sys/class/ec_su_axb35/apu/power_mode` to set power mode to balanced (85W) |
|||||||
| 73 | ||||||||
|
74 | You can also call `su_axb35_monitor` anywhere to monitor all available values in realtime: |
||||||
| 75 |  |
|||||||
|
76 | |||||||
| 77 | To apply specific settings at system startup, place them in your `rc.local` file or utilize any other methods for executing commands during boot, such as creating a systemd unit. In the future, these parameters will also be configurable through module options. |
|||||||
| 78 | ||||||||
| 79 | #### Custom Curves |
|||||||
| 80 | The custom curves define temperature thresholds for fan power levels: |
|||||||
| 81 | - **Ramp-up curve** (`/sys/class/ec_su_axb35/fanX/rampup_curve`): temperature points where fan increases to the next level |
|||||||
|
82 | - **Ramp-down curve** (`/sys/class/ec_su_axb35/fanX/rampdown_curve`): temperature points where fan decreases to the previous level |
||||||
|
83 | |||||||
| 84 | For example, with these settings: |
|||||||
| 85 | - `rampup_curve = 60,70,83,95,97` |
|||||||
| 86 | - `rampdown_curve = 40,50,80,94,96` |
|||||||
| 87 | ||||||||
| 88 | **When CPU is heating up:** |
|||||||
| 89 | - Below 60°: Fan at level 0 (minimum) |
|||||||
| 90 | - At 60°: Increases to level 1 |
|||||||
| 91 | - At 70°: Increases to level 2 |
|||||||
| 92 | - At 83°: Increases to level 3 |
|||||||
| 93 | - At 95°: Increases to level 4 |
|||||||
| 94 | - At 97°: Increases to level 5 (maximum) |
|||||||
| 95 | ||||||||
| 96 | **When CPU is cooling down:** |
|||||||
| 97 | - Above 96°: Fan stays at level 5 |
|||||||
| 98 | - Below 96°: Decreases to level 4 |
|||||||
| 99 | - Below 94°: Decreases to level 3 |
|||||||
| 100 | - Below 80°: Decreases to level 2 |
|||||||
| 101 | - Below 50°: Decreases to level 1 |
|||||||
| 102 | - Below 40°: Decreases to level 0 |
|||||||
| 103 | ||||||||
| 104 | This creates a buffer at each level that prevents the fan from rapidly switching between speeds when temperature fluctuates around threshold values. |
|||||||
| 105 | ||||||||
| 106 | Curves are being applied only when `curve` mode is set on a specific fan, each fan has their own curves. |
|||||||
| 107 | ||||||||
|
108 | |||||||
| 109 | ### Solution for Windows |
|||||||
| 110 | Based on the research made for the Linux module [a Windows implementation has been written as well](https://github.com/deseven/ec-su_axb35-win). The only major limitation is the need to disable Secure Boot, everything else should be pretty simple, just follow the readme in the repo. |
|||||||
| 111 | ||||||||
| 112 | ||||||||
|
113 | ### Fine-tuning Power Limits |
||||||
|
114 | If you want more gradual control over power modes, there's a [RyzenAdj](https://github.com/FlyGoat/RyzenAdj) utility (or [UXTU](https://amdaputuningutility.com) for Windows). |
||||||
|
115 | |||||||
| 116 | Main 3 parameters we are interested in are: |
|||||||
| 117 | - `STAPM LIMIT` (sustained power draw) |
|||||||
| 118 | - `PPT LIMIT FAST` (boost power draw) |
|||||||
| 119 | - `PPT LIMIT SLOW` (average power draw) |
|||||||
| 120 | ||||||||
| 121 | Default values on all 3 selectable power modes (use `ryzenadj --info` to read them): |
|||||||
| 122 | ||||||||
| 123 | | Power Mode | STAPM LIMIT | PPT LIMIT FAST | PPT LIMIT SLOW | |
|||||||
| 124 | | ----------- | ----------- | -------------- | -------------- | |
|||||||
| 125 | | Quiet | 54.0 | 100.0 | 54.0 | |
|||||||
| 126 | | Balanced | 85.0 | 120.0 | 120.0 | |
|||||||
| 127 | | Performance | 120.0 | 140.0 | 120.0 | |
|||||||
| 128 | ||||||||
| 129 | Example on setting the power limit to static 100W with no boost: |
|||||||
| 130 | `ryzenadj --stapm-limit=100000 --fast-limit=100000 --slow-limit=100000` |
|||||||
| 131 | ||||||||
| 132 | **Note that changing the power mode via the EC controller (using `ec-su_axb35-linux` or otherwise) resets these values to their defaults.** |
|||||||
| 133 | ||||||||
|
134 | ### Relevant Pages |
||||||
|
135 | - [[Guides/Hardware_Monitoring]] |
||||||
| 136 | - [[Guides/Power_Modes_and_Performance]] |
|||||||