From 457e1b0bf7529919c9502d68cf7a0e515dba493c Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Wed, 28 May 2025 17:38:06 +0100 Subject: [PATCH] Add GU605C speaker fix Signed-off-by: Nikolaos Karaolidis --- .../configs/system/pipewire/default.nix | 4 +++ hosts/himalia/hardware/default.nix | 30 ++++++++++++++----- .../gu605c-spi-cs-gpio/alc285-fixup.patch | 12 ++++++++ .../hardware/gu605c-spi-cs-gpio/default.nix | 28 +++++++++++++++++ .../gu605c-spi-cs-gpio/gu605c-spi-cs-gpio.asl | 30 +++++++++++++++++++ 5 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 hosts/himalia/hardware/gu605c-spi-cs-gpio/alc285-fixup.patch create mode 100644 hosts/himalia/hardware/gu605c-spi-cs-gpio/default.nix create mode 100644 hosts/himalia/hardware/gu605c-spi-cs-gpio/gu605c-spi-cs-gpio.asl diff --git a/hosts/common/configs/system/pipewire/default.nix b/hosts/common/configs/system/pipewire/default.nix index 25536ff..ac49ea0 100644 --- a/hosts/common/configs/system/pipewire/default.nix +++ b/hosts/common/configs/system/pipewire/default.nix @@ -14,6 +14,10 @@ cmd = "load-module"; args = "module-switch-on-connect"; } + { + cmd = "load-module"; + args = "module-combine-sink"; + } ]; }; }; diff --git a/hosts/himalia/hardware/default.nix b/hosts/himalia/hardware/default.nix index fe579d4..690ca40 100644 --- a/hosts/himalia/hardware/default.nix +++ b/hosts/himalia/hardware/default.nix @@ -55,15 +55,29 @@ boot = { kernelParams = [ "pci=noaer" ]; kernelModules = [ "kvm-intel" ]; - initrd.kernelModules = [ - "i915" - "xhci_pci" - "thunderbolt" - "vmd" - "nvme" - "usbhid" - "sd_mod" + + kernelPatches = [ + { + name = "alc285-fixup"; + patch = ./gu605c-spi-cs-gpio/alc285-fixup.patch; + } ]; + + initrd = { + prepend = [ + "${import ./gu605c-spi-cs-gpio { inherit pkgs; }}/asus-gu605c-acpi.cpio" + ]; + + kernelModules = [ + "i915" + "xhci_pci" + "thunderbolt" + "vmd" + "nvme" + "usbhid" + "sd_mod" + ]; + }; }; nixpkgs.config.cudaSupport = true; diff --git a/hosts/himalia/hardware/gu605c-spi-cs-gpio/alc285-fixup.patch b/hosts/himalia/hardware/gu605c-spi-cs-gpio/alc285-fixup.patch new file mode 100644 index 0000000..3baf6a7 --- /dev/null +++ b/hosts/himalia/hardware/gu605c-spi-cs-gpio/alc285-fixup.patch @@ -0,0 +1,12 @@ +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index cd0d7ba7320e..2a8791d30a5f 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -10982,6 +10982,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1043, 0x1c43, "ASUS UX8406MA", ALC245_FIXUP_CS35L41_SPI_2), + SND_PCI_QUIRK(0x1043, 0x1c62, "ASUS GU603", ALC289_FIXUP_ASUS_GA401), + SND_PCI_QUIRK(0x1043, 0x1c63, "ASUS GU605M", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1), ++ SND_PCI_QUIRK(0x1043, 0x1034, "ASUS GU605C", ALC285_FIXUP_ASUS_GU605_SPI_SPEAKER2_TO_DAC1), + SND_PCI_QUIRK(0x1043, 0x1c80, "ASUS VivoBook TP401", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS), + SND_PCI_QUIRK(0x1043, 0x1c9f, "ASUS G614JU/JV/JI", ALC285_FIXUP_ASUS_HEADSET_MIC), diff --git a/hosts/himalia/hardware/gu605c-spi-cs-gpio/default.nix b/hosts/himalia/hardware/gu605c-spi-cs-gpio/default.nix new file mode 100644 index 0000000..27b999f --- /dev/null +++ b/hosts/himalia/hardware/gu605c-spi-cs-gpio/default.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: +pkgs.stdenv.mkDerivation rec { + pname = "asus-gu605c-acpi"; + version = "0.0.1"; + + src = ./gu605c-spi-cs-gpio.asl; + + nativeBuildInputs = [ + pkgs.acpica-tools + pkgs.cpio + ]; + + phases = [ + "buildPhase" + "installPhase" + ]; + + buildPhase = '' + mkdir -p kernel/firmware/acpi + iasl -we -p kernel/firmware/acpi/${pname} ${src} + find kernel | cpio -H newc -o > ${pname}.cpio + ''; + + installPhase = '' + mkdir -p $out + cp ${pname}.cpio $out/ + ''; +} diff --git a/hosts/himalia/hardware/gu605c-spi-cs-gpio/gu605c-spi-cs-gpio.asl b/hosts/himalia/hardware/gu605c-spi-cs-gpio/gu605c-spi-cs-gpio.asl new file mode 100644 index 0000000..2c63ac9 --- /dev/null +++ b/hosts/himalia/hardware/gu605c-spi-cs-gpio/gu605c-spi-cs-gpio.asl @@ -0,0 +1,30 @@ +/* + * This is an SSDT file. + */ + +DefinitionBlock ("", "SSDT", 2, "Cirrus", "CsGpios", 0x00001000) +{ + External (_SB_.PC00.SPI0, DeviceObj) + External (_SB_.PC00.SPI0.SPK1, DeviceObj) + + Scope (_SB.PC00.SPI0) + { + Name (_DSD, Package () + { + ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + + Package () + { + Package () + { + "cs-gpios", + Package () + { + 0, // Native CS0 + SPK1, 0, 0, 0, // first GPIO declared in SPK1 + } + }, + } + }) + } +}