1
0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-06-02 11:03:33 +02:00

Merge branch 'master' into patch-2

This commit is contained in:
mergify[bot] 2024-01-05 08:54:59 +00:00 committed by GitHub
commit 946a0c4bdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 212 additions and 83 deletions

View File

@ -147,6 +147,7 @@ See code for all available configurations.
| [Google Pixelbook](google/pixelbook) | `<nixos-hardware/google/pixelbook>` |
| [HP Elitebook 2560p](hp/elitebook/2560p) | `<nixos-hardware/hp/elitebook/2560p>` |
| [HP Elitebook 845g7](hp/elitebook/845/g7) | `<nixos-hardware/hp/elitebook/845/g7>` |
| [HP Elitebook 845g8](hp/elitebook/845/g8) | `<nixos-hardware/hp/elitebook/845/g8>` |
| [HP Elitebook 845g9](hp/elitebook/845/g9) | `<nixos-hardware/hp/elitebook/845/g9>` |
| [HP Notebook 14-df0023](hp/notebook/14-df0023) | `<nixos-hardware/hp/notebook/14-df0023>` |
| [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `<nixos-hardware/nxp/imx8qm-mek>` |
@ -265,4 +266,5 @@ See code for all available configurations.
| [System76 Darter Pro 6](system76/darp6) | `<nixos-hardware/system76/darp6>` |
| [Toshiba Chromebook 2 `swanky`](toshiba/swanky) | `<nixos-hardware/toshiba/swanky>` |
| [Tuxedo InfinityBook v4](tuxedo/infinitybook/v4) | `<nixos-hardware/tuxedo/infinitybook/v4>` |
| [TUXEDO InfinityBook Pro 14 - Gen7](tuxedo/infinitybook/pro14/gen7) | `<nixos-hardware/tuxedo/infinitybook/pro14/gen7>` |
| [TUXEDO Pulse 15 - Gen2](tuxedo/pulse/15/gen2) | `<nixos-hardware/tuxedo/pulse/15/gen2>` |

View File

@ -1,4 +1,4 @@
{ lib, pkgs, ... }:
{ lib, pkgs, ... }:
{
# Sets the kernel version to the latest kernel to make the usage of the iGPU possible if your kernel version is too old
@ -10,7 +10,7 @@
boot = lib.mkMerge [
(lib.mkIf (lib.versionOlder pkgs.linux.version "6.1") {
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["amdgpu.sg_display=0"];
kernelParams = ["amdgpu.sg_display=0"];
})
(lib.mkIf (lib.versionAtLeast pkgs.linux.version "6.2") {

View File

@ -16,6 +16,12 @@
# Without this we get errors in dmesg on boot and hangs when shutting down.
boot.blacklistedKernelModules = [ "psmouse" ];
# enable finger print sensor.
# this has to be configured with `sudo fprintd-enroll <username>`.
services.fprintd.enable = true;
services.fprintd.tod.enable = true;
services.fprintd.tod.driver = pkgs.libfprint-2-tod1-goodix;
# Allows for updating firmware via `fwupdmgr`.
services.fwupd.enable = true;
}

View File

@ -82,6 +82,7 @@
gpd-win-max-2-2023 = import ./gpd/win-max-2/2023;
hp-elitebook-2560p = import ./hp/elitebook/2560p;
hp-elitebook-845g7 = import ./hp/elitebook/845/g7;
hp-elitebook-845g8 = import ./hp/elitebook/845/g8;
hp-elitebook-845g9 = import ./hp/elitebook/845/g9;
hp-notebook-14-df0023 = import ./hp/notebook/14-df0023;
intel-nuc-8i7beh = import ./intel/nuc/8i7beh;
@ -96,6 +97,7 @@
lenovo-legion-16ach6h-nvidia = import ./lenovo/legion/16ach6h/nvidia;
lenovo-legion-16achg6-hybrid = import ./lenovo/legion/16achg6/hybrid;
lenovo-legion-16achg6-nvidia = import ./lenovo/legion/16achg6/nvidia;
lenovo-legion-16aph8 = import ./lenovo/legion/16aph8;
lenovo-legion-16ithg6 = import ./lenovo/legion/16ithg6;
lenovo-legion-16irx8h = import ./lenovo/legion/16irx8h;
lenovo-legion-y530-15ich = import ./lenovo/legion/15ich;
@ -208,6 +210,7 @@
system76-darp6 = import ./system76/darp6;
toshiba-swanky = import ./toshiba/swanky;
tuxedo-infinitybook-v4 = import ./tuxedo/infinitybook/v4;
tuxedo-infinitybook-pro14-gen7 = import ./tuxedo/infinitybook/pro14/gen7;
tuxedo-pulse-15-gen2 = import ./tuxedo/pulse/15/gen2;
common-cpu-amd = import ./common/cpu/amd;

View File

@ -27,3 +27,43 @@ As of firmware v03.03, a bug in the EC causes the system to wake if AC is connec
```
See [Framework AMD Ryzen 7040 Series lid wakeup behavior feedback](https://community.frame.work/t/tracking-framework-amd-ryzen-7040-series-lid-wakeup-behavior-feedback/39128/45).
## Getting the fingerprint sensor to work
The firmware on the fingerprint sensor needs a downgrade to make it work on Linux.
The process is documented [here](https://knowledgebase.frame.work/en_us/updating-fingerprint-reader-firmware-on-linux-for-13th-gen-and-amd-ryzen-7040-series-laptops-HJrvxv_za).
However on recent NixOS versions also fwupd can no longer update the firmware.
Using the following snippet allows to temporarly downgrade fwupd to an old-enough version:
```nix
{
services.fwupd.enable = true;
# we need fwupd 1.9.7 to downgrade the fingerprint sensor firmware
services.fwupd.package = (import (builtins.fetchTarball {
url = "https://github.com/NixOS/nixpkgs/archive/bb2009ca185d97813e75736c2b8d1d8bb81bde05.tar.gz";
sha256 = "sha256:003qcrsq5g5lggfrpq31gcvj82lb065xvr7bpfa8ddsw8x4dnysk";
}) {
inherit (pkgs) system;
}).fwupd;
}
```
Afterwards the downgraded driver can be downloaded and installed like this:
```
wget https://github.com/FrameworkComputer/linux-docs/raw/main/goodix-moc-609c-v01000330.cab
sudo fwupdtool install --allow-reinstall --allow-older goodix-moc-609c-v01000330.cab
Loading… [ - ]/nix/store/1n2l5law9g3b77hcfyp50vrhhssbrj5g-glibc-2.37-8/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/f55npw04a2s6xmrbx4jw12xq16b3avb8-gvfs-1.52.1/lib/gio/modules/libgvfsdbus.so)
Failed to load module: /nix/store/f55npw04a2s6xmrbx4jw12xq16b3avb8-gvfs-1.52.1/lib/gio/modules/libgvfsdbus.so
Loading… [ ]12:16:46.348 FuHistory schema version 9 is unknown
Writing… [************************************* ]12:16:57.055 FuEngine failed to update-cleanup after failed update: failed to get device before update cleanup: failed to wait for detach replug: device d432baa2162a32c1554ef24bd8281953b9d07c11 did not come back
failed to write: failed to reply: transfer timed out
```
The error message above is harmless. After a reboot, I was able to enroll my fingerprint like this:
```
sudo fprintd-enroll $USER
```

View File

@ -0,0 +1,25 @@
{ pkgs, lib, ... }:
{
imports =
[
../../../../common/cpu/amd
../../../../common/cpu/amd/pstate.nix
../../../../common/gpu/amd
../../../../common/pc/laptop
../../../../common/pc/laptop/acpi_call.nix
../../../../common/pc/laptop/ssd
];
hardware.enableRedistributableFirmware = lib.mkDefault true;
boot.kernelModules = [ "synaptics_usb" ];
boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest);
# disable Scatter/Gather APU recently enabled by default,
# which results in white screen after display reconfiguration
boot.kernelParams = [ "amdgpu.sg_display=0" ];
services.xserver = {
videoDrivers = [ "amdgpu" ];
};
}

View File

@ -0,0 +1,38 @@
I was unable to get the hybrid settings working well with lightdm or sddm, but Optimus Sync
mode seems to work the best for me.
I am running the Linux 6.6 LTS kernel with KDE + SDDM, and it seems to be working well.
## hardware-configuration.nix
I have the following customizations added for my nvidia drivers.
```
hardware.nvidia = {
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
```
## Setup at the time of testing
### nix-info
```
$ nix-info -m
- system: `"x86_64-linux"`
- host os: `Linux 6.6.8, NixOS, 23.11 (Tapir), 23.11.20231231.32f6357`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.1`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
```
### lspci
```
$ lspci
...
01:00.0 VGA compatible controller: NVIDIA Corporation AD107M [GeForce RTX 4060 Max-Q / Mobile] (rev a1)
...
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Phoenix1 (rev c2)
...
```

View File

@ -0,0 +1,39 @@
{ lib, pkgs, ... }:
{
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/amd
../../../common/gpu/nvidia
../../../common/pc/laptop
../../../common/pc/laptop/ssd
];
# Use latest LTS kernel for more Raphael fixes
boot = lib.mkMerge [
(lib.mkIf (lib.versionOlder pkgs.linux.version "6.6") {
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = ["amdgpu.sg_display=0"];
})
];
hardware.nvidia = {
modesetting.enable = lib.mkDefault true;
powerManagement.enable = lib.mkDefault false;
powerManagement.finegrained = lib.mkDefault false;
open = lib.mkDefault false;
prime = {
sync.enable = lib.mkDefault true;
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Avoid issues with modesetting causing blank screen
services.xserver.videoDrivers = [ "nvidia" ];
# AMD has better battery life with PPD over TLP:
# https://community.frame.work/t/responded-amd-7040-sleep-states/38101/13
services.power-profiles-daemon.enable = lib.mkDefault true;
}

View File

@ -28,7 +28,7 @@ let
in {
options.microsoft-surface.kernelVersion = mkOption {
type = types.enum [ version ];
type = types.enum [ version majorVersion ];
};
config = mkIf (cfg.kernelVersion == version || cfg.kernelVersion == majorVersion) {

View File

@ -1,78 +1,26 @@
{ callPackage, pkgsBuildHost, writeText, writeShellApplication
, stdenv, dtc, mtdutils, coreutils }:
let
uboot = callPackage ./uboot.nix { };
opensbi = callPackage ./opensbi.nix {
withPayload = "${uboot}/u-boot.bin";
withFDT = "${uboot}/starfive_visionfive2.dtb";
};
spl-tool = pkgsBuildHost.callPackage ./spl-tool.nix { };
its-file = writeText "visionfive2-uboot-fit-image.its" ''
/dts-v1/;
{ callPackage
, writeShellApplication
, stdenv
, mtdutils
}:
/ {
description = "U-boot-spl FIT image for JH7110 VisionFive2";
#address-cells = <2>;
images {
firmware {
description = "u-boot";
data = /incbin/("${opensbi}/share/opensbi/lp64/generic/firmware/fw_payload.bin");
type = "firmware";
arch = "riscv";
os = "u-boot";
load = <0x0 0x40000000>;
entry = <0x0 0x40000000>;
compression = "none";
};
};
configurations {
default = "config-1";
config-1 {
description = "U-boot-spl FIT config for JH7110 VisionFive2";
firmware = "firmware";
};
};
};
'';
in rec {
inherit opensbi uboot;
spl = stdenv.mkDerivation {
name = "starfive-visionfive2-spl";
depsBuildBuild = [ spl-tool ];
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/share/starfive-visionfive2/
ln -s ${uboot}/u-boot-spl.bin .
spl_tool -c -f ./u-boot-spl.bin
cp u-boot-spl.bin.normal.out $out/share/starfive-visionfive2/spl.bin
'';
};
uboot-fit-image = stdenv.mkDerivation {
name = "starfive-visionfive2-uboot-fit-image";
nativeBuildInputs = [ dtc ];
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/share/starfive-visionfive2/
${uboot}/mkimage -f ${its-file} -A riscv -O u-boot -T firmware $out/share/starfive-visionfive2/visionfive2_fw_payload.img
'';
};
rec {
opensbi = callPackage ./opensbi.nix { };
uboot = callPackage ./uboot.nix { inherit opensbi; };
updater-flash = writeShellApplication {
name = "visionfive2-firmware-update-flash";
runtimeInputs = [ mtdutils ];
text = ''
flashcp -v ${spl}/share/starfive-visionfive2/spl.bin /dev/mtd0
flashcp -v ${uboot-fit-image}/share/starfive-visionfive2/visionfive2_fw_payload.img /dev/mtd1
flashcp -v ${uboot}/u-boot-spl.bin.normal.out /dev/mtd0
flashcp -v ${uboot}/u-boot.itb /dev/mtd2
'';
};
updater-sd = writeShellApplication {
name = "visionfive2-firmware-update-sd";
runtimeInputs = [ ];
text = ''
dd if=${spl}/share/starfive-visionfive2/spl.bin of=/dev/mmcblk0p1 conv=fsync
dd if=${uboot-fit-image}/share/starfive-visionfive2/visionfive2_fw_payload.img of=/dev/mmcblk0p2 conv=fsync
dd if=${uboot}/u-boot-spl.bin.normal.out of=/dev/mmcblk0p1 conv=fsync
dd if=${uboot}/u-boot.itb of=/dev/mmcblk0p2 conv=fsync
'';
};
}

View File

@ -1,14 +1,13 @@
{ opensbi, withPayload, withFDT }:
{ opensbi }:
(opensbi.override {
inherit withPayload withFDT;
}).overrideAttrs (attrs: {
opensbi.overrideAttrs (attrs: {
makeFlags = attrs.makeFlags ++ [
# opensbi generic platform default FW_TEXT_START is 0x80000000
# For JH7110, need to specify the FW_TEXT_START to 0x40000000
# Otherwise, the fw_payload.bin downloading via jtag will not run.
# https://github.com/starfive-tech/VisionFive2/blob/7733673d27052dc5a48f1cb1d060279dfa3f0241/Makefile#L274
# Also matches u-boot documentation: https://docs.u-boot.org/en/latest/board/starfive/visionfive2.html
"FW_TEXT_START=0x40000000"
"FW_OPTIONS=0"
];
})

View File

@ -36,10 +36,10 @@ in {
EOF
eval $(partx $img -o START,SECTORS --nr 1 --pairs)
dd conv=notrunc if=${firmware.spl}/share/starfive-visionfive2/spl.bin of=$img seek=$START count=$SECTORS
dd conv=notrunc if=${firmware.uboot}/u-boot-spl.bin.normal.out of=$img seek=$START count=$SECTORS
eval $(partx $img -o START,SECTORS --nr 2 --pairs)
dd conv=notrunc if=${firmware.uboot-fit-image}/share/starfive-visionfive2/visionfive2_fw_payload.img of=$img seek=$START count=$SECTORS
dd conv=notrunc if=${firmware.uboot}/u-boot.itb of=$img seek=$START count=$SECTORS
'';
populateRootCommands = ''

View File

@ -1,20 +1,36 @@
{ fetchFromGitHub, buildUBoot }:
{ lib
, fetchFromGitHub
, buildUBoot
, buildPackages
, opensbi
}:
buildUBoot rec {
version = "3.8.2";
version = "2024.01-rc5";
src = fetchFromGitHub {
owner = "starfive-tech";
owner = "u-boot";
repo = "u-boot";
rev = "refs/tags/VF2_v${version}";
hash = "sha256-M/ndil++spcJCYnpYLb+fuxqCi4H3BunXdHbl529ovM=";
rev = "refs/tags/v${version}";
hash = "sha256-QlwgvnSaXh39z9AM7HNF731lRiUkPbN3oQyioQNTYFA=";
};
# workaround for https://github.com/NixOS/nixpkgs/pull/146634
# uboot: only apply raspberry pi patches to raspberry pi builds
patches = [ ];
extraMakeFlags = [
# workaround for https://github.com/NixOS/nixpkgs/pull/277997
# buildUBoot: specify absolute path of dtc, fix building u-boot 2023.10+
"DTC=${lib.getExe buildPackages.dtc}"
"OPENSBI=${opensbi}/share/opensbi/lp64/generic/firmware/fw_dynamic.bin"
];
defconfig = "starfive_visionfive2_defconfig";
filesToInstall = [
"u-boot.bin"
"arch/riscv/dts/starfive_visionfive2.dtb"
"spl/u-boot-spl.bin"
"tools/mkimage"
"spl/u-boot-spl.bin.normal.out"
"u-boot.itb"
];
}

View File

@ -0,0 +1 @@
# [TUXEDO InfinityBook Pro 14 - Gen7](https://www.tuxedocomputers.com/de/TUXEDO-InfinityBook-Pro-14-Gen7.tuxedo)

View File

@ -0,0 +1,12 @@
{ lib, ... }:
{
imports = [
../../../../common/cpu/intel
../../../../common/pc/laptop
../../../../common/pc/ssd
];
# Cooling management
services.thermald.enable = lib.mkDefault true;
}