mirror of
				https://github.com/NixOS/nixos-hardware.git
				synced 2025-11-04 17:27:14 +08:00 
			
		
		
		
	Add a config for Asus Zephyrus GA402X* (2023) series
- Disable power-saving for the keyboard on the Asus Zephyrus GA402X series (2023) - Add more-aggressive roaming rules for Asus Mediatek cards when using IWD - Add note about potentially needing more-aggressive roaming rules for Asus Mediatek cards when using WPA-Supplicant - Make enabling the higher scanning optional - Split-up the AMD-GPU and Nvidia configs - Add switch for AMD-GPU recovery mode - Add switch for AMD-GPU sg_display (Scatter/Gather) mode - Add switch for AMD-GPU PSR support
This commit is contained in:
		
							
								
								
									
										58
									
								
								asus/zephyrus/ga402x/amdgpu/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								asus/zephyrus/ga402x/amdgpu/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
{ config,
 | 
			
		||||
  lib,
 | 
			
		||||
  pkgs,
 | 
			
		||||
  ...
 | 
			
		||||
}:
 | 
			
		||||
 | 
			
		||||
let
 | 
			
		||||
  inherit (lib) mkDefault mkEnableOption mkIf mkMerge;
 | 
			
		||||
  cfg = config.hardware.asus.zephyrus.ga402x;
 | 
			
		||||
 | 
			
		||||
in {
 | 
			
		||||
  imports = [
 | 
			
		||||
    ../shared.nix
 | 
			
		||||
  ];
 | 
			
		||||
 | 
			
		||||
  options.hardware.asus.zephyrus.ga402x.amdgpu = {
 | 
			
		||||
    recovery.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = false; };
 | 
			
		||||
    sg_display.enable = (mkEnableOption "Enable amdgpu.gpu_recovery kernel boot param") // { default = true; };
 | 
			
		||||
    psr.enable = (mkEnableOption "Enable amdgpu.dcdebugmask=0x10 kernel boot param") // { default = true; };
 | 
			
		||||
  };
 | 
			
		||||
 | 
			
		||||
  config = mkMerge [
 | 
			
		||||
    {
 | 
			
		||||
      # AMD RX680
 | 
			
		||||
      services.xserver.videoDrivers = mkDefault [ "amdgpu" ];
 | 
			
		||||
 | 
			
		||||
      hardware = {
 | 
			
		||||
        amdgpu.loadInInitrd = true;
 | 
			
		||||
        opengl.extraPackages = with pkgs; [
 | 
			
		||||
          vaapiVdpau
 | 
			
		||||
          libvdpau-va-gl
 | 
			
		||||
        ];
 | 
			
		||||
      };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    (mkIf cfg.amdgpu.recovery.enable {
 | 
			
		||||
      # Hopefully fixes for where the kernel sometimes hangs when suspending or hibernating
 | 
			
		||||
      #  (Though, I'm very suspicious of the Mediatek Wifi...)
 | 
			
		||||
      boot.kernelParams = [
 | 
			
		||||
        "amdgpu.gpu_recovery=1"
 | 
			
		||||
      ];
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    (mkIf (!cfg.amdgpu.sg_display.enable) {
 | 
			
		||||
      # Can help solve flickering/glitching display issues since Scatter/Gather code was reenabled
 | 
			
		||||
      boot.kernelParams = [
 | 
			
		||||
        "amdgpu.sg_display=0"
 | 
			
		||||
      ];
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
    (mkIf (!cfg.amdgpu.psr.enable) {
 | 
			
		||||
      # Can help solve flickering/glitching display issues since Scatter/Gather code was reenabled
 | 
			
		||||
      boot.kernelParams = [
 | 
			
		||||
        "amdgpu.dcdebugmask=0x10"
 | 
			
		||||
      ];
 | 
			
		||||
    })
 | 
			
		||||
  ];
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user