mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	raspberry-pi/4: Add audio option
This commit is contained in:
		
							
								
								
									
										40
									
								
								raspberry-pi/4/audio.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								raspberry-pi/4/audio.nix
									
									
									
									
									
										Normal file
									
								
							@@ -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";
 | 
			
		||||
                };
 | 
			
		||||
              };
 | 
			
		||||
            };
 | 
			
		||||
          '';
 | 
			
		||||
        }
 | 
			
		||||
      ];
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user