Commit 461446394e44
Changed files (2)
systems
common
services
okinawa
systems/common/services/pipewire.nix
@@ -22,6 +22,23 @@
["bluez5.headset-roles"] = "[ hsp_hs hsp_ag hfp_hf hfp_ag ]"
}
'')
+ # ALSA soft-mixer support for proper hardware mixer control
+ # Fixes issues with ASUS laptops where hardware amplifiers aren't
+ # properly controlled by PipeWire (e.g., G14 AMP1/AMP2)
+ (pkgs.writeTextDir "share/wireplumber/wireplumber.conf.d/99-alsasoftvol.conf" ''
+ monitor.alsa.rules = [
+ {
+ matches = [
+ { device.name = "~alsa_card.*" }
+ ]
+ actions = {
+ update-props = {
+ api.alsa.soft-mixer = true
+ }
+ }
+ }
+ ]
+ '')
];
};
};
systems/okinawa/extra.nix
@@ -201,6 +201,9 @@
# Development
python3
uv
+
+ # Audio utilities for G14 fix
+ alsa-utils # amixer, alsactl for AMP control
];
# Prometheus node exporter (configured in common module)
@@ -212,4 +215,50 @@
HandleLidSwitchExternalPower = "ignore";
HandleLidSwitchDocked = "ignore";
};
+
+ # ASUS G14 2022 Audio Fix
+ # Fixes subwoofer/speaker volume sync issues where hardware amplifiers
+ # (AMP1/AMP2) don't follow system volume controls
+ systemd.services.asus-g14-audio-fix = {
+ description = "ASUS G14 Audio Amplifier Initialization";
+ after = [
+ "sound.target"
+ "alsa-restore.service"
+ ];
+ wantedBy = [
+ "multi-user.target"
+ "post-resume.target"
+ ];
+
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ ExecStart = pkgs.writeShellScript "g14-audio-init" ''
+ # Find the correct card (Ryzen HD Audio Controller)
+ CARD=$(${pkgs.alsa-utils}/bin/aplay -l | grep "Ryzen HD Audio Controller" | head -1 | sed 's/card \([0-9]\).*/\1/')
+
+ if [ -z "$CARD" ]; then
+ echo "ERROR: Could not find Ryzen HD Audio Controller card"
+ exit 1
+ fi
+
+ echo "Initializing G14 audio on card $CARD"
+
+ # Set Master volume
+ ${pkgs.alsa-utils}/bin/amixer -c "$CARD" sset Master 80% unmute || true
+
+ # Set AMP1 Speaker (subwoofer control)
+ ${pkgs.alsa-utils}/bin/amixer -c "$CARD" sset 'AMP1 Speaker' 100% unmute || true
+
+ # Set AMP2 Speaker (subwoofer control)
+ ${pkgs.alsa-utils}/bin/amixer -c "$CARD" sset 'AMP2 Speaker' 100% unmute || true
+
+ # Additional common controls
+ ${pkgs.alsa-utils}/bin/amixer -c "$CARD" sset Speaker 100% unmute || true
+ ${pkgs.alsa-utils}/bin/amixer -c "$CARD" sset Headphone 80% unmute || true
+
+ echo "G14 audio initialization complete"
+ '';
+ };
+ };
}