From 6484d285c57fd6f70e237fbab893ae89fa772736 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 28 Dec 2020 19:39:35 -0500 Subject: [PATCH 01/47] Copy NVidia 9500 NVidia settings for 9550 --- dell/xps/15-9550/README.wiki | 9 ++++++++- dell/xps/15-9550/nvidia/default.nix | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 dell/xps/15-9550/nvidia/default.nix diff --git a/dell/xps/15-9550/README.wiki b/dell/xps/15-9550/README.wiki index c0e9158a..93d33ab9 100644 --- a/dell/xps/15-9550/README.wiki +++ b/dell/xps/15-9550/README.wiki @@ -5,12 +5,19 @@ Most of this I presume also applies to the XPS 13 1530, the 13" variant. == Tested Hardware == * CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz -* RAM: 16 GB +* RAM: 32 GB * HDD: 512 GiB SSD * Screen: 15" 4k (3840✕2160) * Graphics: NVIDIA Corporation GM107M, with Intel Graphics too. * 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 == diff --git a/dell/xps/15-9550/nvidia/default.nix b/dell/xps/15-9550/nvidia/default.nix new file mode 100644 index 00000000..451b6eb7 --- /dev/null +++ b/dell/xps/15-9550/nvidia/default.nix @@ -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"; + }; +} From 9a355718299ce74c324b5ccc0d4943159b51cf41 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sun, 7 Feb 2021 00:55:27 +1300 Subject: [PATCH 02/47] Interim version of trying to update Surface Go Wifi in-place - Can't seem to d/l the K1535 board firmware directly from Killer Networking? --- microsoft/surface/firmware/ath10k.nix | 29 ++++++++++++++++++++++++++ microsoft/surface/firmware/default.nix | 2 ++ microsoft/surface/repos.nix | 21 ++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 microsoft/surface/firmware/ath10k.nix diff --git a/microsoft/surface/firmware/ath10k.nix b/microsoft/surface/firmware/ath10k.nix new file mode 100644 index 00000000..3cbd8a0a --- /dev/null +++ b/microsoft/surface/firmware/ath10k.nix @@ -0,0 +1,29 @@ +{stdenv, pkgs, firmwareLinuxNonfree, ...}: +let + repos = (pkgs.callPackage ../repos.nix {}); +in + +firmwareLinuxNonfree.overrideAttrs (old: rec { + pname = "microsoft-surface-go-firmware-linux-nonfree"; + srcs = [ + firmwareLinuxNonfree.src + repos.ath10k-firmware + ]; + + sourceRoot = firmwareLinuxNonfree.src; + priority = 1; + + dontMakeSourcesWritable = true; + postInstall = '' + # rm -v $out/lib/firmware/ath10k/{hw2.1,hw3.0}/board.bin + # rm -v $out/lib/firmware/ath10k/{hw2.1,hw3.0}/board2.bin + + # cp $srcs[1] $out/lib/firmware/ath10k/hw2.1/ + # cp $srcs[1] $out/lib/firmware/ath10k/hw3.0/ + + #TODO: + pwd + echo src = $src, srcs = $srcs + exit 1 + ''; +}) diff --git a/microsoft/surface/firmware/default.nix b/microsoft/surface/firmware/default.nix index 67f2ce22..ea24877b 100644 --- a/microsoft/surface/firmware/default.nix +++ b/microsoft/surface/firmware/default.nix @@ -2,5 +2,7 @@ { hardware.enableAllFirmware = true; hardware.firmware = [ + # TODO: Wrap with an option: + (pkgs.callPackage ./ath10k.nix {}) ]; } diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index 86424162..dbbbd758 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -1,8 +1,27 @@ -{ lib, pkgs, fetchgit }: +{ lib, pkgs, fetchgit, fetchurl }: { linux-surface = fetchgit { url="https://github.com/linux-surface/linux-surface.git"; rev="25ab2cf75e5eda5ab9739db1907300010c06dacf"; sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9"; }; + + linux-kernel-firmware = fetchgit { + url="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"; + rev="060ad8b3d505e2ff8878d11a81da3532b983cd45"; + sha256="0n93xc3vzx7gy96lpkypw7ay201x7whirxm00c0zhq6zmq2zs12v"; + }; + + ath10k-firmware = fetchgit { + url="https://github.com/kvalo/ath10k-firmware"; + rev="84b47062aab31d67156e0a3ef593a6999a12864b"; + sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py"; + }; + + surface-go-ath10k-firmware = fetchurl { + url="https://support.killernetworking.com/K1535_Debian/board.bin"; + # url="https://www.killernetworking.com/support/K1535_Debian/board.bin"; + sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py"; + }; + } From f59106598eb75c832a8b2fd20651478e5f2ba36a Mon Sep 17 00:00:00 2001 From: Jacek Galowicz Date: Sat, 6 Feb 2021 18:03:00 +0100 Subject: [PATCH 03/47] Add Lenovo X13 Yoga Gen 1 --- README.md | 6 ++++-- flake.nix | 1 + lenovo/thinkpad/x13-yoga/default.nix | 13 +++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 lenovo/thinkpad/x13-yoga/default.nix diff --git a/README.md b/README.md index 21243005..878cc5ea 100644 --- a/README.md +++ b/README.md @@ -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: ```nix -imports = [ +imports = [ "${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. ## List of Profiles @@ -116,6 +116,7 @@ See code for all available configurations. | Lenovo ThinkPad T480s | `` | | Lenovo ThinkPad T490 | `` | | Lenovo ThinkPad T495 | `` | +| Lenovo ThinkPad X113 Yoga | `` | | Lenovo ThinkPad X140e | `` | | Lenovo ThinkPad X220 | `` | | Lenovo ThinkPad X230 | `` | @@ -156,6 +157,7 @@ See code for all available configurations. [Inverse Path USB armory]: inversepath/usbarmory [Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-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 [Microsoft Surface Pro 3]: microsoft/surface-pro/3 [Raspberry Pi 2]: raspberry-pi/2 diff --git a/flake.nix b/flake.nix index 91bed297..48084845 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,7 @@ 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-extreme = import ./lenovo/thinkpad/x1-extreme; + lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13-yoga; microsoft-surface = import ./microsoft/surface; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; pcengines-apu = import ./pcengines/apu; diff --git a/lenovo/thinkpad/x13-yoga/default.nix b/lenovo/thinkpad/x13-yoga/default.nix new file mode 100644 index 00000000..2653910d --- /dev/null +++ b/lenovo/thinkpad/x13-yoga/default.nix @@ -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; +} From 080c44106f423c06d2018725dee647a6781a0190 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sun, 7 Feb 2021 13:31:26 +1300 Subject: [PATCH 04/47] A temporary hack to install the Surface Go firmware --- microsoft/surface/firmware/ath10k.nix | 19 +++++++++--------- .../firmware/ath10k/K1535_Debian/board.bin | Bin 0 -> 8124 bytes 2 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 microsoft/surface/firmware/ath10k/K1535_Debian/board.bin diff --git a/microsoft/surface/firmware/ath10k.nix b/microsoft/surface/firmware/ath10k.nix index 3cbd8a0a..db235072 100644 --- a/microsoft/surface/firmware/ath10k.nix +++ b/microsoft/surface/firmware/ath10k.nix @@ -1,13 +1,15 @@ {stdenv, pkgs, firmwareLinuxNonfree, ...}: let repos = (pkgs.callPackage ../repos.nix {}); + ath10k = ./ath10k; + # ath10k = repos.ath10k-firmware; in firmwareLinuxNonfree.overrideAttrs (old: rec { pname = "microsoft-surface-go-firmware-linux-nonfree"; srcs = [ firmwareLinuxNonfree.src - repos.ath10k-firmware + ath10k ]; sourceRoot = firmwareLinuxNonfree.src; @@ -15,15 +17,12 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { dontMakeSourcesWritable = true; postInstall = '' - # rm -v $out/lib/firmware/ath10k/{hw2.1,hw3.0}/board.bin - # rm -v $out/lib/firmware/ath10k/{hw2.1,hw3.0}/board2.bin + # 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 - # cp $srcs[1] $out/lib/firmware/ath10k/hw2.1/ - # cp $srcs[1] $out/lib/firmware/ath10k/hw3.0/ - - #TODO: - pwd - echo src = $src, srcs = $srcs - exit 1 + # Install the Surface Go Wifi firmware: + cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/ + cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/ ''; }) diff --git a/microsoft/surface/firmware/ath10k/K1535_Debian/board.bin b/microsoft/surface/firmware/ath10k/K1535_Debian/board.bin new file mode 100644 index 0000000000000000000000000000000000000000..ed0b7f778ee5544e266a79207e34ead8865ac0e8 GIT binary patch literal 8124 zcmeHMeQZ-z6u-A!*ek;JI>&f}uDgW=9x_NrS=X*DYwOqwbaMiO4Y~~(ALY}6u#Va> zOvJb`M+J2qAEOLZf(22*sF8>|kjYlqhcNsC70E&r>mR`4KX~u!UI!C~hQ(ysb9?SN z_x#SsedjgJz3IpC;I;q)Vfkm^aeygpO&9=rfTwt}1W+i33QhwcJHwz*PBxU*9s;vq3lrQ|2Eh z20}s&6d%a|_4xV- zAkG(WTO5bAuAjE1-N^)u<~+EGCH1dg?=k!%Eiy6^+{rYJw{s8v2T4bj52E&S{=ajx zCpu@?fngvfFXl+h-$~=+=-!?;Z+7h3X^W-=P2#&t=s z>tel5Ju=nn_q!?pDq)t=b14&0vun^(%uL!yP3rPjV8F?&rVFWTkjAb;1xyyLqb7pW z6)ythU{=r;$_#X9C1atpC>@vxItft9ETi+OX+XoSK=YXyw1!FqCkQ}lGKO6C9dk4+8vyo zU?B>1Ak=~W>wwK`tMCF_MZMR7ndD92X_Qow(9JP1zRC=NHDObq%0b@ezKTLPUN~C# zs8A^ETN6hO8$Lo}Fiy>!Zcdt%oRX>qz_xyOJ zb!xT!!Tt9R25u&sqq?5(_m})XU;5F1wdIGKzjSn5`|(2iuUF5vU%S%c>%7|9a^>>C zeZv0Pd5&d~%X8$@#^6z-m-3)0>OHazFpZ2PPizS^lhM_M&mtV4=YYMjc9;#bU{(O| z$Q)2l29B^3GY{;LJq?q|NUFgu1~Rw^gJ)c+XbPMNC#vgY>tHGwU0vI@0K?94YegxL zg{;~wTL~wT!2#3UNp`VLG(j}Mu$yxkD@wsY6_{3&R3g@h5=DuI9phGu6e0y2%>gQ# z{3$jE=^43VeQYtD4NWkmqpNZwFl|&VkkW#TOb|IVzGokVv0aQ-;Dz*Tb8Lh@C zD~3lQnZZ8r_GdBQ!ZNyb74AEP+gVfKxLON zW#^y_MyYyMzKorVGMNwqB-591an_Dg%_D~_E+UUapiZ1h z{tUYabRwJ8MPx_++HRHJ0ES>C9xN zbIV3xD_gKMugLU-Dh2OvF*^$x8O4dts`C4MCAyDJe?|Y-fN1D2i6kMOHD(qTmD%fF zdaw56Uecn$kx_BXn30c7G36JPmDFynuQ}xDZe93Lv4lw&$!aq5i%Lpgt$w}c7zc%m zBjTbHhO;TASw*(e%9nPy_wVTr0ly6y!bnE3T0=p>^Ui%+kGenQAi*Dl#nDL0s?&1| zo^x#5y0hjWSDl2lg^>%WT@ApkD7)IO4$QsR)w|t$gH`xyAsOmGr~{!6ggOxFz<<62 z=GoRN&xei8_miWLRMHnmM_>0^1(jnw53Mxuc^*oMifU@A4D*^!Jfza!FP@HJVn@d5 zGfdNFWXY8(wMIuOm@Nycj(%{wnU~pxOR5jQ|H&6K7jCP6_w(Dgd)v)<7HgI3$WdNq z&%pt&y>XcMldDZ{J0H)>2jzEao%oiH=b+?n?D*mypx$=k8TbSw=Y>_Cc$`~1iK{a( z2PKK_p&mS7@9(z|$~W*kfPb*u9`Er+UUsy7-P+OmP3!ry7n;9q{_0G7Q~Q@KjqQzR zzi2(}J9X~VrEe~_es|%k<~E=2bVnQJmgZCKzB4D=d}kWkd`%|@en&!2@Gu={sFy)z z^B6#526Zy%!T)mAJqo~qx+M7hW&frie~Wd@dTd9`3qu3^29{$uU5o9;utR49Ji%w& zCuzp)WA}?;A~iW85zEOD@(4LuM Date: Sun, 7 Feb 2021 15:49:02 +1300 Subject: [PATCH 05/47] Fix the output hash for the additional source --- microsoft/surface/firmware/ath10k.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/firmware/ath10k.nix b/microsoft/surface/firmware/ath10k.nix index db235072..1409b924 100644 --- a/microsoft/surface/firmware/ath10k.nix +++ b/microsoft/surface/firmware/ath10k.nix @@ -4,14 +4,12 @@ let ath10k = ./ath10k; # ath10k = repos.ath10k-firmware; in - firmwareLinuxNonfree.overrideAttrs (old: rec { pname = "microsoft-surface-go-firmware-linux-nonfree"; srcs = [ firmwareLinuxNonfree.src ath10k ]; - sourceRoot = firmwareLinuxNonfree.src; priority = 1; @@ -25,4 +23,6 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/ cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/ ''; + + outputHash = "1nc56qii96dfvxnv3ad3lxz2rzyqcbldk0h9rbm3l2pgamkvj8dw"; }) From 08076a7b73bc37d3d04234cc5caed4dc75a19340 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sun, 7 Feb 2021 15:49:46 +1300 Subject: [PATCH 06/47] Add initial metadata attribute for the additional source --- microsoft/surface/firmware/ath10k.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/firmware/ath10k.nix b/microsoft/surface/firmware/ath10k.nix index 1409b924..1a98600c 100644 --- a/microsoft/surface/firmware/ath10k.nix +++ b/microsoft/surface/firmware/ath10k.nix @@ -1,4 +1,4 @@ -{stdenv, pkgs, firmwareLinuxNonfree, ...}: +{stdenv, lib, pkgs, firmwareLinuxNonfree, ...}: let repos = (pkgs.callPackage ../repos.nix {}); ath10k = ./ath10k; @@ -11,7 +11,6 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { ath10k ]; sourceRoot = firmwareLinuxNonfree.src; - priority = 1; dontMakeSourcesWritable = true; postInstall = '' @@ -25,4 +24,10 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { ''; outputHash = "1nc56qii96dfvxnv3ad3lxz2rzyqcbldk0h9rbm3l2pgamkvj8dw"; + + meta = with lib; { + description = "Standard binary firmware collection, adjusted with the Surface Go WiFi firmware"; + platforms = platforms.linux; + priority = 5; + }; }) From a989fd823ecbee0169f0de7097db4823459c45a4 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 8 Feb 2021 18:25:17 -0500 Subject: [PATCH 07/47] Mention Dell 9550 NVidia in Read Me and flake.nix --- README.md | 1 + flake.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 878cc5ea..26cfc2d1 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ See code for all available configurations. | [Dell XPS 13 9380][] | `` | | [Dell XPS 15 7590][] | `` | | [Dell XPS 15 9550][] | `` | +| [Dell XPS 15 9550, nvidia][] | `` | | [Dell XPS 15 9560][] | `` | | [Dell XPS 15 9560, intel only][] | `` | | [Dell XPS 15 9560, nvidia only][] | `` | diff --git a/flake.nix b/flake.nix index 48084845..f0d24bf4 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ dell-xps-13-9380 = import ./dell/xps/13-9380; dell-xps-15-7590 = import ./dell/xps/15-7590; 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-intel = import ./dell/xps/15-9560/intel; dell-xps-15-9560-nvidia = import ./dell/xps/15-9560/nvidia; From 72002dabdc4296a341d405cb3712a8b9739b5982 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 9 Feb 2021 17:17:27 +1300 Subject: [PATCH 08/47] Update README.md --- microsoft/surface/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index d67a91e9..02880cfe 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -64,6 +64,8 @@ You will see messages like "Can't ping firmware" *TODO - Copy messages from cons 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. +For more details, see: https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wifi-firmware + References: - https://github.com/jakeday/linux-surface/issues/441 - https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/ From be2f416029549d1c7a6f9e3ed2838590ffd2d476 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 9 Feb 2021 17:19:58 +1300 Subject: [PATCH 09/47] Update TODO.org --- microsoft/surface/TODO.org | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/microsoft/surface/TODO.org b/microsoft/surface/TODO.org index 7db7ea42..0a1f56f1 100644 --- a/microsoft/surface/TODO.org +++ b/microsoft/surface/TODO.org @@ -14,14 +14,26 @@ - [X] Install the binaries ** DONE Remove `ipts` firmware derivative - This is only needed on the 4.19 kernel -** TODO Investigate problem with ath10k wifi firmware on Surface Go -*** TODO README entry explaining problem(s) with nonfree firmware on Surface Go -*** TODO Create derivative for `ath10k` firmware on Surface Go +** DOING Investigate problem with ath10k wifi firmware on Surface Go +:LOGBOOK: +- State "DOING" from "TODO" [2021-02-09 Tue 17:19] +: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: +*** DOING 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 kernel.org linux-firmware? - - [ ] Download `board.bin` from Killer Networks? - - [ ] Install ath10k firmware fix for Surface Go + - [X] Download `board.bin` from Killer Networks? + - [X] Install ath10k firmware fix for Surface Go - `board-2.bin` needs to be removed / replaced with `board.bin` + - [ ] 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 ** TODO Incorporate @hpfr's function(s) from this commit: - https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c From 0e2334c5319d09c852c45011114a19f2f8bba99a Mon Sep 17 00:00:00 2001 From: malteneuss Date: Sat, 13 Feb 2021 20:59:31 +0100 Subject: [PATCH 10/47] Fix link to flake file in README flake example --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 26cfc2d1..12a25e05 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ There is also experimental flake support. In your `/etc/nixos/flake.nix` add the # ... 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 ]; }; From 56f4b2df003a9e2a778a0f354fef4e7473240c2c Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 23 Feb 2021 08:28:27 +1300 Subject: [PATCH 11/47] Add MS Surface Range to the README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 12a25e05..01004a4b 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ See code for all available configurations. | [Lenovo ThinkPad X1 (6th Gen)][] | `` | | [Lenovo ThinkPad X1 (7th Gen)][] | `` | | Lenovo ThinkPad X1 Extreme Gen 2 | `` | +| [Microsoft Surface Range][] | `` | | [Microsoft Surface Pro 3][] | `` | | PC Engines APU | `` | | [Raspberry Pi 2][] | `` | From a9b2d0e3f1136a4c05decbb3c2aa7a7cfb08256b Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 23 Feb 2021 12:40:08 +1300 Subject: [PATCH 12/47] Update to a clearer directory-structure --- microsoft/surface/default.nix | 2 +- microsoft/surface/firmware/default.nix | 8 -------- .../ath10k/K1535_Debian/board.bin | Bin .../{ => surface-go/ath10k}/ath10k.nix | 8 ++++---- .../firmware/surface-go/ath10k/default.nix | 18 ++++++++++++++++++ 5 files changed, 23 insertions(+), 13 deletions(-) delete mode 100644 microsoft/surface/firmware/default.nix rename microsoft/surface/firmware/{ => surface-go}/ath10k/K1535_Debian/board.bin (100%) rename microsoft/surface/firmware/{ => surface-go/ath10k}/ath10k.nix (75%) create mode 100644 microsoft/surface/firmware/surface-go/ath10k/default.nix diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 7a49d08f..05d78de9 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -2,7 +2,7 @@ { imports = [ ./kernel - ./firmware ./hardware_configuration.nix + ./firmware/surface-go/ath10k ]; } diff --git a/microsoft/surface/firmware/default.nix b/microsoft/surface/firmware/default.nix deleted file mode 100644 index ea24877b..00000000 --- a/microsoft/surface/firmware/default.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - hardware.enableAllFirmware = true; - hardware.firmware = [ - # TODO: Wrap with an option: - (pkgs.callPackage ./ath10k.nix {}) - ]; -} diff --git a/microsoft/surface/firmware/ath10k/K1535_Debian/board.bin b/microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin similarity index 100% rename from microsoft/surface/firmware/ath10k/K1535_Debian/board.bin rename to microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin diff --git a/microsoft/surface/firmware/ath10k.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix similarity index 75% rename from microsoft/surface/firmware/ath10k.nix rename to microsoft/surface/firmware/surface-go/ath10k/ath10k.nix index 1a98600c..33ba3208 100644 --- a/microsoft/surface/firmware/ath10k.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix @@ -1,8 +1,8 @@ {stdenv, lib, pkgs, firmwareLinuxNonfree, ...}: let repos = (pkgs.callPackage ../repos.nix {}); - ath10k = ./ath10k; - # ath10k = repos.ath10k-firmware; + killernetworking_firmware = ./K1535_Debian; + # killernetworking_firmware = repos.ath10k-firmware; in firmwareLinuxNonfree.overrideAttrs (old: rec { pname = "microsoft-surface-go-firmware-linux-nonfree"; @@ -19,8 +19,8 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { rm -v $out/lib/firmware/ath10k/QCA6174/{hw2.1,hw3.0}/board-2.bin # Install the Surface Go Wifi firmware: - cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw2.1/ - cp ${ath10k}/K1535_Debian/board.bin $out/lib/firmware/ath10k/QCA6174/hw3.0/ + 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"; diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/firmware/surface-go/ath10k/default.nix new file mode 100644 index 00000000..bc52187c --- /dev/null +++ b/microsoft/surface/firmware/surface-go/ath10k/default.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.hardware.microsoft-surface.firmware.surface-go-ath10k; +in +{ + options = { + hardware.microsoft-surface.firmware.surface-go-ath10k = { + enable = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; + }; + }; + + config = lib.mkIf cfg.enable { + hardware.enableAllFirmware = true; + hardware.firmware = [ + (pkgs.callPackage ./ath10k.nix {}) + ]; + }; +} From eb2721b3f1280f488675db38544a22c974bbae39 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 23 Feb 2021 17:48:50 +1300 Subject: [PATCH 13/47] A few more details about using K1535 WiFi firmware --- microsoft/surface/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 02880cfe..9d3848d0 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -59,13 +59,17 @@ 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 `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 `board.bin` file. For more details, see: https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wifi-firmware +Note that 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: - https://github.com/jakeday/linux-surface/issues/441 - https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/ From f8c3b6e50e09844f08a36416c191caa2f0d70a9f Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 23 Feb 2021 17:59:34 +1300 Subject: [PATCH 14/47] Move a modprobe option for Surface Go Wifi device (ath10k) into that specific derivative --- microsoft/surface/firmware/surface-go/ath10k/default.nix | 4 ++++ microsoft/surface/hardware_configuration.nix | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/firmware/surface-go/ath10k/default.nix index bc52187c..44f2bfdf 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/default.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/default.nix @@ -14,5 +14,9 @@ in hardware.firmware = [ (pkgs.callPackage ./ath10k.nix {}) ]; + + boot.extraModprobeConfig = lib.mkDefault '' + options ath10k_core skip_otp=Y + ''; }; } diff --git a/microsoft/surface/hardware_configuration.nix b/microsoft/surface/hardware_configuration.nix index 2053b01a..ba06b307 100644 --- a/microsoft/surface/hardware_configuration.nix +++ b/microsoft/surface/hardware_configuration.nix @@ -6,7 +6,6 @@ options snd_ac97_codec power_save=1 options iwlwifi power_save=Y options iwldvm force_cam=N - options ath10k_core skip_otp=Y ''; boot.kernelParams = [ "mem_sleep_default=deep" ]; From 86d77642bd30283a37e214a9537fdf06c83e6982 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 14 Nov 2020 17:14:41 +0100 Subject: [PATCH 15/47] Add xps 13 9310 with common intel and laptop imports --- dell/xps/13-9310/default.nix | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 dell/xps/13-9310/default.nix diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix new file mode 100644 index 00000000..ad27e853 --- /dev/null +++ b/dell/xps/13-9310/default.nix @@ -0,0 +1,7 @@ +{ lib, ... }: +{ + imports = [ + ../../../common/cpu/intel + ../../../common/pc/laptop + ]; +} From 631011a23c8ec5a8c7b1bc419a654ad9de50392a Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 14 Nov 2020 18:27:04 +0100 Subject: [PATCH 16/47] Add necessary fw and alsa conf for audio. Add patch for AX500. --- dell/xps/13-9310/default.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index ad27e853..dfd05ab0 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -1,7 +1,30 @@ -{ lib, ... }: +{ lib, pkgs, ... }: { imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ]; + + # Necessary for audio. + # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 + hardware.firmware = [ pkgs.sof-firmware ]; + + # Confirmed necessary to get audio working as of 2020-11-13: + # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 + boot.extraModprobeConfig = '' + options snd-intel-dspcfg dsp_driver=1 + ''; + + # TODO: Remove this once landed in kernel. + # Apply kernel patch for xps 9310 wifi bug. + # https://patchwork.kernel.org/project/linux-wireless/patch/1605121102-14352-1-git-send-email-kvalo@codeaurora.org/ + boot.kernelPatches = [ + { + name = "ath11k-qca6390-xps9310"; + patch = builtins.fetchurl "https://patchwork.kernel.org/project/linux-wireless/patch/1605121102-14352-1-git-send-email-kvalo@codeaurora.org/raw/"; + } + ]; + + # Allows for updating firmware via `fwupdmgr`. + # services.fwupd.enable = true; } From bcbbd2bd7299faf8707b5eb0c015d22045d7991f Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 14 Nov 2020 18:54:25 +0100 Subject: [PATCH 17/47] Blacklist pmouse as trackpad works over i2c --- dell/xps/13-9310/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index dfd05ab0..0f97550f 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -6,7 +6,7 @@ ]; # Necessary for audio. - # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 + # https://bbs.archlinux.org/viewtopic.php?pid=1933548#p1933548 hardware.firmware = [ pkgs.sof-firmware ]; # Confirmed necessary to get audio working as of 2020-11-13: @@ -15,6 +15,10 @@ options snd-intel-dspcfg dsp_driver=1 ''; + # Touchpad goes over i2c. + # Without this we get errors in dmesg on boot and hangs when shutting down. + boot.blacklistedKernelModules = [ "psmouse" ]; + # TODO: Remove this once landed in kernel. # Apply kernel patch for xps 9310 wifi bug. # https://patchwork.kernel.org/project/linux-wireless/patch/1605121102-14352-1-git-send-email-kvalo@codeaurora.org/ From 3345b81777ed850b6dbd0d40f4928cf517a83649 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 14 Nov 2020 19:13:48 +0100 Subject: [PATCH 18/47] Install qca6390 firmware necessary for ax500 connectivity chip --- dell/xps/13-9310/default.nix | 15 ++++++++++--- dell/xps/13-9310/qca6390-firmware.nix | 32 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 dell/xps/13-9310/qca6390-firmware.nix diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index 0f97550f..874dd62b 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -5,9 +5,18 @@ ../../../common/pc/laptop ]; - # Necessary for audio. - # https://bbs.archlinux.org/viewtopic.php?pid=1933548#p1933548 - hardware.firmware = [ pkgs.sof-firmware ]; + # TODO: upstream to NixOS/nixpkgs + nixpkgs.overlays = [(final: previous: { + qca6390-firmware = final.callPackage ./qca6390-firmware.nix {}; + })]; + + hardware.firmware = lib.mkBefore [ + # Necessary for audio. + # https://bbs.archlinux.org/viewtopic.php?pid=1933548#p1933548 + pkgs.sof-firmware + # Firmware for the AX500 (wi-fi & bluetooth chip). + pkgs.qca6390-firmware + ]; # Confirmed necessary to get audio working as of 2020-11-13: # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 diff --git a/dell/xps/13-9310/qca6390-firmware.nix b/dell/xps/13-9310/qca6390-firmware.nix new file mode 100644 index 00000000..521bf322 --- /dev/null +++ b/dell/xps/13-9310/qca6390-firmware.nix @@ -0,0 +1,32 @@ +# Based on instructions from kvalo at: http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html +# The xps/13-9360/qca6174-firmware.nix was a useful reference for how to setup this module. +{ stdenv }: + +stdenv.mkDerivation rec { + name = "${target}-firmware-${version}"; + version = "${branch}-00042"; + branch = "master"; + target = "QCA6390"; + src = builtins.fetchGit { + url = "https://github.com/kvalo/ath11k-firmware.git"; + ref = "master"; + rev = "45a6c45a19799d3b06fc2287d5ba44e19ee0aa00"; + }; + buildCommand = '' + mkdir -p $out/lib/firmware/ath11k/${target}/hw2.0/ + cp $src/QCA6390/hw2.0/1.0.1/WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1/*.bin $out/lib/firmware/ath11k/QCA6390/hw2.0/ + cp $src/QCA6390/hw2.0/board-2.bin $out/lib/firmware/ath11k/QCA6390/hw2.0/ + ''; + meta = with stdenv.lib; { + description = '' + Firmware for the QCA6390 wireless chip. + + This derivation is based on the instructions provided by kvalo in: + http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html + ''; + homepage = "https://github.com/kvalo/ath11k-firmware/tree/master/QCA6390/hw2.0"; + license = licenses.unfreeRedistributable; + maintainers = with maintainers; [ mitchmindtree ]; + platforms = platforms.linux; + }; +} From b23e492fe5b251f9b68cce6a9efaaba0cdb3b784 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 15 Nov 2020 20:32:45 +0100 Subject: [PATCH 19/47] Add entry for Dell XPS 13 9310 to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 12a25e05..bfcda892 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,7 @@ See code for all available configurations. | Dell Precision 5530 | `` | | [Dell XPS E7240][] | `` | | [Dell XPS 13 7390][] | `` | +| [Dell XPS 13 9310][] | `` | | [Dell XPS 13 9343][] | `` | | [Dell XPS 13 9360][] | `` | | [Dell XPS 13 9370][] | `` | @@ -146,6 +147,7 @@ See code for all available configurations. [Dell XPS E7240]: dell/e7240 [Dell XPS 13 7390]: dell/xps/13-7390 [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 9370]: dell/xps/13-9370 [Dell XPS 13 9380]: dell/xps/13-9380 From f0486916bf1797507100e990d9a9dd9847b07bc2 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 22 Nov 2020 00:34:36 +0100 Subject: [PATCH 20/47] Add a new suite of ath11k patches recommended by kvalo Here's a link to kvalo's branch with the kernel patches: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup > In this tag there's now a brand new implementation for suspend, which > relies that the platform provides power to QCA6390 during suspend. Not > all platforms do, but most of them should do that. ath11k also prints a > warning whenever it notices that the firmware has crashed, but I'm not > sure yet if it (the MHI subsystem to be exact) can detect every case. > > The MSI patch is mostly the same, it had just some refactoring since the > last version. Unfortunately there's no solution still for the weird > crashes some people are seeing. The patches are based on version 5.10-rc4 of linux, so you'll want to use `linuxPackages_testing`. --- dell/xps/13-9310/default.nix | 50 ++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index 874dd62b..e7a3e673 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -32,9 +32,55 @@ # Apply kernel patch for xps 9310 wifi bug. # https://patchwork.kernel.org/project/linux-wireless/patch/1605121102-14352-1-git-send-email-kvalo@codeaurora.org/ boot.kernelPatches = [ + # kvalo qca6390 patches + # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup { - name = "ath11k-qca6390-xps9310"; - patch = builtins.fetchurl "https://patchwork.kernel.org/project/linux-wireless/patch/1605121102-14352-1-git-send-email-kvalo@codeaurora.org/raw/"; + name = "add-64-bit-check-before-reading-msi-high-addr"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=065c9528cc508cfbf6e3399582df29f76f56163c"; + } + { + name = "pci-support-platforms-with-one-msi-vector"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=59c6d022df8efb450f82d33dd6a6812935bd022f"; + } + { + name = "try-to-allocate-big-block-of-dma-memory-firstly"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21"; + } + { + name = "fix-monitor-status-dma-unmap-direction"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=fa4eea695afb286ae38beb30dabf251335cb4a62"; + } + { + name = "hook-mhi-suspend-and-resume"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=762fe5bc2dd1e43ef307a375861b1a8c414b14e3"; + } + { + name = "implement-hif-suspend-and-resume-functions"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=2f164833bcca14e8aec0b2566eae4b5a7d09ee6f"; + } + { + name = "read-select_window-register-to-ensure-write-is-finished"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=6afab932ece78fedc1538c20c2aefdd13aa6c9d0"; + } + { + name = "implement-htc-suspend-related-callbacks"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=69ab2835b82c176e793195243e1400d4f8db3647"; + } + { + name = "put-target-to-suspend-when-system-enters-suspend-state"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=68023bee4d61ea2b02af49bba00adabba51d8b6b"; + } + { + name = "pci-print-a-warning-if-firmware-crashed"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=23dcef9436560a033703164c4daff9e36e640969"; + } + { + name = "qmi-print-allocated-memory-segment-addresses-and-sizes"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a327caa4a5a677161a6f1d29514e8cb42236e956"; + } + { + name = "hack-add-delays-to-suspend-and-resume-handlers"; + patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a9ce8040a968bdbb5aad2d767298d390e2507b16"; } ]; From b60b1f95ebdc60a9092bb93b981034209e129fbd Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Wed, 2 Dec 2020 13:29:16 +0100 Subject: [PATCH 21/47] Remove explicit `sof-firmware` as is already included Previously, I'd added both the firmware and the `extraModprobeConfig` that selects the DSP driver, however it seems only the latter is necessary. Addresses @terinjokes comment [here][1]. [1]: https://github.com/NixOS/nixos-hardware/pull/207/files#r534062750 --- dell/xps/13-9310/default.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index e7a3e673..dccdb1b4 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -11,9 +11,6 @@ })]; hardware.firmware = lib.mkBefore [ - # Necessary for audio. - # https://bbs.archlinux.org/viewtopic.php?pid=1933548#p1933548 - pkgs.sof-firmware # Firmware for the AX500 (wi-fi & bluetooth chip). pkgs.qca6390-firmware ]; From cdea79566b2b577371c21e35160fce965eed4de3 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Wed, 2 Dec 2020 15:50:24 +0100 Subject: [PATCH 22/47] Use `fetchFromGitHub` to retrieve qca6390 fw more efficiently Addresses @terinjokes comment [here][1]. [1]: https://github.com/NixOS/nixos-hardware/pull/207/files/906cd8b20cad90a9da37fae5c17527b9ae4e3c42#pullrequestreview-542698197 --- dell/xps/13-9310/qca6390-firmware.nix | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dell/xps/13-9310/qca6390-firmware.nix b/dell/xps/13-9310/qca6390-firmware.nix index 521bf322..f27874c9 100644 --- a/dell/xps/13-9310/qca6390-firmware.nix +++ b/dell/xps/13-9310/qca6390-firmware.nix @@ -1,16 +1,17 @@ # Based on instructions from kvalo at: http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html # The xps/13-9360/qca6174-firmware.nix was a useful reference for how to setup this module. -{ stdenv }: +{ stdenv, fetchFromGitHub }: stdenv.mkDerivation rec { name = "${target}-firmware-${version}"; version = "${branch}-00042"; branch = "master"; target = "QCA6390"; - src = builtins.fetchGit { - url = "https://github.com/kvalo/ath11k-firmware.git"; - ref = "master"; + src = fetchFromGitHub { + owner = "kvalo"; + repo = "ath11k-firmware"; rev = "45a6c45a19799d3b06fc2287d5ba44e19ee0aa00"; + sha256 = "1slfjzy2b9zi8744gyw8piz9gfvrh8s38wmyzzqj525iy76zn4qv"; }; buildCommand = '' mkdir -p $out/lib/firmware/ath11k/${target}/hw2.0/ @@ -24,7 +25,8 @@ stdenv.mkDerivation rec { This derivation is based on the instructions provided by kvalo in: http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html ''; - homepage = "https://github.com/kvalo/ath11k-firmware/tree/master/QCA6390/hw2.0"; + homepage = + "https://github.com/kvalo/ath11k-firmware/tree/master/QCA6390/hw2.0"; license = licenses.unfreeRedistributable; maintainers = with maintainers; [ mitchmindtree ]; platforms = platforms.linux; From 154350aa04b9ddcffa0931176f0cde7f367e8d37 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 5 Dec 2020 18:38:14 +0100 Subject: [PATCH 23/47] Use fetchpatch. Fix kernel version. Add recent ath11k patches. --- dell/xps/13-9310/default.nix | 257 +++++++++++++++++++++++++++-------- 1 file changed, 201 insertions(+), 56 deletions(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index dccdb1b4..d4c73c5d 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -15,6 +15,207 @@ pkgs.qca6390-firmware ]; + # The QCA6390 driver currently requires a specific version of the kernel + # along with a particular set of patches to build. + # Kvalo's ath11k-qca6390-bringup branch is currently based on `5.10-rc4`. + # TODO: Remove this once patches landed in kernel. + boot.kernelPackages = let + linux_patched_pkg = { buildLinux, fetchurl, modDirVersionArg ? null, ... }@args: + buildLinux (args // rec { + version = "5.10-rc4"; + extraMeta.branch = "5.10"; + modDirVersion = if (modDirVersionArg == null) then + builtins.replaceStrings [ "-" ] [ ".0-" ] version + else + modDirVersionArg; + src = fetchurl { + url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz"; + sha256 = "1fc68lka76n1dygyn914c4vhxqzwv951pp4kdkrr0jv5nvdnyplb"; + }; + kernelPatches = [ + # kvalo qca6390 patches + # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup + { + 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 = "try-to-allocate-big-block-of-dma-memory-firstly"; + patch = pkgs.fetchpatch { + url = "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21"; + sha256 = "120zqivqhs5080b64h62x69svi6bq02scgnkswa0hbvdncsy63y8"; + }; + } + { + 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 = "hack-add-delays-to-suspend-and-resume-handlers"; + patch = pkgs.fetchpatch { + url = "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a9ce8040a968bdbb5aad2d767298d390e2507b16"; + sha256 = "02chzhmkkxl4rxkp5vmab9sm218jggns1yanhqkfkpvdpzlz2dlg"; + }; + } + + { + 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=0c214f7ebce5eadb589554611bb927517c7aa7ea"; + sha256 = "0k4af5i12ghgviraig1zcm8b4fngws8wmhhn9w902nnn3miqy7sw"; + }; + } + { + name = "fix-incorrect-tlvs-in-scan-start-command"; + patch = pkgs.fetchpatch { + url = "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=bfa226b7e2e988609631e7f6cd0d4e9ede423f6b"; + sha256 = "03qb5d0dm77l2ifmcy87p064qd55bg9kqx9nmxy6lrvz83crizpb"; + }; + } + { + 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"; + }; + } + ]; + } // (args.argsOverride or { })); + linux_patched = pkgs.callPackage linux_patched_pkg { }; + in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_patched); + # Confirmed necessary to get audio working as of 2020-11-13: # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 boot.extraModprobeConfig = '' @@ -25,62 +226,6 @@ # Without this we get errors in dmesg on boot and hangs when shutting down. boot.blacklistedKernelModules = [ "psmouse" ]; - # TODO: Remove this once landed in kernel. - # Apply kernel patch for xps 9310 wifi bug. - # https://patchwork.kernel.org/project/linux-wireless/patch/1605121102-14352-1-git-send-email-kvalo@codeaurora.org/ - boot.kernelPatches = [ - # kvalo qca6390 patches - # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup - { - name = "add-64-bit-check-before-reading-msi-high-addr"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=065c9528cc508cfbf6e3399582df29f76f56163c"; - } - { - name = "pci-support-platforms-with-one-msi-vector"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=59c6d022df8efb450f82d33dd6a6812935bd022f"; - } - { - name = "try-to-allocate-big-block-of-dma-memory-firstly"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21"; - } - { - name = "fix-monitor-status-dma-unmap-direction"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=fa4eea695afb286ae38beb30dabf251335cb4a62"; - } - { - name = "hook-mhi-suspend-and-resume"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=762fe5bc2dd1e43ef307a375861b1a8c414b14e3"; - } - { - name = "implement-hif-suspend-and-resume-functions"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=2f164833bcca14e8aec0b2566eae4b5a7d09ee6f"; - } - { - name = "read-select_window-register-to-ensure-write-is-finished"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=6afab932ece78fedc1538c20c2aefdd13aa6c9d0"; - } - { - name = "implement-htc-suspend-related-callbacks"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=69ab2835b82c176e793195243e1400d4f8db3647"; - } - { - name = "put-target-to-suspend-when-system-enters-suspend-state"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=68023bee4d61ea2b02af49bba00adabba51d8b6b"; - } - { - name = "pci-print-a-warning-if-firmware-crashed"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=23dcef9436560a033703164c4daff9e36e640969"; - } - { - name = "qmi-print-allocated-memory-segment-addresses-and-sizes"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a327caa4a5a677161a6f1d29514e8cb42236e956"; - } - { - name = "hack-add-delays-to-suspend-and-resume-handlers"; - patch = builtins.fetchurl "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a9ce8040a968bdbb5aad2d767298d390e2507b16"; - } - ]; - # Allows for updating firmware via `fwupdmgr`. # services.fwupd.enable = true; } From 7f1da4009b4d953b3456ae554d0a1f4b3f86ed26 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Mon, 7 Dec 2020 14:51:56 +0100 Subject: [PATCH 24/47] Add wink patch for IRQ locking --- dell/xps/13-9310/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index d4c73c5d..a1fddf0e 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -211,6 +211,15 @@ sha256 = "0p1663w0lik44gwyfzmxxiwnc3s9n3p46aappla8pbfk9wdgw86d"; }; } + + # Patch for crash by w1nk. + { + name = "w1nk-irq-lock-patch"; + patch = pkgs.fetchpatch { + url = "https://raw.githubusercontent.com/w1nk/ath11k-debug/master/one-irq-manage.patch"; + sha256 = "011db3h10smqy0ni0qr9mkyhykf1f3yq6yym6ysbb7jr7l51q0n9"; + }; + } ]; } // (args.argsOverride or { })); linux_patched = pkgs.callPackage linux_patched_pkg { }; From 08d1c4dd2b1af7f520bc996c1b445c3f1615500d Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 13 Dec 2020 15:09:57 +0100 Subject: [PATCH 25/47] Add wink patch for disabling MHI M2 state. Rename firmware. Disabling the MHI M2 state appears to completely resolve issues where enabling the wifi firmware would cause the the whole system to freeze quite frequently. The reason for why this fix works so well is still unknown and under investigation. See some discussion here: http://lists.infradead.org/pipermail/ath11k/2020-December/000876.html Also renames the firmware package to clarify that it is for the wifi driver. This is to avoid confusion with the bluetooth firmware which will be added in an upcoming patch. --- dell/xps/13-9310/default.nix | 14 +++++++++++--- dell/xps/13-9310/disable-mhi-m2.patch | 19 +++++++++++++++++++ ...firmware.nix => qca6390-wifi-firmware.nix} | 2 +- 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 dell/xps/13-9310/disable-mhi-m2.patch rename dell/xps/13-9310/{qca6390-firmware.nix => qca6390-wifi-firmware.nix} (96%) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index a1fddf0e..8cb4dbdb 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -7,12 +7,12 @@ # TODO: upstream to NixOS/nixpkgs nixpkgs.overlays = [(final: previous: { - qca6390-firmware = final.callPackage ./qca6390-firmware.nix {}; + qca6390-wifi-firmware = final.callPackage ./qca6390-wifi-firmware.nix {}; })]; hardware.firmware = lib.mkBefore [ # Firmware for the AX500 (wi-fi & bluetooth chip). - pkgs.qca6390-firmware + pkgs.qca6390-wifi-firmware ]; # The QCA6390 driver currently requires a specific version of the kernel @@ -212,14 +212,22 @@ }; } - # Patch for crash by w1nk. + # Extra patches by wink. { + # Improves some cases in which races could occur. name = "w1nk-irq-lock-patch"; patch = pkgs.fetchpatch { url = "https://raw.githubusercontent.com/w1nk/ath11k-debug/master/one-irq-manage.patch"; sha256 = "011db3h10smqy0ni0qr9mkyhykf1f3yq6yym6ysbb7jr7l51q0n9"; }; } + { + # System crashes appear to have been caused by MHI state transitions to M2 state. + # Currently under investigation. + # http://lists.infradead.org/pipermail/ath11k/2020-December/000876.html + name = "w1nk-disable-mhi-m2-transition"; + patch = ./disable-mhi-m2.patch; + } ]; } // (args.argsOverride or { })); linux_patched = pkgs.callPackage linux_patched_pkg { }; diff --git a/dell/xps/13-9310/disable-mhi-m2.patch b/dell/xps/13-9310/disable-mhi-m2.patch new file mode 100644 index 00000000..b935c899 --- /dev/null +++ b/dell/xps/13-9310/disable-mhi-m2.patch @@ -0,0 +1,19 @@ +diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c +index 3de7b1639ec6..02882038e4cc 100644 +--- a/drivers/bus/mhi/core/pm.c ++++ b/drivers/bus/mhi/core/pm.c +@@ -55,12 +55,12 @@ static struct mhi_pm_transitions const dev_state_transitions[] = { + }, + { + MHI_PM_M0, +- MHI_PM_M0 | MHI_PM_M2 | MHI_PM_M3_ENTER | ++ MHI_PM_M0 | MHI_PM_M3_ENTER | + MHI_PM_SYS_ERR_DETECT | MHI_PM_SHUTDOWN_PROCESS | + MHI_PM_LD_ERR_FATAL_DETECT | MHI_PM_FW_DL_ERR + }, + { +- MHI_PM_M2, ++ MHI_PM_M0, + MHI_PM_M0 | MHI_PM_SYS_ERR_DETECT | MHI_PM_SHUTDOWN_PROCESS | + MHI_PM_LD_ERR_FATAL_DETECT + }, diff --git a/dell/xps/13-9310/qca6390-firmware.nix b/dell/xps/13-9310/qca6390-wifi-firmware.nix similarity index 96% rename from dell/xps/13-9310/qca6390-firmware.nix rename to dell/xps/13-9310/qca6390-wifi-firmware.nix index f27874c9..7e1a7562 100644 --- a/dell/xps/13-9310/qca6390-firmware.nix +++ b/dell/xps/13-9310/qca6390-wifi-firmware.nix @@ -3,7 +3,7 @@ { stdenv, fetchFromGitHub }: stdenv.mkDerivation rec { - name = "${target}-firmware-${version}"; + name = "${target}-wifi-firmware-${version}"; version = "${branch}-00042"; branch = "master"; target = "QCA6390"; From cc5d84ccef145bbf52ac63f067897927d9a8a205 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Tue, 29 Dec 2020 02:38:20 +0100 Subject: [PATCH 26/47] Update to rebased patches for 5.10 release of kernel Removes the old disable-mhi-2 patch file in favour of using the patch at kernel.org. Also adds fwupd to allow users to update their firmware via fwupdmgr. --- dell/xps/13-9310/default.nix | 463 +++++++++++++------------- dell/xps/13-9310/disable-mhi-m2.patch | 19 -- 2 files changed, 232 insertions(+), 250 deletions(-) delete mode 100644 dell/xps/13-9310/disable-mhi-m2.patch diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index 8cb4dbdb..2cb3d229 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -1,238 +1,239 @@ -{ lib, pkgs, ... }: -{ - imports = [ - ../../../common/cpu/intel - ../../../common/pc/laptop +{ lib, pkgs, ... }: { + imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ]; + + # TODO: Remove `qca6390-wifi-firmware.nix` once it is available via + # `firmware-linux-nonfree` package. + nixpkgs.overlays = [ + (final: previous: { + qca6390-wifi-firmware = final.callPackage ./qca6390-wifi-firmware.nix { }; + }) ]; - # TODO: upstream to NixOS/nixpkgs - nixpkgs.overlays = [(final: previous: { - qca6390-wifi-firmware = final.callPackage ./qca6390-wifi-firmware.nix {}; - })]; + hardware.firmware = lib.mkBefore [ pkgs.qca6390-wifi-firmware ]; - hardware.firmware = lib.mkBefore [ - # Firmware for the AX500 (wi-fi & bluetooth chip). - pkgs.qca6390-wifi-firmware + # Patches are based on the 5.10 release. + boot.kernelPackages = pkgs.linuxPackages_5_10; + boot.kernelPatches = [ + # kvalo qca6390 patches + # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup + { + 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 = "try-to-allocate-big-block-of-dma-memory-firstly"; + patch = pkgs.fetchpatch { + url = + "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21"; + sha256 = "120zqivqhs5080b64h62x69svi6bq02scgnkswa0hbvdncsy63y8"; + }; + } + { + 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 = "fix-incorrect-tlvs-in-scan-start-command"; + patch = pkgs.fetchpatch { + url = + "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=bfa226b7e2e988609631e7f6cd0d4e9ede423f6b"; + sha256 = "03qb5d0dm77l2ifmcy87p064qd55bg9kqx9nmxy6lrvz83crizpb"; + }; + } + { + 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"; + }; + } ]; - # The QCA6390 driver currently requires a specific version of the kernel - # along with a particular set of patches to build. - # Kvalo's ath11k-qca6390-bringup branch is currently based on `5.10-rc4`. - # TODO: Remove this once patches landed in kernel. - boot.kernelPackages = let - linux_patched_pkg = { buildLinux, fetchurl, modDirVersionArg ? null, ... }@args: - buildLinux (args // rec { - version = "5.10-rc4"; - extraMeta.branch = "5.10"; - modDirVersion = if (modDirVersionArg == null) then - builtins.replaceStrings [ "-" ] [ ".0-" ] version - else - modDirVersionArg; - src = fetchurl { - url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz"; - sha256 = "1fc68lka76n1dygyn914c4vhxqzwv951pp4kdkrr0jv5nvdnyplb"; - }; - kernelPatches = [ - # kvalo qca6390 patches - # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup - { - 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 = "try-to-allocate-big-block-of-dma-memory-firstly"; - patch = pkgs.fetchpatch { - url = "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21"; - sha256 = "120zqivqhs5080b64h62x69svi6bq02scgnkswa0hbvdncsy63y8"; - }; - } - { - 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 = "hack-add-delays-to-suspend-and-resume-handlers"; - patch = pkgs.fetchpatch { - url = "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=a9ce8040a968bdbb5aad2d767298d390e2507b16"; - sha256 = "02chzhmkkxl4rxkp5vmab9sm218jggns1yanhqkfkpvdpzlz2dlg"; - }; - } - - { - 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=0c214f7ebce5eadb589554611bb927517c7aa7ea"; - sha256 = "0k4af5i12ghgviraig1zcm8b4fngws8wmhhn9w902nnn3miqy7sw"; - }; - } - { - name = "fix-incorrect-tlvs-in-scan-start-command"; - patch = pkgs.fetchpatch { - url = "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=bfa226b7e2e988609631e7f6cd0d4e9ede423f6b"; - sha256 = "03qb5d0dm77l2ifmcy87p064qd55bg9kqx9nmxy6lrvz83crizpb"; - }; - } - { - 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"; - }; - } - - # Extra patches by wink. - { - # Improves some cases in which races could occur. - name = "w1nk-irq-lock-patch"; - patch = pkgs.fetchpatch { - url = "https://raw.githubusercontent.com/w1nk/ath11k-debug/master/one-irq-manage.patch"; - sha256 = "011db3h10smqy0ni0qr9mkyhykf1f3yq6yym6ysbb7jr7l51q0n9"; - }; - } - { - # System crashes appear to have been caused by MHI state transitions to M2 state. - # Currently under investigation. - # http://lists.infradead.org/pipermail/ath11k/2020-December/000876.html - name = "w1nk-disable-mhi-m2-transition"; - patch = ./disable-mhi-m2.patch; - } - ]; - } // (args.argsOverride or { })); - linux_patched = pkgs.callPackage linux_patched_pkg { }; - in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_patched); - # Confirmed necessary to get audio working as of 2020-11-13: # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 boot.extraModprobeConfig = '' @@ -244,5 +245,5 @@ boot.blacklistedKernelModules = [ "psmouse" ]; # Allows for updating firmware via `fwupdmgr`. - # services.fwupd.enable = true; + services.fwupd.enable = true; } diff --git a/dell/xps/13-9310/disable-mhi-m2.patch b/dell/xps/13-9310/disable-mhi-m2.patch deleted file mode 100644 index b935c899..00000000 --- a/dell/xps/13-9310/disable-mhi-m2.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c -index 3de7b1639ec6..02882038e4cc 100644 ---- a/drivers/bus/mhi/core/pm.c -+++ b/drivers/bus/mhi/core/pm.c -@@ -55,12 +55,12 @@ static struct mhi_pm_transitions const dev_state_transitions[] = { - }, - { - MHI_PM_M0, -- MHI_PM_M0 | MHI_PM_M2 | MHI_PM_M3_ENTER | -+ MHI_PM_M0 | MHI_PM_M3_ENTER | - MHI_PM_SYS_ERR_DETECT | MHI_PM_SHUTDOWN_PROCESS | - MHI_PM_LD_ERR_FATAL_DETECT | MHI_PM_FW_DL_ERR - }, - { -- MHI_PM_M2, -+ MHI_PM_M0, - MHI_PM_M0 | MHI_PM_SYS_ERR_DETECT | MHI_PM_SHUTDOWN_PROCESS | - MHI_PM_LD_ERR_FATAL_DETECT - }, From 0359644c220dd389d7f34081d31483305bbe490e Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Fri, 26 Feb 2021 11:41:03 +0100 Subject: [PATCH 27/47] Pin to Linux 5.10.18 for patches. Remove upstreamed wi-fi firmware. Pin to the latest stable 5.10.18 release in order to ensure patches don't unexpectedly conflict in newer linux versions. The wi-fi firmware has since been upstreamed to the `linux-firmware` repo, and as such is now available via `enableRedistributableFirmware`. As a result we can remove the old expr that pulled the firmware from kvalo's github. Also removes two patches that have since been upstreamed. --- dell/xps/13-9310/default.nix | 455 ++++++++++----------- dell/xps/13-9310/qca6390-wifi-firmware.nix | 34 -- 2 files changed, 225 insertions(+), 264 deletions(-) delete mode 100644 dell/xps/13-9310/qca6390-wifi-firmware.nix diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index 2cb3d229..c625adb9 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -1,238 +1,233 @@ { lib, pkgs, ... }: { imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ]; - # TODO: Remove `qca6390-wifi-firmware.nix` once it is available via - # `firmware-linux-nonfree` package. - nixpkgs.overlays = [ - (final: previous: { - qca6390-wifi-firmware = final.callPackage ./qca6390-wifi-firmware.nix { }; - }) - ]; + # Includes the Wi-Fi (and likely Bluetooth) firmware for the QCA6390. + hardware.enableRedistributableFirmware = true; - hardware.firmware = lib.mkBefore [ pkgs.qca6390-wifi-firmware ]; + # 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"; + }; - # Patches are based on the 5.10 release. - boot.kernelPackages = pkgs.linuxPackages_5_10; - boot.kernelPatches = [ - # kvalo qca6390 patches - # https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/log/?h=ath11k-qca6390-bringup - { - 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 = "try-to-allocate-big-block-of-dma-memory-firstly"; - patch = pkgs.fetchpatch { - url = - "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=0d8b0aff6b77ea5a8d715ba5d0089f9dffbabf21"; - sha256 = "120zqivqhs5080b64h62x69svi6bq02scgnkswa0hbvdncsy63y8"; - }; - } - { - 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 = "fix-incorrect-tlvs-in-scan-start-command"; - patch = pkgs.fetchpatch { - url = - "https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/patch/?id=bfa226b7e2e988609631e7f6cd0d4e9ede423f6b"; - sha256 = "03qb5d0dm77l2ifmcy87p064qd55bg9kqx9nmxy6lrvz83crizpb"; - }; - } - { - 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"; - }; - } - ]; + # 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"; + }; + } + ]; + } // (args.argsOverride or { })); + linux_patched = pkgs.callPackage linux_patched_pkg { }; + in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_patched); # Confirmed necessary to get audio working as of 2020-11-13: # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 diff --git a/dell/xps/13-9310/qca6390-wifi-firmware.nix b/dell/xps/13-9310/qca6390-wifi-firmware.nix deleted file mode 100644 index 7e1a7562..00000000 --- a/dell/xps/13-9310/qca6390-wifi-firmware.nix +++ /dev/null @@ -1,34 +0,0 @@ -# Based on instructions from kvalo at: http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html -# The xps/13-9360/qca6174-firmware.nix was a useful reference for how to setup this module. -{ stdenv, fetchFromGitHub }: - -stdenv.mkDerivation rec { - name = "${target}-wifi-firmware-${version}"; - version = "${branch}-00042"; - branch = "master"; - target = "QCA6390"; - src = fetchFromGitHub { - owner = "kvalo"; - repo = "ath11k-firmware"; - rev = "45a6c45a19799d3b06fc2287d5ba44e19ee0aa00"; - sha256 = "1slfjzy2b9zi8744gyw8piz9gfvrh8s38wmyzzqj525iy76zn4qv"; - }; - buildCommand = '' - mkdir -p $out/lib/firmware/ath11k/${target}/hw2.0/ - cp $src/QCA6390/hw2.0/1.0.1/WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1/*.bin $out/lib/firmware/ath11k/QCA6390/hw2.0/ - cp $src/QCA6390/hw2.0/board-2.bin $out/lib/firmware/ath11k/QCA6390/hw2.0/ - ''; - meta = with stdenv.lib; { - description = '' - Firmware for the QCA6390 wireless chip. - - This derivation is based on the instructions provided by kvalo in: - http://lists.infradead.org/pipermail/ath11k/2020-November/000537.html - ''; - homepage = - "https://github.com/kvalo/ath11k-firmware/tree/master/QCA6390/hw2.0"; - license = licenses.unfreeRedistributable; - maintainers = with maintainers; [ mitchmindtree ]; - platforms = platforms.linux; - }; -} From 4bbf1562380b9d5f638dd099dd6705d73d3ca482 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 23 Feb 2021 18:06:06 +1300 Subject: [PATCH 28/47] Update README --- microsoft/surface/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 9d3848d0..ff44b852 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -64,9 +64,16 @@ 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 `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.enable` to `true`. + +Note that this is slightly 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 that there was an attempt to get this firmware incorporated into the aggregate `board-2.bin`, +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 From e901e80233ced1b9820f241bb5b02f2ce96621c6 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 24 Feb 2021 08:44:04 +1300 Subject: [PATCH 29/47] Remove obsolete repo ref --- microsoft/surface/repos.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index dbbbd758..dc1030e0 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -6,12 +6,6 @@ sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9"; }; - linux-kernel-firmware = fetchgit { - url="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"; - rev="060ad8b3d505e2ff8878d11a81da3532b983cd45"; - sha256="0n93xc3vzx7gy96lpkypw7ay201x7whirxm00c0zhq6zmq2zs12v"; - }; - ath10k-firmware = fetchgit { url="https://github.com/kvalo/ath10k-firmware"; rev="84b47062aab31d67156e0a3ef593a6999a12864b"; From 311c6bf0efc0c97babd7d31ba3af068082151a09 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 24 Feb 2021 08:46:33 +1300 Subject: [PATCH 30/47] Ref to backup repo for Surface Go firmware --- microsoft/surface/repos.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index dc1030e0..7f1a4345 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -12,10 +12,15 @@ sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py"; }; - surface-go-ath10k-firmware = fetchurl { + 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 = fetchgit { + url="git@github.com:mexisme/linux-surface_ath10k-firmware.git"; + rev="74e5409e699383d6ca2bc4da4a8433d16f3850b1"; + sha256="169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk"; + }; } From 9e7cd653f9c6db4f2ba461a1f24a584ee252fb4b Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 27 Feb 2021 22:28:08 +1300 Subject: [PATCH 31/47] Fix repo source for K1535 --- microsoft/surface/firmware/surface-go/ath10k/ath10k.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix index 33ba3208..4c136fd4 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix @@ -8,7 +8,7 @@ firmwareLinuxNonfree.overrideAttrs (old: rec { pname = "microsoft-surface-go-firmware-linux-nonfree"; srcs = [ firmwareLinuxNonfree.src - ath10k + killernetworking_firmware ]; sourceRoot = firmwareLinuxNonfree.src; From 4f6aad61b6fa0b4bc0cb1ed52e9534b8d73a4b0b Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 27 Feb 2021 22:41:53 +1300 Subject: [PATCH 32/47] Update linux-surface/linux-surface Rev & SHA256 --- microsoft/surface/repos.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index 7f1a4345..ba819a70 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -2,8 +2,8 @@ { linux-surface = fetchgit { url="https://github.com/linux-surface/linux-surface.git"; - rev="25ab2cf75e5eda5ab9739db1907300010c06dacf"; - sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9"; + rev="2b6d2db5bfc7b678c37badc80e0a223bf89b5ef7"; + sha256="03qlwxijznmk043zcpwl1yc56zhrlwdaw8k1cymb8zrxfpgw0r14"; }; ath10k-firmware = fetchgit { From d1e64db4c50cc458f7b79d1adb480b48fea4564a Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 5 Dec 2020 16:56:31 +0100 Subject: [PATCH 33/47] Enable QCA6390 bluetooth Adds a patch for missing kernel configuration along with a list of kernel modules that are missing by default. --- dell/xps/13-9310/default.nix | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index c625adb9..cdb42922 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -1,7 +1,7 @@ { lib, pkgs, ... }: { imports = [ ../../../common/cpu/intel ../../../common/pc/laptop ]; - # Includes the Wi-Fi (and likely Bluetooth) firmware for the QCA6390. + # Includes the Wi-Fi and Bluetooth firmware for the QCA6390. hardware.enableRedistributableFirmware = true; # Wi-Fi currently requires a specific set of patches to function. @@ -224,7 +224,27 @@ 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); From f361f64db031dcc13e7d3bfe0c2e939ba220e7aa Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 27 Feb 2021 12:54:54 +0100 Subject: [PATCH 34/47] Remove no-longer-necessary modprobe config for audio. Fixes microphone. It seems that `sof-firmware` has since been updated and the `extraModprobeConfig` is no longer necessary! Microphone input also now seems to work nicely. --- dell/xps/13-9310/default.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dell/xps/13-9310/default.nix b/dell/xps/13-9310/default.nix index cdb42922..52eb9d58 100644 --- a/dell/xps/13-9310/default.nix +++ b/dell/xps/13-9310/default.nix @@ -249,12 +249,6 @@ linux_patched = pkgs.callPackage linux_patched_pkg { }; in pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_patched); - # Confirmed necessary to get audio working as of 2020-11-13: - # https://bbs.archlinux.org/viewtopic.php?pid=1933643#p1933643 - boot.extraModprobeConfig = '' - options snd-intel-dspcfg dsp_driver=1 - ''; - # Touchpad goes over i2c. # Without this we get errors in dmesg on boot and hangs when shutting down. boot.blacklistedKernelModules = [ "psmouse" ]; From c41f572654f4f885dc619a14a1c431c0e6225761 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 27 Feb 2021 19:58:20 +0100 Subject: [PATCH 35/47] Dell XPS 13 to flake.nix --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index f0d24bf4..64aa17aa 100644 --- a/flake.nix +++ b/flake.nix @@ -16,6 +16,7 @@ dell-precision-5530 = import ./dell/precision/5530; dell-e7240 = import ./dell/e7240; 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-9360 = import ./dell/xps/13-9360; dell-xps-13-9370 = import ./dell/xps/13-9370; From 36094450fdff0a87fbe704cc456b849701972dae Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Sun, 28 Feb 2021 13:31:28 -0300 Subject: [PATCH 36/47] Add nvidia-disable profile This is already used in XPS 15-9560, but instead of defining it in XPS 15-9560 let's create a separate profile and expose it for those who want to disable their NVIDIA GPU. --- common/gpu/nvidia-disable.nix | 10 ++++++++++ dell/xps/15-9550/default.nix | 5 ++--- dell/xps/15-9560/intel/default.nix | 10 +--------- flake.nix | 1 + 4 files changed, 14 insertions(+), 12 deletions(-) create mode 100644 common/gpu/nvidia-disable.nix diff --git a/common/gpu/nvidia-disable.nix b/common/gpu/nvidia-disable.nix new file mode 100644 index 00000000..53c53d9e --- /dev/null +++ b/common/gpu/nvidia-disable.nix @@ -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" ]; +} diff --git a/dell/xps/15-9550/default.nix b/dell/xps/15-9550/default.nix index 9677972a..0fdfeeed 100644 --- a/dell/xps/15-9550/default.nix +++ b/dell/xps/15-9550/default.nix @@ -4,6 +4,8 @@ imports = [ ../../../common/cpu/intel ../../../common/pc/laptop + # To just use Intel integrated graphics with Intel's open source driver + # ../../../common/gpu/nvidia-disable ]; # TODO: boot loader @@ -12,7 +14,4 @@ # This will save you money and possibly your life! services.thermald.enable = true; - - # To just use Intel integrated graphics with Intel's open source driver - # hardware.nvidiaOptimus.disable = true; } diff --git a/dell/xps/15-9560/intel/default.nix b/dell/xps/15-9560/intel/default.nix index f2037978..7c8eadd7 100644 --- a/dell/xps/15-9560/intel/default.nix +++ b/dell/xps/15-9560/intel/default.nix @@ -4,15 +4,7 @@ imports = [ ../../../../common/cpu/intel ../../../../common/pc/laptop + ../../../../common/gpu/nvidia-disable.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" ]; - } diff --git a/flake.nix b/flake.nix index 64aa17aa..c5d6c2e6 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,7 @@ common-cpu-intel-kaby-lake = import ./common/cpu/intel/kaby-lake; common-cpu-intel-sandy-bridge = import ./common/cpu/intel/sandy-bridge; 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-laptop-hdd = import ./common/pc/laptop/hdd; common-pc-laptop-ssd = import ./common/pc/ssd; From e274b742e11e768e76ae3e1d05bff431008c0386 Mon Sep 17 00:00:00 2001 From: mexisme Date: Fri, 5 Mar 2021 08:33:27 +1300 Subject: [PATCH 37/47] Use the ath10k QCA6174 K1535 firmware backup repo, instead --- microsoft/surface/firmware/surface-go/ath10k/ath10k.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix index 4c136fd4..6b4b76d9 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix @@ -1,8 +1,8 @@ {stdenv, lib, pkgs, firmwareLinuxNonfree, ...}: let repos = (pkgs.callPackage ../repos.nix {}); - killernetworking_firmware = ./K1535_Debian; - # killernetworking_firmware = repos.ath10k-firmware; + # killernetworking_firmware = ./K1535_Debian; + killernetworking_firmware = repos.ath10k-firmware + "/K1535_Debian"; in firmwareLinuxNonfree.overrideAttrs (old: rec { pname = "microsoft-surface-go-firmware-linux-nonfree"; From 6972d78ffb443d8b413b0b19bea2f64feffcce69 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 11:07:43 +1300 Subject: [PATCH 38/47] Remove (obsolete) Surface Go QCA6174 K1535 firmware binary --- .../surface-go/ath10k/K1535_Debian/board.bin | Bin 8124 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin diff --git a/microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin b/microsoft/surface/firmware/surface-go/ath10k/K1535_Debian/board.bin deleted file mode 100644 index ed0b7f778ee5544e266a79207e34ead8865ac0e8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8124 zcmeHMeQZ-z6u-A!*ek;JI>&f}uDgW=9x_NrS=X*DYwOqwbaMiO4Y~~(ALY}6u#Va> zOvJb`M+J2qAEOLZf(22*sF8>|kjYlqhcNsC70E&r>mR`4KX~u!UI!C~hQ(ysb9?SN z_x#SsedjgJz3IpC;I;q)Vfkm^aeygpO&9=rfTwt}1W+i33QhwcJHwz*PBxU*9s;vq3lrQ|2Eh z20}s&6d%a|_4xV- zAkG(WTO5bAuAjE1-N^)u<~+EGCH1dg?=k!%Eiy6^+{rYJw{s8v2T4bj52E&S{=ajx zCpu@?fngvfFXl+h-$~=+=-!?;Z+7h3X^W-=P2#&t=s z>tel5Ju=nn_q!?pDq)t=b14&0vun^(%uL!yP3rPjV8F?&rVFWTkjAb;1xyyLqb7pW z6)ythU{=r;$_#X9C1atpC>@vxItft9ETi+OX+XoSK=YXyw1!FqCkQ}lGKO6C9dk4+8vyo zU?B>1Ak=~W>wwK`tMCF_MZMR7ndD92X_Qow(9JP1zRC=NHDObq%0b@ezKTLPUN~C# zs8A^ETN6hO8$Lo}Fiy>!Zcdt%oRX>qz_xyOJ zb!xT!!Tt9R25u&sqq?5(_m})XU;5F1wdIGKzjSn5`|(2iuUF5vU%S%c>%7|9a^>>C zeZv0Pd5&d~%X8$@#^6z-m-3)0>OHazFpZ2PPizS^lhM_M&mtV4=YYMjc9;#bU{(O| z$Q)2l29B^3GY{;LJq?q|NUFgu1~Rw^gJ)c+XbPMNC#vgY>tHGwU0vI@0K?94YegxL zg{;~wTL~wT!2#3UNp`VLG(j}Mu$yxkD@wsY6_{3&R3g@h5=DuI9phGu6e0y2%>gQ# z{3$jE=^43VeQYtD4NWkmqpNZwFl|&VkkW#TOb|IVzGokVv0aQ-;Dz*Tb8Lh@C zD~3lQnZZ8r_GdBQ!ZNyb74AEP+gVfKxLON zW#^y_MyYyMzKorVGMNwqB-591an_Dg%_D~_E+UUapiZ1h z{tUYabRwJ8MPx_++HRHJ0ES>C9xN zbIV3xD_gKMugLU-Dh2OvF*^$x8O4dts`C4MCAyDJe?|Y-fN1D2i6kMOHD(qTmD%fF zdaw56Uecn$kx_BXn30c7G36JPmDFynuQ}xDZe93Lv4lw&$!aq5i%Lpgt$w}c7zc%m zBjTbHhO;TASw*(e%9nPy_wVTr0ly6y!bnE3T0=p>^Ui%+kGenQAi*Dl#nDL0s?&1| zo^x#5y0hjWSDl2lg^>%WT@ApkD7)IO4$QsR)w|t$gH`xyAsOmGr~{!6ggOxFz<<62 z=GoRN&xei8_miWLRMHnmM_>0^1(jnw53Mxuc^*oMifU@A4D*^!Jfza!FP@HJVn@d5 zGfdNFWXY8(wMIuOm@Nycj(%{wnU~pxOR5jQ|H&6K7jCP6_w(Dgd)v)<7HgI3$WdNq z&%pt&y>XcMldDZ{J0H)>2jzEao%oiH=b+?n?D*mypx$=k8TbSw=Y>_Cc$`~1iK{a( z2PKK_p&mS7@9(z|$~W*kfPb*u9`Er+UUsy7-P+OmP3!ry7n;9q{_0G7Q~Q@KjqQzR zzi2(}J9X~VrEe~_es|%k<~E=2bVnQJmgZCKzB4D=d}kWkd`%|@en&!2@Gu={sFy)z z^B6#526Zy%!T)mAJqo~qx+M7hW&frie~Wd@dTd9`3qu3^29{$uU5o9;utR49Ji%w& zCuzp)WA}?;A~iW85zEOD@(4LuM Date: Sat, 6 Mar 2021 11:23:05 +1300 Subject: [PATCH 39/47] Relative path of repos not updated correctly --- microsoft/surface/firmware/surface-go/ath10k/ath10k.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix index 6b4b76d9..909131df 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix @@ -1,6 +1,6 @@ {stdenv, lib, pkgs, firmwareLinuxNonfree, ...}: let - repos = (pkgs.callPackage ../repos.nix {}); + repos = (pkgs.callPackage ../../../repos.nix {}); # killernetworking_firmware = ./K1535_Debian; killernetworking_firmware = repos.ath10k-firmware + "/K1535_Debian"; in From 98d19435d0059fa187237b0a7c1d57fd44a2f320 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 15:29:13 +1300 Subject: [PATCH 40/47] Rename cfg option from "enable" --> "replace" - Allows for @qzed's kernel patch: https://github.com/linux-surface/kernel/commit/22ef83836c4aa89e9eb98de9b47ed24b6c2a1d45 --- microsoft/surface/README.md | 14 +++++++++----- microsoft/surface/TODO.org | 9 +++++---- .../ath10k/{ath10k.nix => ath10k-replace.nix} | 0 .../surface/firmware/surface-go/ath10k/default.nix | 6 +++--- 4 files changed, 17 insertions(+), 12 deletions(-) rename microsoft/surface/firmware/surface-go/ath10k/{ath10k.nix => ath10k-replace.nix} (100%) diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index ff44b852..c4fe2269 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -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 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 ## Firmware, Drivers and Support Tools @@ -65,15 +65,19 @@ The most effective fix to-date is to remove the `board-2.bin` file or replace it `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.enable` to `true`. +`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace` to `true`. -Note that this is slightly 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. +_*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 -There was an attempt to get this firmware incorporated into the aggregate `board-2.bin`, +_*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 diff --git a/microsoft/surface/TODO.org b/microsoft/surface/TODO.org index 0a1f56f1..488613fd 100644 --- a/microsoft/surface/TODO.org +++ b/microsoft/surface/TODO.org @@ -14,15 +14,16 @@ - [X] Install the binaries ** DONE Remove `ipts` firmware derivative - This is only needed on the 4.19 kernel -** DOING Investigate problem with ath10k wifi firmware on Surface Go +** DONE Investigate problem with ath10k wifi firmware on Surface Go :LOGBOOK: - 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: -*** DOING Create derivative for `ath10k` firmware on Surface Go +*** DONE Create derivative for `ath10k` firmware on Surface Go :LOGBOOK: - State "DOING" from "TODO" [2021-02-09 Tue 17:18] :END: @@ -31,8 +32,8 @@ - [X] Download `board.bin` from Killer Networks? - [X] Install ath10k firmware fix for Surface Go - `board-2.bin` needs to be removed / replaced with `board.bin` - - [ ] Add a config option for enabling the Surface Go Firmware - - [ ] Replace the vendorised `board.bin` with a `fetchurl` + - [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 ** TODO Incorporate @hpfr's function(s) from this commit: diff --git a/microsoft/surface/firmware/surface-go/ath10k/ath10k.nix b/microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix similarity index 100% rename from microsoft/surface/firmware/surface-go/ath10k/ath10k.nix rename to microsoft/surface/firmware/surface-go/ath10k/ath10k-replace.nix diff --git a/microsoft/surface/firmware/surface-go/ath10k/default.nix b/microsoft/surface/firmware/surface-go/ath10k/default.nix index 44f2bfdf..b23fe2e5 100644 --- a/microsoft/surface/firmware/surface-go/ath10k/default.nix +++ b/microsoft/surface/firmware/surface-go/ath10k/default.nix @@ -5,14 +5,14 @@ in { options = { hardware.microsoft-surface.firmware.surface-go-ath10k = { - enable = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; + replace = lib.mkEnableOption ''Use the "board.bin" firmware for ath10k-based WiFi on Surface Go.''; }; }; - config = lib.mkIf cfg.enable { + config = lib.mkIf cfg.replace { hardware.enableAllFirmware = true; hardware.firmware = [ - (pkgs.callPackage ./ath10k.nix {}) + (pkgs.callPackage ./ath10k-replace.nix {}) ]; boot.extraModprobeConfig = lib.mkDefault '' From 61210f5e44a816294ec8544a406185beb937e0f9 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 17:33:35 +1300 Subject: [PATCH 41/47] Update to kernel 5.10.19 - Add kernel 5.10.19 and latest linux-surface patches - Remove kernel 5.10.2 commit 7250b8cbb40bc001109b1032b426ce9923335de0 Author: mexisme Date: Fri Feb 5 08:38:10 2021 +1300 commit 90b210dfeeaf6f625e1b7f47dfc3a0b60f4172a6 Author: mexisme Date: Fri Feb 5 08:37:41 2021 +1300 commit bbb5dec0e353f841612a1c3a3f933c56ede418b2 Author: mexisme Date: Tue Feb 2 23:58:51 2021 +1300 commit bde79616d2795fcedc2d88161933713a9f37e3a7 Author: mexisme Date: Tue Feb 2 23:58:35 2021 +1300 commit be5b9c91acaebe1e17d582a1f364995dadcc339d Author: mexisme Date: Tue Feb 2 23:57:54 2021 +1300 --- microsoft/surface/TODO.org | 3 ++- microsoft/surface/kernel/default.nix | 2 +- .../default.nix | 26 ++++++++++++------- .../linux-5.10.19.nix} | 4 +-- microsoft/surface/repos.nix | 4 +-- 5 files changed, 24 insertions(+), 15 deletions(-) rename microsoft/surface/kernel/{linux-5.10.2 => linux-5.10.19}/default.nix (82%) rename microsoft/surface/kernel/{linux-5.10.2/linux-5.10.2.nix => linux-5.10.19/linux-5.10.19.nix} (85%) diff --git a/microsoft/surface/TODO.org b/microsoft/surface/TODO.org index 7db7ea42..125ec7d2 100644 --- a/microsoft/surface/TODO.org +++ b/microsoft/surface/TODO.org @@ -3,9 +3,10 @@ - Latest from linux-surface - [X] Download github.com/linux-surface/linux-surface kernel 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 - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing +** DOING Update to kernel 5.10.19 * Firmware ** DONE Remove old firmware binaries - Looks like the ath10k files aren't needed, any more diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/kernel/default.nix index b280f2d9..82401533 100644 --- a/microsoft/surface/kernel/default.nix +++ b/microsoft/surface/kernel/default.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: { - boot.kernelPackages = pkgs.callPackage ./linux-5.10.2 {}; + boot.kernelPackages = pkgs.callPackage ./linux-5.10.19 {}; } diff --git a/microsoft/surface/kernel/linux-5.10.2/default.nix b/microsoft/surface/kernel/linux-5.10.19/default.nix similarity index 82% rename from microsoft/surface/kernel/linux-5.10.2/default.nix rename to microsoft/surface/kernel/linux-5.10.19/default.nix index d4f6eb4e..ab3dc8c4 100644 --- a/microsoft/surface/kernel/linux-5.10.2/default.nix +++ b/microsoft/surface/kernel/linux-5.10.19/default.nix @@ -1,10 +1,9 @@ { config, lib, pkgs, ... }: let repos = (pkgs.callPackage ../../repos.nix {}); - # TODO: Can I append the path ./patches instead of a string? patches = repos.linux-surface + "/patches"; surface_kernelPatches = [ - { name = "microsoft-surface-patches-linux-5.10.2"; + { name = "microsoft-surface-patches-linux-5.10.19"; patch = null; extraConfig = '' # @@ -44,8 +43,8 @@ let # # Cameras: IPU3 # - ## TODO: Fix for kernel 5.10.2: - ##VIDEO_IPU3_IMGU m + ## Not yet supported in the patches? + # VIDEO_IPU3_IMGU m VIDEO_IPU3_CIO2 m CIO2_BRIDGE y INT3472 m @@ -54,8 +53,13 @@ let # Cameras: Sensor drivers # VIDEO_OV5693 m - ## TODO: Fix for kernel 5.10.2: - ##VIDEO_OV8865 m + ## Not yet supported in the patches? + # VIDEO_OV8865 m + + # + # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + # + APDS9960 m # # Other Drivers @@ -101,12 +105,16 @@ let patch = patches + "/5.10/0008-surface-typecover.patch"; } { - name = "ms-surface/0009-cameras"; - patch = patches + "/5.10/0009-cameras.patch"; + name = "ms-surface/0009-surface-sensors"; + 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 ( - callPackage ./linux-5.10.2.nix { + callPackage ./linux-5.10.19.nix { kernelPatches = surface_kernelPatches; } ))) diff --git a/microsoft/surface/kernel/linux-5.10.2/linux-5.10.2.nix b/microsoft/surface/kernel/linux-5.10.19/linux-5.10.19.nix similarity index 85% rename from microsoft/surface/kernel/linux-5.10.2/linux-5.10.2.nix rename to microsoft/surface/kernel/linux-5.10.19/linux-5.10.19.nix index 411a88d9..04b97d2d 100644 --- a/microsoft/surface/kernel/linux-5.10.2/linux-5.10.2.nix +++ b/microsoft/surface/kernel/linux-5.10.19/linux-5.10.19.nix @@ -3,7 +3,7 @@ with stdenv.lib; 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 = if (modDirVersionArg == null) then concatStringsSep "." (take 3 (splitVersion "${version}.0")) else modDirVersionArg; @@ -13,6 +13,6 @@ buildLinux (args // rec { src = fetchurl { url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz"; - sha256 = "18l1ywp99inm90434fm74w8rjfl4yl974kfcpizg2sp2p8xf311v"; + sha256 = "1mml5a30ky0khzj3r6ahybycbbszk86agq62qclwq2kzvsqbprr7"; }; } // (args.argsOverride or {})) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index 86424162..1f715b7a 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -2,7 +2,7 @@ { linux-surface = fetchgit { url="https://github.com/linux-surface/linux-surface.git"; - rev="25ab2cf75e5eda5ab9739db1907300010c06dacf"; - sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9"; + rev="f8fab978a480a4ed57e9ebb6928683b2e443c1c5"; + sha256="0zwybprwjckpapxm6gxzh6hwdd1w91g5sjxn6z52zlvvjpkmw959"; }; } From be4115ae23b52a6614a3e64c6d9e3667ae38dce4 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 17:49:59 +1300 Subject: [PATCH 42/47] Update the module options --- microsoft/surface/kernel/linux-5.10.19/default.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/microsoft/surface/kernel/linux-5.10.19/default.nix b/microsoft/surface/kernel/linux-5.10.19/default.nix index ab3dc8c4..25d64182 100644 --- a/microsoft/surface/kernel/linux-5.10.19/default.nix +++ b/microsoft/surface/kernel/linux-5.10.19/default.nix @@ -14,12 +14,17 @@ let SURFACE_AGGREGATOR_BUS y SURFACE_AGGREGATOR_CDEV m SURFACE_AGGREGATOR_REGISTRY m + SURFACE_ACPI_NOTIFY m - SURFACE_BATTERY m SURFACE_DTX m - SURFACE_HID 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 # See: https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing @@ -43,17 +48,15 @@ let # # Cameras: IPU3 # - ## Not yet supported in the patches? # VIDEO_IPU3_IMGU m VIDEO_IPU3_CIO2 m CIO2_BRIDGE y - INT3472 m + INTEL_SKL_INT3472 m # # Cameras: Sensor drivers # VIDEO_OV5693 m - ## Not yet supported in the patches? # VIDEO_OV8865 m # From 920bffdfbc8237f8f60f774bf807ff5549bd1d55 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 17:58:57 +1300 Subject: [PATCH 43/47] Disable some modules that aren't yet fully supported by the patches --- microsoft/surface/kernel/linux-5.10.19/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/microsoft/surface/kernel/linux-5.10.19/default.nix b/microsoft/surface/kernel/linux-5.10.19/default.nix index 25d64182..e13e872f 100644 --- a/microsoft/surface/kernel/linux-5.10.19/default.nix +++ b/microsoft/surface/kernel/linux-5.10.19/default.nix @@ -48,6 +48,7 @@ let # # Cameras: IPU3 # + ## Not yet supported in the patches # VIDEO_IPU3_IMGU m VIDEO_IPU3_CIO2 m CIO2_BRIDGE y @@ -57,6 +58,7 @@ let # Cameras: Sensor drivers # VIDEO_OV5693 m + ## Not yet supported in the patches # VIDEO_OV8865 m # From 94f7c2cb9cfef8ff04b4725bc3ad0ae64f844b19 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 20:56:06 +1300 Subject: [PATCH 44/47] Mark as done --- microsoft/surface/TODO.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/microsoft/surface/TODO.org b/microsoft/surface/TODO.org index 125ec7d2..63434511 100644 --- a/microsoft/surface/TODO.org +++ b/microsoft/surface/TODO.org @@ -6,7 +6,10 @@ ** CANCELLED Create a function for selecting preferred kernel ** DONE Fix how Keyboard & Trackpad are not being enabled on SL3 - https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing -** DOING Update to kernel 5.10.19 +** DONE Update to kernel 5.10.19 +:LOGBOOK: +- State "DONE" from "DOING" [2021-03-06 Sat 20:55] +:END: * Firmware ** DONE Remove old firmware binaries - Looks like the ath10k files aren't needed, any more From 523d8efb5d826e2d21a9637eaf04fb0abbdb9980 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 22:24:34 +1300 Subject: [PATCH 45/47] Should have used HTTP instead of SSH --- microsoft/surface/repos.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index a1b434f4..eb558bec 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -19,7 +19,7 @@ }; surface-go-ath10k-firmware_backup = fetchgit { - url="git@github.com:mexisme/linux-surface_ath10k-firmware.git"; + url="https://github.com/mexisme/linux-surface_ath10k-firmware.git"; rev="74e5409e699383d6ca2bc4da4a8433d16f3850b1"; sha256="169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk"; }; From bfbb77e8f1a20cacbdd12f3de3f618f1bb2eda09 Mon Sep 17 00:00:00 2001 From: mexisme Date: Sat, 6 Mar 2021 22:48:50 +1300 Subject: [PATCH 46/47] Use fetchFromGitHub instead of fetchgit --- microsoft/surface/repos.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index eb558bec..466f6f25 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -1,13 +1,15 @@ -{ lib, pkgs, fetchgit, fetchurl }: +{ lib, pkgs, fetchFromGitHub, fetchurl }: { - linux-surface = fetchgit { - url="https://github.com/linux-surface/linux-surface.git"; + linux-surface = fetchFromGitHub { + owner="linux-surface"; + repo="linux-surface"; rev="f8fab978a480a4ed57e9ebb6928683b2e443c1c5"; sha256="0zwybprwjckpapxm6gxzh6hwdd1w91g5sjxn6z52zlvvjpkmw959"; }; - ath10k-firmware = fetchgit { - url="https://github.com/kvalo/ath10k-firmware"; + ath10k-firmware = fetchFromGitHub { + owner="kvalo"; + repo="ath10k-firmware"; rev="84b47062aab31d67156e0a3ef593a6999a12864b"; sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py"; }; @@ -18,8 +20,9 @@ sha256="0l8wfj8z4jbb31nzqkaxisby0n6061ix01c5di9bq66iby59j8py"; }; - surface-go-ath10k-firmware_backup = fetchgit { - url="https://github.com/mexisme/linux-surface_ath10k-firmware.git"; + surface-go-ath10k-firmware_backup = fetchFromGitHub { + owner="mexisme"; + repo="linux-surface_ath10k-firmware"; rev="74e5409e699383d6ca2bc4da4a8433d16f3850b1"; sha256="169vgvxpgad9anmchs22fj5qm6ahzjfdnwhd8pc280q705vx6pjk"; }; From cca70642e857b9010640da2b6dc2eddfa06a7603 Mon Sep 17 00:00:00 2001 From: Peng Mei Yu Date: Tue, 9 Mar 2021 12:32:58 +0800 Subject: [PATCH 47/47] ThinkPad X270: Disable Panel Self Refresh. --- lenovo/thinkpad/x270/default.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lenovo/thinkpad/x270/default.nix b/lenovo/thinkpad/x270/default.nix index 870d9a85..af4991b3 100644 --- a/lenovo/thinkpad/x270/default.nix +++ b/lenovo/thinkpad/x270/default.nix @@ -3,4 +3,9 @@ ../. ../../../common/cpu/intel ]; + + boot.kernelParams = [ + # Disable "Panel Self Refresh". Fix random freezes. + "i915.enable_psr=0" + ]; }