From 86d77642bd30283a37e214a9537fdf06c83e6982 Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 14 Nov 2020 17:14:41 +0100 Subject: [PATCH 01/17] 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 0000000..ad27e85 --- /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 02/17] 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 ad27e85..dfd05ab 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 03/17] 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 dfd05ab..0f97550 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 04/17] 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 0f97550..874dd62 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 0000000..521bf32 --- /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 05/17] 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 12a25e0..bfcda89 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 06/17] 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 874dd62..e7a3e67 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 07/17] 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 e7a3e67..dccdb1b 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 08/17] 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 521bf32..f27874c 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 09/17] 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 dccdb1b..d4c73c5 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 10/17] 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 d4c73c5..a1fddf0 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 11/17] 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 a1fddf0..8cb4dbd 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 0000000..b935c89 --- /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 f27874c..7e1a756 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 12/17] 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 8cb4dbd..2cb3d22 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 b935c89..0000000 --- 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 13/17] 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 2cb3d22..c625adb 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 7e1a756..0000000 --- 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 d1e64db4c50cc458f7b79d1adb480b48fea4564a Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sat, 5 Dec 2020 16:56:31 +0100 Subject: [PATCH 14/17] 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 c625adb..cdb4292 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 15/17] 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 cdb4292..52eb9d5 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 16/17] Dell XPS 13 to flake.nix --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index f0d24bf..64aa17a 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 17/17] 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 0000000..53c53d9 --- /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 9677972..0fdfeee 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 f203797..7c8eadd 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 64aa17a..c5d6c2e 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;