Merge branch 'master' into surface-control

This commit is contained in:
Winter
2021-03-17 15:45:28 -04:00
committed by GitHub
20 changed files with 476 additions and 51 deletions

View File

@@ -15,7 +15,7 @@ The kernel-specific derivations are under the `kernel/` sub-directory.
In order to simplify maintenance of the Nix code, only the most-recent kernel patch-set is expected
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
@@ -63,11 +63,28 @@ See: https://github.com/linux-surface/linux-surface/blob/master/README.md
On the Surface Go, the standard firmware from the official Linux Firmware repo has issues with the
`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.
The derivative in `firmware/surface-go/ath10k/` can configure this, if you set the option
`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace` to `true`.
_*NOTE:*_ This is destructive, as it deletes all the `board.bin` and `board-2.bin` files for the
`ath10k` QCA6174 device, and replaces them with KillerNetworking's version.
This is the only way (currently) to force the driver to use the new firmware.
For more details, see: https://github.com/linux-surface/linux-surface/wiki/Surface-Go#wifi-firmware
_*NOTE:*_ There's some work to patch the kernel to make it easier to override which firmware file
to use for QCA6174, which would obviate this more-destructuve approach:
- https://github.com/linux-surface/kernel/commit/22ef83836c4aa89e9eb98de9b47ed24b6c2a1d45
_*NOTE:*_ There was an attempt to get this firmware incorporated into the aggregate `board-2.bin`,
but (as of this writing) the request appears to have been ignored:
- https://github.com/linux-surface/linux-surface/issues/41
References:
- https://github.com/jakeday/linux-surface/issues/441
- https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/

View File

@@ -3,9 +3,13 @@
- 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
** 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
@@ -14,14 +18,27 @@
- [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
** 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:
*** DONE Create derivative for `ath10k` firmware on Surface Go
:LOGBOOK:
- State "DOING" from "TODO" [2021-02-09 Tue 17:18]
:END:
- [X] Download github.com/kvalo/ath10k-firmware ?
- [X] Download 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`
- [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:
- https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,10 +1,9 @@
{ config, lib, pkgs, ... }:
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 = ''
#
@@ -15,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
@@ -44,18 +48,23 @@ 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
INTEL_SKL_INT3472 m
#
# 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 +110,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;
}
)))

View File

@@ -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 {}))

View File

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