|  | 
| 19 | 19 |     config.boot.kernelPackages.nvidia_x11 | 
| 20 | 20 |   ]; | 
| 21 | 21 | 
 | 
|  | 22 | +  # Comprehensive audio fixes for Legion Pro 7 16IRX8H | 
|  | 23 | +  # This model has both Realtek ALC287 and TAS2781 audio components | 
|  | 24 | +  # The TAS2781 I2C codec binds to the HDA subsystem and requires special handling | 
|  | 25 | +  boot.kernelParams = [ | 
|  | 26 | +    # Audio configuration | 
|  | 27 | +    "snd_hda_intel.enable_msi=1" | 
|  | 28 | +    # Legion-specific audio model (required until kernel quirk is upstreamed) | 
|  | 29 | +    "snd_hda_intel.model=legion-y7000" | 
|  | 30 | +    # TAS2781 calibration reset to handle CRC errors in factory calibration data | 
|  | 31 | +    # This is a known issue on Legion laptops where the TAS2781 firmware has corrupted | 
|  | 32 | +    # calibration values; resetting allows the codec to initialize with defaults | 
|  | 33 | +    "snd_soc_tas2781.reset_calib=1" | 
|  | 34 | +    # Hardware fixes | 
|  | 35 | +    "tsc=reliable" # Fix TSC ADJUST firmware bugs common on Legion laptops | 
|  | 36 | +    # ACPI thermal management fixes for Legion BIOS issues | 
|  | 37 | +    "acpi.debug_layer=0x2" | 
|  | 38 | +    "acpi.debug_level=0x2" | 
|  | 39 | +    "processor.ignore_ppc=1" | 
|  | 40 | +  ]; | 
|  | 41 | + | 
|  | 42 | +  # Additional audio configuration for Legion Pro 7 | 
|  | 43 | +  boot.extraModprobeConfig = '' | 
|  | 44 | +    # Force specific Legion audio model for proper speaker routing | 
|  | 45 | +    options snd-hda-intel model=lenovo-legion-7i | 
|  | 46 | +  ''; | 
|  | 47 | + | 
|  | 48 | +  # Hardware firmware support for Legion audio | 
|  | 49 | +  hardware.enableRedistributableFirmware = lib.mkDefault true; | 
|  | 50 | + | 
|  | 51 | +  # Enable Bluetooth modules | 
|  | 52 | +  boot.kernelModules = [ | 
|  | 53 | +    "bluetooth" | 
|  | 54 | +    "btusb" | 
|  | 55 | +  ]; | 
|  | 56 | + | 
| 22 | 57 |   hardware = { | 
| 23 | 58 |     nvidia = { | 
| 24 | 59 |       modesetting.enable = lib.mkDefault true; | 
| 25 | 60 |       powerManagement.enable = lib.mkDefault true; | 
| 26 |  | -      # | 
| 27 | 61 |       prime = { | 
| 28 | 62 |         intelBusId = "PCI:00:02:0"; | 
| 29 | 63 |         nvidiaBusId = "PCI:01:00:0"; | 
| 30 | 64 |       }; | 
| 31 | 65 |     }; | 
|  | 66 | + | 
|  | 67 | +    # Enable Bluetooth with Legion-optimized settings | 
|  | 68 | +    bluetooth = { | 
|  | 69 | +      enable = lib.mkDefault true; | 
|  | 70 | +      powerOnBoot = lib.mkDefault false; # Save battery | 
|  | 71 | +      settings = { | 
|  | 72 | +        General = { | 
|  | 73 | +          ControllerMode = "dual"; | 
|  | 74 | +          FastConnectable = "true"; | 
|  | 75 | +          Experimental = "true"; # Enable LE Audio features | 
|  | 76 | +          KernelExperimental = "true"; # Enable ISO socket support | 
|  | 77 | +        }; | 
|  | 78 | +      }; | 
|  | 79 | +    }; | 
| 32 | 80 |   }; | 
| 33 | 81 | 
 | 
| 34 |  | -  # Cooling management | 
|  | 82 | +  # Cooling management for Legion laptops | 
| 35 | 83 |   services.thermald.enable = lib.mkDefault true; | 
| 36 | 84 | 
 | 
|  | 85 | +  # Audio group permissions | 
|  | 86 | +  users.groups.audio = { }; | 
|  | 87 | + | 
| 37 | 88 |   # √(2560² + 1600²) px / 16 in ≃ 189 dpi | 
| 38 | 89 |   services.xserver.dpi = 189; | 
| 39 | 90 | } | 
0 commit comments