From 745dd440719439197ee7821ad61fff1de557b55d Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 14 Aug 2021 17:17:21 +0200 Subject: [PATCH] raspberry-pi/4: Add audio option --- raspberry-pi/4/audio.nix | 40 ++++++++++++++++++++++++++++++++++++++ raspberry-pi/4/default.nix | 1 + 2 files changed, 41 insertions(+) create mode 100644 raspberry-pi/4/audio.nix diff --git a/raspberry-pi/4/audio.nix b/raspberry-pi/4/audio.nix new file mode 100644 index 0000000..3ee189a --- /dev/null +++ b/raspberry-pi/4/audio.nix @@ -0,0 +1,40 @@ +{ 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"; + }; + }; + }; + ''; + } + ]; + }; + }; +} + diff --git a/raspberry-pi/4/default.nix b/raspberry-pi/4/default.nix index 3699190..2fe97e1 100644 --- a/raspberry-pi/4/default.nix +++ b/raspberry-pi/4/default.nix @@ -2,6 +2,7 @@ { imports = [ + ./audio.nix ./dwc2.nix ./modesetting.nix ./poe-hat.nix