Merge branch 'master' into surface-control

This commit is contained in:
Winter 2021-03-17 15:45:28 -04:00 committed by GitHub
commit 007f1d8a07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 476 additions and 51 deletions

View file

@ -39,7 +39,7 @@ There is also experimental flake support. In your `/etc/nixos/flake.nix` add the
# ... # ...
modules = [ modules = [
# ... # ...
# add your model from this list: https://github.com/NixOS/nixos-hardware/blob/flakes/flake.nix # add your model from this list: https://github.com/NixOS/nixos-hardware/blob/master/flake.nix
nixos-hardware.nixosModules.dell-xps-13-9380 nixos-hardware.nixosModules.dell-xps-13-9380
]; ];
}; };
@ -53,12 +53,12 @@ There is also experimental flake support. In your `/etc/nixos/flake.nix` add the
You can fetch the git repository directly: You can fetch the git repository directly:
```nix ```nix
imports = [ imports = [
"${builtins.fetchGit { url = "https://github.com/NixOS/nixos-hardware.git"; }}/lenovo/thinkpad/x220" "${builtins.fetchGit { url = "https://github.com/NixOS/nixos-hardware.git"; }}/lenovo/thinkpad/x220"
]; ];
``` ```
Unlike the channel, this will update the git repository on a rebuild. However, Unlike the channel, this will update the git repository on a rebuild. However,
you can easily pin to a particular revision if you desire more stability. you can easily pin to a particular revision if you desire more stability.
## List of Profiles ## List of Profiles
@ -81,12 +81,14 @@ See code for all available configurations.
| Dell Precision 5530 | `<nixos-hardware/dell/precision/5530>` | | Dell Precision 5530 | `<nixos-hardware/dell/precision/5530>` |
| [Dell XPS E7240][] | `<nixos-hardware/dell/e7240>` | | [Dell XPS E7240][] | `<nixos-hardware/dell/e7240>` |
| [Dell XPS 13 7390][] | `<nixos-hardware/dell/xps/13-7390>` | | [Dell XPS 13 7390][] | `<nixos-hardware/dell/xps/13-7390>` |
| [Dell XPS 13 9310][] | `<nixos-hardware/dell/xps/13-9310>` |
| [Dell XPS 13 9343][] | `<nixos-hardware/dell/xps/13-9343>` | | [Dell XPS 13 9343][] | `<nixos-hardware/dell/xps/13-9343>` |
| [Dell XPS 13 9360][] | `<nixos-hardware/dell/xps/13-9360>` | | [Dell XPS 13 9360][] | `<nixos-hardware/dell/xps/13-9360>` |
| [Dell XPS 13 9370][] | `<nixos-hardware/dell/xps/13-9370>` | | [Dell XPS 13 9370][] | `<nixos-hardware/dell/xps/13-9370>` |
| [Dell XPS 13 9380][] | `<nixos-hardware/dell/xps/13-9380>` | | [Dell XPS 13 9380][] | `<nixos-hardware/dell/xps/13-9380>` |
| [Dell XPS 15 7590][] | `<nixos-hardware/dell/xps/15-7590>` | | [Dell XPS 15 7590][] | `<nixos-hardware/dell/xps/15-7590>` |
| [Dell XPS 15 9550][] | `<nixos-hardware/dell/xps/15-9550>` | | [Dell XPS 15 9550][] | `<nixos-hardware/dell/xps/15-9550>` |
| [Dell XPS 15 9550, nvidia][] | `<nixos-hardware/dell/xps/15-9550/nvidia>` |
| [Dell XPS 15 9560][] | `<nixos-hardware/dell/xps/15-9560>` | | [Dell XPS 15 9560][] | `<nixos-hardware/dell/xps/15-9560>` |
| [Dell XPS 15 9560, intel only][] | `<nixos-hardware/dell/xps/15-9560/intel>` | | [Dell XPS 15 9560, intel only][] | `<nixos-hardware/dell/xps/15-9560/intel>` |
| [Dell XPS 15 9560, nvidia only][] | `<nixos-hardware/dell/xps/15-9560/nvidia>` | | [Dell XPS 15 9560, nvidia only][] | `<nixos-hardware/dell/xps/15-9560/nvidia>` |
@ -116,6 +118,7 @@ See code for all available configurations.
| Lenovo ThinkPad T480s | `<nixos-hardware/lenovo/thinkpad/t480s>` | | Lenovo ThinkPad T480s | `<nixos-hardware/lenovo/thinkpad/t480s>` |
| Lenovo ThinkPad T490 | `<nixos-hardware/lenovo/thinkpad/t490>` | | Lenovo ThinkPad T490 | `<nixos-hardware/lenovo/thinkpad/t490>` |
| Lenovo ThinkPad T495 | `<nixos-hardware/lenovo/thinkpad/t495>` | | Lenovo ThinkPad T495 | `<nixos-hardware/lenovo/thinkpad/t495>` |
| Lenovo ThinkPad X113 Yoga | `<nixos-hardware/lenovo/thinkpad/x13-yoga>` |
| Lenovo ThinkPad X140e | `<nixos-hardware/lenovo/thinkpad/x140e>` | | Lenovo ThinkPad X140e | `<nixos-hardware/lenovo/thinkpad/x140e>` |
| Lenovo ThinkPad X220 | `<nixos-hardware/lenovo/thinkpad/x220>` | | Lenovo ThinkPad X220 | `<nixos-hardware/lenovo/thinkpad/x220>` |
| Lenovo ThinkPad X230 | `<nixos-hardware/lenovo/thinkpad/x230>` | | Lenovo ThinkPad X230 | `<nixos-hardware/lenovo/thinkpad/x230>` |
@ -126,6 +129,7 @@ See code for all available configurations.
| [Lenovo ThinkPad X1 (6th Gen)][] | `<nixos-hardware/lenovo/thinkpad/x1/6th-gen>` | | [Lenovo ThinkPad X1 (6th Gen)][] | `<nixos-hardware/lenovo/thinkpad/x1/6th-gen>` |
| [Lenovo ThinkPad X1 (7th Gen)][] | `<nixos-hardware/lenovo/thinkpad/x1/7th-gen>` | | [Lenovo ThinkPad X1 (7th Gen)][] | `<nixos-hardware/lenovo/thinkpad/x1/7th-gen>` |
| Lenovo ThinkPad X1 Extreme Gen 2 | `<nixos-hardware/lenovo/thinkpad/x1-extreme/gen2>` | | Lenovo ThinkPad X1 Extreme Gen 2 | `<nixos-hardware/lenovo/thinkpad/x1-extreme/gen2>` |
| [Microsoft Surface Range][] | `<nixos-hardware/microsoft/surface>` |
| [Microsoft Surface Pro 3][] | `<nixos-hardware/microsoft/surface-pro/3>` | | [Microsoft Surface Pro 3][] | `<nixos-hardware/microsoft/surface-pro/3>` |
| PC Engines APU | `<nixos-hardware/pcengines/apu>` | | PC Engines APU | `<nixos-hardware/pcengines/apu>` |
| [Raspberry Pi 2][] | `<nixos-hardware/raspberry-pi/2>` | | [Raspberry Pi 2][] | `<nixos-hardware/raspberry-pi/2>` |
@ -144,6 +148,7 @@ See code for all available configurations.
[Dell XPS E7240]: dell/e7240 [Dell XPS E7240]: dell/e7240
[Dell XPS 13 7390]: dell/xps/13-7390 [Dell XPS 13 7390]: dell/xps/13-7390
[Dell XPS 13 9343]: dell/xps/13-9343 [Dell XPS 13 9343]: dell/xps/13-9343
[Dell XPS 13 9310]: dell/xps/13-9310
[Dell XPS 13 9360]: dell/xps/13-9360 [Dell XPS 13 9360]: dell/xps/13-9360
[Dell XPS 13 9370]: dell/xps/13-9370 [Dell XPS 13 9370]: dell/xps/13-9370
[Dell XPS 13 9380]: dell/xps/13-9380 [Dell XPS 13 9380]: dell/xps/13-9380
@ -156,6 +161,7 @@ See code for all available configurations.
[Inverse Path USB armory]: inversepath/usbarmory [Inverse Path USB armory]: inversepath/usbarmory
[Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen [Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen
[Lenovo ThinkPad X1 (7th Gen)]: lenovo/thinkpad/x1/7th-gen [Lenovo ThinkPad X1 (7th Gen)]: lenovo/thinkpad/x1/7th-gen
[Lenovo ThinkPad X13 Yoga]: lenovo/thinkpad/x13-yoga
[Lenovo ThinkPad X260]: lenovo/thinkpad/x260 [Lenovo ThinkPad X260]: lenovo/thinkpad/x260
[Microsoft Surface Pro 3]: microsoft/surface-pro/3 [Microsoft Surface Pro 3]: microsoft/surface-pro/3
[Raspberry Pi 2]: raspberry-pi/2 [Raspberry Pi 2]: raspberry-pi/2

View file

@ -0,0 +1,10 @@
{ lib, pkgs, ... }:
{
# This runs only Intel and nvidia does not drain power.
##### disable nvidia, very nice battery life.
hardware.nvidiaOptimus.disable = lib.mkDefault true;
boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "nvidia" ];
services.xserver.videoDrivers = lib.mkDefault [ "intel" ];
}

View file

@ -0,0 +1,258 @@
{ lib, pkgs, ... }: {
imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ];
# Includes the Wi-Fi and Bluetooth firmware for the QCA6390.
hardware.enableRedistributableFirmware = true;
# Wi-Fi currently requires a specific set of patches to function.
# To ensure these patches do not conflict, we pin to a specific version here.
# TODO: Remove this once patches have finally landed in mainline.
boot.kernelPackages = let
linux_patched_pkg =
{ buildLinux, fetchurl, modDirVersionArg ? null, ... }@args:
buildLinux (args // rec {
version = "5.10.18";
modDirVersion = if (modDirVersionArg == null) then
builtins.replaceStrings [ "-" ] [ ".0-" ] version
else
modDirVersionArg;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "04dnkg5j73f6cd8ws1prrrjx37srz7rm66bj6slmnfzp3cmyxh9v";
};
# kvalo qca6390 patches
# https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup
kernelPatches = [
{
name = "add-64-bit-check-before-reading-msi-high-addr";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=065c9528cc508cfbf6e3399582df29f76f56163c";
sha256 = "1mqhwags919vlxllzqh5kj4b2l869swvfwa89jk804a1l4l02fmv";
};
}
{
name = "pci-support-platforms-with-one-msi-vector";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=59c6d022df8efb450f82d33dd6a6812935bd022f";
sha256 = "0sxbb58bnryb9hic1cyc8dzrzachhca7a6hywyzz1pksh9syhs5y";
};
}
{
name = "fix-monitor-status-dma-unmap-direction";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=fa4eea695afb286ae38beb30dabf251335cb4a62";
sha256 = "1sh3d8ck4nlg671j2y8f07394xrqlnbrvh9rmy4l1zfpz7wa7d10";
};
}
{
name = "hook-mhi-suspend-and-resume";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=762fe5bc2dd1e43ef307a375861b1a8c414b14e3";
sha256 = "154p8gp4smmmkhyx127f6rib04xd5bn38a3n4893rbyyb5kckv40";
};
}
{
name = "implement-hif-suspend-and-resume-functions";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=2f164833bcca14e8aec0b2566eae4b5a7d09ee6f";
sha256 = "1ic968y1ivlgfhbj67ds809zqas7n50kc6wb8jgksk227dvagnip";
};
}
{
name = "read-select_window-register-to-ensure-write-is-finished";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=6afab932ece78fedc1538c20c2aefdd13aa6c9d0";
sha256 = "19jiz9mf868rj57ljjdb3n97sfi6x78ac9kgd7fhg1bh0zjjiskp";
};
}
{
name = "implement-htc-suspend-related-callbacks";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=69ab2835b82c176e793195243e1400d4f8db3647";
sha256 = "1gba5h0s6c6zjplw8zyqc2qj21ly1m2xzbgznml159wzj2xvzb2m";
};
}
{
name = "put-target-to-suspend-when-system-enters-suspend-state";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=68023bee4d61ea2b02af49bba00adabba51d8b6b";
sha256 = "05aqdjd5xps0wncrh41r805fn2rpnhw53pn02a374g81bbifwa5q";
};
}
{
name = "pci-print-a-warning-if-firmware-crashed";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=23dcef9436560a033703164c4daff9e36e640969";
sha256 = "0m45wvilr2cgdkpdjzcz4hdzsfs596ibjsvd7sdksjbrp5wslla1";
};
}
{
name = "qmi-print-allocated-memory-segment-addresses-and-sizes";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a327caa4a5a677161a6f1d29514e8cb42236e956";
sha256 = "1id6xz7siw1x2xa00psqvr4h5zb0xd83apy0cyv4jqzkd5x1kwl0";
};
}
{
name = "put-hw-to-dbs-using-mode";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=ce8b5dfc16a0b84ac9ab2d508c2d5e66e8bf179a";
sha256 = "0gcnzn82mjdqy3ly494xfawqb9xvwd01dcdr43cw8ik92jggs4sf";
};
}
{
name = "fix-pcie-link-unstable-issue";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a82a3aee7cde95d533c28cad3749e3c354011896";
sha256 = "0r26g7j7kkm76bippp79vd462ykc8k8p0bxr7pshhkyazs6v1ij3";
};
}
{
name = "fix-pci-l1ss-clock-unstable-problem";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=08816aab67540e6babc558dafa973fc905a9afa1";
sha256 = "180hp6iwgw7cqiiwhp9cnzwr5z9n26pphi2j693x751crzr0xkzw";
};
}
{
name = "disable-otp-write-privilege";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=86c5a1d6983e647a55448c80f94eb8f0aa97dfad";
sha256 = "176g07kpsqnkc3vpfx2lhlrksmdg05m0zxn1i5yfvksczp2215iq";
};
}
{
name = "disable-aspm-l0sls-before-downloading-firmware";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=8bd374e3305359ca0be9fe88e8a1edc1abd537eb";
sha256 = "1grjsf6jvn536cz6wil79l2lzc90ga1c7sisv9j0qac7jzr7x5rz";
};
}
{
name = "purge-rx-pktlog-when-entering-suspend";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=6f481de563dd108bd3df616c80e60f308b7a48e3";
sha256 = "14qd1qv8v3mcslj7crzrw0ib1caa7vbnq7jkq163248658bbmk6p";
};
}
{
name = "set-credit_update-flag-for-flow-controlled-ep-only";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=6e0fba395a054cd58d87b3749f1f4ff2f3fef92e";
sha256 = "0sgjxj6m3fdlgdfg7rv5fajfmbmrccy5asrammlgbc7gh5sn9ac4";
};
}
{
name = "implement-wow-enable-and-wow-wakeup-command";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=cfca935c92d8f2b31c95e7fd074645245f54492a";
sha256 = "0dwbsqkw3f8v676s0x3jv04w0qk36ypvnwh02rx4qfdk38sh0j3j";
};
}
{
name = "add-ce-irq-enable-and-disable-hif-layer-functions";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=9297794a5d5af5e82b9554677f959add281a5b76";
sha256 = "0hl93l8khh36drllxii969nvkb6p4hh28gnjyg0y10adm5q9b4ac";
};
}
{
name = "put-target-to-wow-state-when-suspend-happens";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=d448ef6decab05c499ffc005c56307a6fc1f1abe";
sha256 = "17pgbmsryg96626xpbkzd0c27z71lsy7ygli4c6d4dzk5b9594zn";
};
}
{
name = "vdev-delete-sync-with-fw";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=c1d3ee50859a2d2c132a8461fdabde568df5ee20";
sha256 = "1dscfdqv5x3h024gryh0464mky0j6z681rliiix17kdh172vxx52";
};
}
{
name = "peer-delete-sync-with-fw";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=6244933ddba318b36bb00c48eeb8d63a24a901c2";
sha256 = "0p1663w0lik44gwyfzmxxiwnc3s9n3p46aappla8pbfk9wdgw86d";
};
}
{
name = "start-vdev-if-bss-peer-already-created";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=c58d077298d91c61c2466a50b58181a234474381";
sha256 = "1462w29isnlfqs4bavzprhj48wbzvmwasbzh4djzfnsjm0ld7z90";
};
}
{
name = "hack-mhi-disable-m2-state";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=cdda596d45a99fed1fe74b0605de6b220c955c0b";
sha256 = "0wfmaygzl8fav8lr67pjnhqskm6mh9ykcwqh71ijxvfn0kbq9fqg";
};
}
{
name = "hack-revert-place-pages-to-tail";
patch = pkgs.fetchpatch {
url =
"https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=60fad49a69e7b2f896ce7b1ade4ed532227b8e22";
sha256 = "0zhzjyym42r3rjwh55vk6p423lhz7555mb7xjqk63lczrsc221nm";
};
}
# Extra config required for Bluetooth.
# NOTE: Should consider upstreaming this to the default nix config.
# Especially the `SERIAL_DEV_BUS` and `SERIAL_DEV_CTRL_TTYPORT`
# options, as these are the recommended defaults.
{
name = "enable-qca6390-bluetooth";
patch = null;
extraConfig = ''
BT_QCA m
BT_HCIUART m
BT_HCIUART_QCA y
BT_HCIUART_SERDEV y
SERIAL_DEV_BUS y
SERIAL_DEV_CTRL_TTYPORT y
'';
}
];
# Enable some extra kernel modules for QCA6390 bluetooth.
kernelModules = [ "btqca" "hci_qca" "hci_uart" ];
} // (args.argsOverride or { }));
linux_patched = pkgs.callPackage linux_patched_pkg { };
in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_patched);
# Touchpad goes over i2c.
# Without this we get errors in dmesg on boot and hangs when shutting down.
boot.blacklistedKernelModules = [ "psmouse" ];
# Allows for updating firmware via `fwupdmgr`.
services.fwupd.enable = true;
}

View file

@ -5,12 +5,19 @@ Most of this I presume also applies to the XPS 13 1530, the 13" variant.
== Tested Hardware == == Tested Hardware ==
* CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz * CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
* RAM: 16 GB * RAM: 32 GB
* HDD: 512 GiB SSD * HDD: 512 GiB SSD
* Screen: 15" 4k (3840✕2160) * Screen: 15" 4k (3840✕2160)
* Graphics: NVIDIA Corporation GM107M, with Intel Graphics too. * Graphics: NVIDIA Corporation GM107M, with Intel Graphics too.
* Input: Touchscreen and trackpad. * Input: Touchscreen and trackpad.
== NVIDIA Offload ==
In order to run a program on the NVIDIA gpu, you can use the `nvidia-offload` function, for example:
```
nvidia-offload `nix-shell -p glxinfo --run 'glxgears'`
```
This is a short bash script that sets the proper environment variables and calls your command.
== Firmware Configuration == == Firmware Configuration ==

View file

@ -4,6 +4,8 @@
imports = [ imports = [
../../../common/cpu/intel ../../../common/cpu/intel
../../../common/pc/laptop ../../../common/pc/laptop
# To just use Intel integrated graphics with Intel's open source driver
# ../../../common/gpu/nvidia-disable
]; ];
# TODO: boot loader # TODO: boot loader
@ -12,7 +14,4 @@
# This will save you money and possibly your life! # This will save you money and possibly your life!
services.thermald.enable = true; services.thermald.enable = true;
# To just use Intel integrated graphics with Intel's open source driver
# hardware.nvidiaOptimus.disable = true;
} }

View file

@ -0,0 +1,15 @@
{ lib, pkgs, ... }:
{
imports = [
../default.nix
../../../../common/gpu/nvidia.nix
];
hardware.nvidia.prime = {
# Bus ID of the Intel GPU.
intelBusId = lib.mkDefault "PCI:0:2:0";
# Bus ID of the NVIDIA GPU.
nvidiaBusId = lib.mkDefault "PCI:1:0:0";
};
}

View file

@ -4,15 +4,7 @@
imports = [ imports = [
../../../../common/cpu/intel ../../../../common/cpu/intel
../../../../common/pc/laptop ../../../../common/pc/laptop
../../../../common/gpu/nvidia-disable.nix
../xps-common.nix ../xps-common.nix
]; ];
# This runs only Intel and nvidia does not drain power.
##### disable nvidia, very nice battery life.
hardware.nvidiaOptimus.disable = lib.mkDefault true;
boot.blacklistedKernelModules = lib.mkDefault [ "nouveau" "nvidia" ];
services.xserver.videoDrivers = lib.mkDefault [ "intel" ];
} }

View file

@ -16,12 +16,14 @@
dell-precision-5530 = import ./dell/precision/5530; dell-precision-5530 = import ./dell/precision/5530;
dell-e7240 = import ./dell/e7240; dell-e7240 = import ./dell/e7240;
dell-xps-13-7390 = import ./dell/xps/13-7390; dell-xps-13-7390 = import ./dell/xps/13-7390;
dell-xps-13-9310 = import ./dell/xps/13-9310;
dell-xps-13-9343 = import ./dell/xps/13-9343; dell-xps-13-9343 = import ./dell/xps/13-9343;
dell-xps-13-9360 = import ./dell/xps/13-9360; dell-xps-13-9360 = import ./dell/xps/13-9360;
dell-xps-13-9370 = import ./dell/xps/13-9370; dell-xps-13-9370 = import ./dell/xps/13-9370;
dell-xps-13-9380 = import ./dell/xps/13-9380; dell-xps-13-9380 = import ./dell/xps/13-9380;
dell-xps-15-7590 = import ./dell/xps/15-7590; dell-xps-15-7590 = import ./dell/xps/15-7590;
dell-xps-15-9550 = import ./dell/xps/15-9550; dell-xps-15-9550 = import ./dell/xps/15-9550;
dell-xps-15-9550-nvidia = import ./dell/xps/15-9550/nvidia;
dell-xps-15-9560 = import ./dell/xps/15-9560; dell-xps-15-9560 = import ./dell/xps/15-9560;
dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel; dell-xps-15-9560-intel = import ./dell/xps/15-9560/intel;
dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia;
@ -61,6 +63,7 @@
lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen; lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen;
lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen; lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen;
lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme; lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme;
lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13-yoga;
microsoft-surface = import ./microsoft/surface; microsoft-surface = import ./microsoft/surface;
microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3;
pcengines-apu = import ./pcengines/apu; pcengines-apu = import ./pcengines/apu;
@ -77,6 +80,7 @@
common-cpu-intel-kaby-lake = import ./common/cpu/intel/kaby-lake; common-cpu-intel-kaby-lake = import ./common/cpu/intel/kaby-lake;
common-cpu-intel-sandy-bridge = import ./common/cpu/intel/sandy-bridge; common-cpu-intel-sandy-bridge = import ./common/cpu/intel/sandy-bridge;
common-gpu-nvidia = import ./common/gpu/nvidia.nix; common-gpu-nvidia = import ./common/gpu/nvidia.nix;
common-gpu-nvidia-disable = import ./common/gpu/nvidia-disable.nix;
common-pc-hdd = import ./common/pc/hdd; common-pc-hdd = import ./common/pc/hdd;
common-pc-laptop-hdd = import ./common/pc/laptop/hdd; common-pc-laptop-hdd = import ./common/pc/laptop/hdd;
common-pc-laptop-ssd = import ./common/pc/ssd; common-pc-laptop-ssd = import ./common/pc/ssd;

View file

@ -0,0 +1,13 @@
{ config, lib, ... }: {
imports = [
../.
../../../common/cpu/intel
../../../common/pc/laptop/acpi_call.nix
../../../common/pc/laptop/ssd
];
# automatic screen orientation
hardware.sensor.iio.enable = true;
services.xserver.wacom.enable = lib.mkDefault config.services.xserver.enable;
}

View file

@ -3,4 +3,9 @@
../. ../.
../../../common/cpu/intel ../../../common/cpu/intel
]; ];
boot.kernelParams = [
# Disable "Panel Self Refresh". Fix random freezes.
"i915.enable_psr=0"
];
} }

View file

@ -15,7 +15,7 @@ The kernel-specific derivations are under the `kernel/` sub-directory.
In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected
to be maintained in this repo. to be maintained in this repo.
_*NOTE:*_Some built-in Kernel config items need to be set, that aren't set by default: _*NOTE:*_ Some built-in Kernel config items need to be set, that aren't set by default:
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
## Firmware, Drivers and Support Tools ## Firmware, Drivers and Support Tools
@ -63,11 +63,28 @@ See: https://github.com/linux-surface/linux-surface/blob/master/README.md
On the Surface Go, the standard firmware from the official Linux Firmware repo has issues with the On the Surface Go, the standard firmware from the official Linux Firmware repo has issues with the
`ath10k` QCA6174 Wifi device. `ath10k` QCA6174 Wifi device.
You will see messages like "Can't ping firmware" *TODO - Copy messages from console* You will see messages like "Can't ping firmware".
The most effective fix to-date is to remove the `board-2.bin` file or replace it with a copy of the The most effective fix to-date is to remove the `board-2.bin` file or replace it with a copy of the
`board.bin` file. `board.bin` file.
The derivative in `firmware/surface-go/ath10k/` can configure this, if you set the option
`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace` to `true`.
_*NOTE:*_ This is destructive, as it deletes all the `board.bin` and `board-2.bin` files for the
`ath10k` QCA6174 device, and replaces them with KillerNetworking's version.
This is the only way (currently) to force the driver to use the new firmware.
For more details, see: https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wifi-firmware
_*NOTE:*_ There's some work to patch the kernel to make it easier to override which firmware file
to use for QCA6174, which would obviate this more-destructuve approach:
- https://github.com/linux-surface/kernel/commit/22ef83836c4aa89e9eb98de9b47ed24b6c2a1d45
_*NOTE:*_ There was an attempt to get this firmware incorporated into the aggregate `board-2.bin`,
but (as of this writing) the request appears to have been ignored:
- https://github.com/linux-surface/linux-surface/issues/41
References: References:
- https://github.com/jakeday/linux-surface/issues/441 - https://github.com/jakeday/linux-surface/issues/441
- https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/ - https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/

View file

@ -3,9 +3,13 @@
- Latest from linux-surface - Latest from linux-surface
- [X] Download github.com/linux-surface/linux-surface kernel patches - [X] Download github.com/linux-surface/linux-surface kernel patches
- [X] Build kernel using downloaded patches - [X] Build kernel using downloaded patches
** TODO Create a function for selecting preferred kernel ** CANCELLED Create a function for selecting preferred kernel
** DONE Fix how Keyboard & Trackpad are not being enabled on SL3 ** DONE Fix how Keyboard & Trackpad are not being enabled on SL3
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
** DONE Update to kernel 5.10.19
:LOGBOOK:
- State "DONE" from "DOING" [2021-03-06 Sat 20:55]
:END:
* Firmware * Firmware
** DONE Remove old firmware binaries ** DONE Remove old firmware binaries
- Looks like the ath10k files aren't needed, any more - Looks like the ath10k files aren't needed, any more
@ -14,14 +18,27 @@
- [X] Install the binaries - [X] Install the binaries
** DONE Remove `ipts` firmware derivative ** DONE Remove `ipts` firmware derivative
- This is only needed on the 4.19 kernel - This is only needed on the 4.19 kernel
** TODO Investigate problem with ath10k wifi firmware on Surface Go ** DONE Investigate problem with ath10k wifi firmware on Surface Go
*** TODO README entry explaining problem(s) with nonfree firmware on Surface Go :LOGBOOK:
*** TODO Create derivative for `ath10k` firmware on Surface Go - State "DOING" from "TODO" [2021-02-09 Tue 17:19]
- State "DONE" from "DOING" [2021-03-06 Sat 15:27]
:END:
*** DONE README entry explaining problem(s) with nonfree firmware on Surface Go
:LOGBOOK:
- State "DONE" from "TODO" [2021-02-09 Tue 17:17]
:END:
*** DONE Create derivative for `ath10k` firmware on Surface Go
:LOGBOOK:
- State "DOING" from "TODO" [2021-02-09 Tue 17:18]
:END:
- [X] Download github.com/kvalo/ath10k-firmware ? - [X] Download github.com/kvalo/ath10k-firmware ?
- [X] Download kernel.org linux-firmware? - [X] Download kernel.org linux-firmware?
- [ ] Download `board.bin` from Killer Networks? - [X] Download `board.bin` from Killer Networks?
- [ ] Install ath10k firmware fix for Surface Go - [X] Install ath10k firmware fix for Surface Go
- `board-2.bin` needs to be removed / replaced with `board.bin` - `board-2.bin` needs to be removed / replaced with `board.bin`
- [X] Add a config option for enabling the Surface Go Firmware
- [-] Replace the vendorised `board.bin` with a `fetchurl`
- Getting HTTP 406 when using `fetchurl` or `nix-prefetch-url` that has to be diagnosed
* Support Tools * Support Tools
** TODO Incorporate @hpfr's function(s) from this commit: ** TODO Incorporate @hpfr's function(s) from this commit:
- https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c - https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c

View file

@ -1,6 +0,0 @@
{ config, lib, pkgs, ... }:
{
hardware.enableAllFirmware = true;
hardware.firmware = [
];
}

View file

@ -0,0 +1,33 @@
{stdenv, lib, pkgs, firmwareLinuxNonfree, ...}:
let
repos = (pkgs.callPackage ../../../repos.nix {});
# killernetworking_firmware = ./K1535_Debian;
killernetworking_firmware = repos.ath10k-firmware + "/K1535_Debian";
in
firmwareLinuxNonfree.overrideAttrs (old: rec {
pname = "microsoft-surface-go-firmware-linux-nonfree";
srcs = [
firmwareLinuxNonfree.src
killernetworking_firmware
];
sourceRoot = firmwareLinuxNonfree.src;
dontMakeSourcesWritable = true;
postInstall = ''
# Delete the non-working firmware:
rm -v $out/lib/firmware/ath10k/QCA6174/{hw2.1,hw3.0}/board.bin
rm -v $out/lib/firmware/ath10k/QCA6174/{hw2.1,hw3.0}/board-2.bin
# Install the Surface Go Wifi firmware:
cp ${killernetworking_firmware}/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/
cp ${killernetworking_firmware}/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/
'';
outputHash = "1nc56qii96dfvxnv3ad3lxz2rzyqcbldk0h9rbm3l2pgamkvj8dw";
meta = with lib; {
description = "Standard binary firmware collection, adjusted with the Surface Go WiFi firmware";
platforms = platforms.linux;
priority = 5;
};
})

View file

@ -0,0 +1,22 @@
{ config, lib, pkgs, ... }:
let
cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k;
in
{
options = {
hardware.microsoft-surface.firmware.surface-go-ath10k = {
replace = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.'';
};
};
config = lib.mkIf cfg.replace {
hardware.enableAllFirmware = true;
hardware.firmware = [
(pkgs.callPackage ./ath10k-replace.nix {})
];
boot.extraModprobeConfig = lib.mkDefault ''
options ath10k_core skip_otp=Y
'';
};
}

View file

@ -6,7 +6,6 @@
options snd_ac97_codec power_save=1 options snd_ac97_codec power_save=1
options iwlwifi power_save=Y options iwlwifi power_save=Y
options iwldvm force_cam=N options iwldvm force_cam=N
options ath10k_core skip_otp=Y
''; '';
boot.kernelParams = [ "mem_sleep_default=deep" ]; boot.kernelParams = [ "mem_sleep_default=deep" ];

View file

@ -1,5 +1,5 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
boot.kernelPackages = pkgs.callPackage ./linux-5.10.2 {}; boot.kernelPackages = pkgs.callPackage ./linux-5.10.19 {};
} }

View file

@ -1,10 +1,9 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
repos = (pkgs.callPackage ../../repos.nix {}); repos = (pkgs.callPackage ../../repos.nix {});
# TODO: Can I append the path ./patches instead of a string?
patches = repos.linux-surface + "/patches"; patches = repos.linux-surface + "/patches";
surface_kernelPatches = [ surface_kernelPatches = [
{ name = "microsoft-surface-patches-linux-5.10.2"; { name = "microsoft-surface-patches-linux-5.10.19";
patch = null; patch = null;
extraConfig = '' extraConfig = ''
# #
@ -15,12 +14,17 @@ let
SURFACE_AGGREGATOR_BUS y SURFACE_AGGREGATOR_BUS y
SURFACE_AGGREGATOR_CDEV m SURFACE_AGGREGATOR_CDEV m
SURFACE_AGGREGATOR_REGISTRY m SURFACE_AGGREGATOR_REGISTRY m
SURFACE_ACPI_NOTIFY m SURFACE_ACPI_NOTIFY m
SURFACE_BATTERY m
SURFACE_DTX m SURFACE_DTX m
SURFACE_HID m
SURFACE_PERFMODE m SURFACE_PERFMODE m
SURFACE_HID m
SURFACE_KBD m
BATTERY_SURFACE m
CHARGER_SURFACE m
# #
# These built-in modules are required for the Surface Aggregator Module # These built-in modules are required for the Surface Aggregator Module
# See: https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing # See: https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
@ -44,18 +48,23 @@ let
# #
# Cameras: IPU3 # Cameras: IPU3
# #
## TODO: Fix for kernel 5.10.2: ## Not yet supported in the patches
##VIDEO_IPU3_IMGU m # VIDEO_IPU3_IMGU m
VIDEO_IPU3_CIO2 m VIDEO_IPU3_CIO2 m
CIO2_BRIDGE y CIO2_BRIDGE y
INT3472 m INTEL_SKL_INT3472 m
# #
# Cameras: Sensor drivers # Cameras: Sensor drivers
# #
VIDEO_OV5693 m VIDEO_OV5693 m
## TODO: Fix for kernel 5.10.2: ## Not yet supported in the patches
##VIDEO_OV8865 m # VIDEO_OV8865 m
#
# ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
#
APDS9960 m
# #
# Other Drivers # Other Drivers
@ -101,12 +110,16 @@ let
patch = patches + "/5.10/0008-surface-typecover.patch"; patch = patches + "/5.10/0008-surface-typecover.patch";
} }
{ {
name = "ms-surface/0009-cameras"; name = "ms-surface/0009-surface-sensors";
patch = patches + "/5.10/0009-cameras.patch"; patch = patches + "/5.10/0009-surface-sensors.patch";
}
{
name = "ms-surface/0010-cameras";
patch = patches + "/5.10/0010-cameras.patch";
} }
]; ];
in (with pkgs; recurseIntoAttrs (linuxPackagesFor ( in (with pkgs; recurseIntoAttrs (linuxPackagesFor (
callPackage ./linux-5.10.2.nix { callPackage ./linux-5.10.19.nix {
kernelPatches = surface_kernelPatches; kernelPatches = surface_kernelPatches;
} }
))) )))

View file

@ -3,7 +3,7 @@
with stdenv.lib; with stdenv.lib;
buildLinux (args // rec { buildLinux (args // rec {
version = "5.10.2"; version = "5.10.19";
# modDirVersion needs to be x.y.z, will automatically add .0 if needed # modDirVersion needs to be x.y.z, will automatically add .0 if needed
modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; modDirVersion = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg;
@ -13,6 +13,6 @@ buildLinux (args // rec {
src = fetchurl { src = fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz"; url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "18l1ywp99inm90434fm74w8rjfl4yl974kfcpizg2sp2p8xf311v"; sha256 = "1mml5a30ky0khzj3r6ahybycbbszk86agq62qclwq2kzvsqbprr7";
}; };
} // (args.argsOverride or {})) } // (args.argsOverride or {}))

View file

@ -1,8 +1,29 @@
{ lib, pkgs, fetchgit }: { lib, pkgs, fetchFromGitHub, fetchurl }:
{ {
linux-surface = fetchgit { linux-surface = fetchFromGitHub {
url="https://github.com/linux-surface/linux-surface.git"; owner="linux-surface";
rev="25ab2cf75e5eda5ab9739db1907300010c06dacf"; repo="linux-surface";
sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9"; rev="f8fab978a480a4ed57e9ebb6928683b2e443c1c5";
sha256="0zwybprwjckpapxm6gxzh6hwdd1w91g5sjxn6z52zlvvjpkmw959";
};
ath10k-firmware = fetchFromGitHub {
owner="kvalo";
repo="ath10k-firmware";
rev="84b47062aab31d67156e0a3ef593a6999a12864b";
sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py";
};
surface-go-ath10k-firmware_upstream = fetchurl {
url="https://support.killernetworking.com/K1535_Debian/board.bin";
# url="https://www.killernetworking.com/support/K1535_Debian/board.bin";
sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py";
};
surface-go-ath10k-firmware_backup = fetchFromGitHub {
owner="mexisme";
repo="linux-surface_ath10k-firmware";
rev="74e5409e699383d6ca2bc4da4a8433d16f3850b1";
sha256="169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk";
}; };
} }