mirror of
https://github.com/NixOS/nixos-hardware.git
synced 2026-12-04 15:03:29 +01:00
raspberry-pi: migrate audio to firmware configuration
This commit is contained in:
1 parent
b6ca87f78e
commit
e2035d2e51
4 files changed
+94
-48
No files matched your search
@@ -1,50 +1,11 @@
|
||||
{ lib, ... }:
|
||||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.hardware.raspberry-pi."4".audio;
|
||||
in
|
||||
{
|
||||
options.hardware = {
|
||||
raspberry-pi."4".audio = {
|
||||
enable = lib.mkEnableOption "configuration for audio";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.deviceTree = {
|
||||
overlays = [
|
||||
# Equivalent to dtparam=audio=on
|
||||
{
|
||||
name = "audio-on-overlay";
|
||||
dtsText = ''
|
||||
/dts-v1/;
|
||||
/plugin/;
|
||||
/ {
|
||||
compatible = "brcm,bcm2711";
|
||||
fragment@0 {
|
||||
target = <&audio>;
|
||||
|
||||
__overlay__ {
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
};
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# set tsched=0 in pulseaudio config to avoid audio glitches
|
||||
# see https://wiki.archlinux.org/title/PulseAudio/Troubleshooting#Glitches,_skips_or_crackling
|
||||
hardware.pulseaudio.configFile = lib.mkOverride 990 (
|
||||
pkgs.runCommand "default.pa" { } ''
|
||||
sed 's/module-udev-detect$/module-udev-detect tsched=0/' ${config.hardware.pulseaudio.package}/etc/pulse/default.pa > $out
|
||||
''
|
||||
);
|
||||
};
|
||||
imports = [
|
||||
../common
|
||||
(lib.mkRenamedOptionModule
|
||||
[ "hardware" "raspberry-pi" "4" "audio" "enable" ]
|
||||
[ "hardware" "raspberry-pi" "audio" "enable" ]
|
||||
)
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user