Skip to content

Instantly share code, notes, and snippets.

@lamperez
Last active December 13, 2024 17:57
Show Gist options
  • Save lamperez/d5b385bc0c0c04928211e297a69f32d7 to your computer and use it in GitHub Desktop.
Save lamperez/d5b385bc0c0c04928211e297a69f32d7 to your computer and use it in GitHub Desktop.
Load custom ACPI tables

ACPI DSDT/SSDT patching

These instructions are meant for a system with EFI, systemd-boot and deb based packages. Adjust them to your needs.

Reference: https://www.kernel.org/doc/Documentation/acpi/initrd_table_override.txt

See also https://github.com/lbschenkel/acer-sf314_43-acpi-patch

ACPICA tools: https://acpica.org/downloads

sudo apt install acpica-tools

Option 1: DSDT, extract and modify the tables

Extract the acpi tables

mkdir acpi && cd acpi
sudo acpidump -b

Disassemble the tables

iasl -d dsdt.dat

Modify or patch the tables

vim dsdt.dsl

Assemble the custom tables

iasl -sa dsdt.dsl

Generate the cpio file for initrd

cd ..
mkdir -p kernel/firmware/acpi
cp acpi/dsdt.aml kernel/firmware/acpi/
find kernel | cpio -H newc --create > patched_acpi_tables.cpio

Grub does not require a cpio file, you can directly provide the dsl file.

Option 2: SSDT, create the tables

SSDT tables add missing features to the existing ACPI, without requiring disassembling. They are created using the same tools and procedure.

Assemble the custom tables

iasl -sa ssdt.dsl

Generate the cpio file for initrd

cd ..
mkdir -p kernel/firmware/acpi
cp acpi/ssdt.aml kernel/firmware/acpi/
find kernel | cpio -H newc --create > patched_acpi_tables.cpio

Install the tables (systemd-boot)

Copy the cpio file with the custom tables where it can be addressed by the EFI boot

sudo mkdir /boot/efi/EFI/acpi
sudo cp patched_acpi_tables.cpio /boot/efi/EFI/acpi/

Edit the entry sudo vim /boot/efi/loader/entries/Pop_OS-current.conf

linux /EFI/...
initrd /EFI/acpi/patched_acpi_tables.cpio
initrd /EFI/Pop_OS-.../initrd.img
options ...
@sieskei
Copy link

sieskei commented Jun 7, 2023

Hello @fermino, @Moooebie
thank you for your assistance.

In the end, I managed to do it very easily by edit /etc/default/grub.
I added GRUB_EARLY_INITRD_LINUX_CUSTOM = "patched_acpi_tables.cpio" and move file to /boot.

@Elysion-tcfa
Copy link

Elysion-tcfa commented Aug 30, 2023

To use it with grub, it is enough to copy acpi/dsdtl.aml to /boot/. Then I used a slightly modified version of this script to generate the grub configuration (https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1045690).

$ diff /boot/grub/grub.cfg.old /boot/grub/grub.cfg
88a89,95
> ### BEGIN /etc/grub.d/01_acpi ###
>  insmod part_gpt
>  insmod fat
>  search --no-floppy --fs-uuid --set=root 9FCD-44E3
> acpi ($root)/dsdt.aml
> ### END /etc/grub.d/01_acpi ###
> 

@fermino I have the same CSC3551 issue coming with my ASUS ROG Zephyrus G14 GA402XV as this one, and your way of applying a SSDT patch did make Linux correctly detect the woofer speakers. Unfortunately, after that, due to some unknown reason, the laptop started becoming hot and noisy even when idling. The battery started to drain very quickly after being unplugged, and battery life dropped from ~10hrs to 2-3hrs. Even when the laptop was under sleep the battery continued draining.

After some attempts it looks like this way of patching is indeed the culprit. The correct way instead is to copy the cpio file to /boot and add this file in the initrd line, such like this:
initrd /patched_acpi_tables.cpio /initramfs-linux.img
Now the battery life goes back to normal while the woofer speakers are still detected and working.

@pizFunk
Copy link

pizFunk commented Oct 28, 2023

Anyone having done this patch notice that when the system volume is low the sound is more bass than treble and the reverse when the volume is high? Somewhere around 75% sounds pretty good. Wondering if it's just an issue on my end.

@mrnossiom
Copy link

Let's go. My sound works perfectly.
For NixOS people, I made a module that is very easy to integrate into your NixOS configuration :
https://github.com/mrnossiom/dotfiles/blob/nixos/modules/nixos/asus-zenbook-ux3402za-sound.nix

@Ben9986
Copy link

Ben9986 commented May 5, 2024

Let's go. My sound works perfectly. For NixOS people, I made a module that is very easy to integrate into your NixOS configuration : https://github.com/mrnossiom/dotfiles/blob/nixos/modules/nixos/asus-zenbook-ux3402za-sound.nix

THANK YOU! I couldn't figure out how to nixify the instructions to work with systemd-boot, but your config just worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment