|
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=lenovo-legion-7i" |
| 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 | + # More aggressive TAS2781 fixes for Legion |
| 35 | + "snd_soc_tas2781.tas2781_dev_id=0x6a" |
| 36 | + "snd_hda_intel.single_cmd=1" |
| 37 | + # Hardware fixes |
| 38 | + "tsc=reliable" # Fix TSC ADJUST firmware bugs common on Legion laptops |
| 39 | + # ACPI thermal management fixes for Legion BIOS issues |
| 40 | + "acpi.debug_layer=0x2" |
| 41 | + "acpi.debug_level=0x2" |
| 42 | + "processor.ignore_ppc=1" |
| 43 | + ]; |
| 44 | + |
| 45 | + # Additional audio configuration for Legion Pro 7 |
| 46 | + boot.extraModprobeConfig = '' |
| 47 | + # Force specific Legion audio model for proper speaker routing |
| 48 | + options snd-hda-intel model=lenovo-legion-7i single_cmd=1 probe_mask=1 |
| 49 | + # TAS2781 specific options |
| 50 | + options snd-soc-tas2781-comlib reset_calib=1 |
| 51 | + options snd-hda-scodec-tas2781-i2c reset_calib=1 |
| 52 | + ''; |
| 53 | + |
| 54 | + # Hardware firmware support for Legion audio |
| 55 | + hardware.enableRedistributableFirmware = lib.mkDefault true; |
| 56 | + |
| 57 | + # Enable Bluetooth modules |
| 58 | + boot.kernelModules = [ |
| 59 | + "bluetooth" |
| 60 | + "btusb" |
| 61 | + ]; |
| 62 | + |
22 | 63 | hardware = {
|
23 | 64 | nvidia = {
|
24 | 65 | modesetting.enable = lib.mkDefault true;
|
25 | 66 | powerManagement.enable = lib.mkDefault true;
|
26 |
| - # |
27 | 67 | prime = {
|
28 | 68 | intelBusId = "PCI:00:02:0";
|
29 | 69 | nvidiaBusId = "PCI:01:00:0";
|
30 | 70 | };
|
31 | 71 | };
|
| 72 | + |
| 73 | + # Enable Bluetooth with Legion-optimized settings |
| 74 | + bluetooth = { |
| 75 | + enable = lib.mkDefault true; |
| 76 | + powerOnBoot = lib.mkDefault false; # Save battery |
| 77 | + settings = { |
| 78 | + General = { |
| 79 | + ControllerMode = "dual"; |
| 80 | + FastConnectable = "true"; |
| 81 | + Experimental = "true"; # Enable LE Audio features |
| 82 | + KernelExperimental = "true"; # Enable ISO socket support |
| 83 | + }; |
| 84 | + }; |
| 85 | + }; |
32 | 86 | };
|
33 | 87 |
|
34 |
| - # Cooling management |
| 88 | + # Cooling management for Legion laptops |
35 | 89 | services.thermald.enable = lib.mkDefault true;
|
36 | 90 |
|
| 91 | + # Audio group permissions |
| 92 | + users.groups.audio = { }; |
| 93 | + |
37 | 94 | # √(2560² + 1600²) px / 16 in ≃ 189 dpi
|
38 | 95 | services.xserver.dpi = 189;
|
39 | 96 | }
|
0 commit comments