1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-30 14:59:43 +01:00

Merge remote-tracking branch 'origin/master' into dell-xps-9550-nvidia

This commit is contained in:
John Ericson 2021-02-08 18:23:20 -05:00
commit b22284989a
14 changed files with 308 additions and 16 deletions

View file

@ -116,6 +116,7 @@ See code for all available configurations.
| Lenovo ThinkPad T480s | `<nixos-hardware/lenovo/thinkpad/t480s>` | | Lenovo ThinkPad T480s | `<nixos-hardware/lenovo/thinkpad/t480s>` |
| Lenovo ThinkPad T490 | `<nixos-hardware/lenovo/thinkpad/t490>` | | Lenovo ThinkPad T490 | `<nixos-hardware/lenovo/thinkpad/t490>` |
| Lenovo ThinkPad T495 | `<nixos-hardware/lenovo/thinkpad/t495>` | | Lenovo ThinkPad T495 | `<nixos-hardware/lenovo/thinkpad/t495>` |
| Lenovo ThinkPad X113 Yoga | `<nixos-hardware/lenovo/thinkpad/x13-yoga>` |
| Lenovo ThinkPad X140e | `<nixos-hardware/lenovo/thinkpad/x140e>` | | Lenovo ThinkPad X140e | `<nixos-hardware/lenovo/thinkpad/x140e>` |
| Lenovo ThinkPad X220 | `<nixos-hardware/lenovo/thinkpad/x220>` | | Lenovo ThinkPad X220 | `<nixos-hardware/lenovo/thinkpad/x220>` |
| Lenovo ThinkPad X230 | `<nixos-hardware/lenovo/thinkpad/x230>` | | Lenovo ThinkPad X230 | `<nixos-hardware/lenovo/thinkpad/x230>` |
@ -156,6 +157,7 @@ See code for all available configurations.
[Inverse Path USB armory]: inversepath/usbarmory [Inverse Path USB armory]: inversepath/usbarmory
[Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen [Lenovo ThinkPad X1 (6th Gen)]: lenovo/thinkpad/x1/6th-gen
[Lenovo ThinkPad X1 (7th Gen)]: lenovo/thinkpad/x1/7th-gen [Lenovo ThinkPad X1 (7th Gen)]: lenovo/thinkpad/x1/7th-gen
[Lenovo ThinkPad X13 Yoga]: lenovo/thinkpad/x13-yoga
[Lenovo ThinkPad X260]: lenovo/thinkpad/x260 [Lenovo ThinkPad X260]: lenovo/thinkpad/x260
[Microsoft Surface Pro 3]: microsoft/surface-pro/3 [Microsoft Surface Pro 3]: microsoft/surface-pro/3
[Raspberry Pi 2]: raspberry-pi/2 [Raspberry Pi 2]: raspberry-pi/2

View file

@ -8,8 +8,8 @@
apple-macbook-air-3 = import ./apple/macbook-air/3; apple-macbook-air-3 = import ./apple/macbook-air/3;
apple-macbook-air-4 = import apple/macbook-air/4; apple-macbook-air-4 = import apple/macbook-air/4;
apple-macbook-air-6 = import apple/macbook-air/6; apple-macbook-air-6 = import apple/macbook-air/6;
apple-macbook-air-10-1 = import ./apple/macbook-pro/10-1; apple-macbook-pro-10-1 = import ./apple/macbook-pro/10-1;
apple-macbook-air-12-1 = import ./apple/macbook-pro/12-1; apple-macbook-pro-12-1 = import ./apple/macbook-pro/12-1;
beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle; beagleboard-pocketbeagle = import ./beagleboard/pocketbeagle;
dell-g3-3779 = import ./dell/g3/3779; dell-g3-3779 = import ./dell/g3/3779;
dell-latitude-3480 = import ./dell/latitude/3480; dell-latitude-3480 = import ./dell/latitude/3480;
@ -61,6 +61,8 @@
lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen; lenovo-thinkpad-x1-6th-gen = import ./lenovo/thinkpad/x1/6th-gen;
lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen; lenovo-thinkpad-x1-7th-gen = import ./lenovo/thinkpad/x1/7th-gen;
lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme; lenovo-thinkpad-x1-extreme = import ./lenovo/thinkpad/x1-extreme;
lenovo-thinkpad-x13-yoga = import ./lenovo/thinkpad/x13-yoga;
microsoft-surface = import ./microsoft/surface;
microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3;
pcengines-apu = import ./pcengines/apu; pcengines-apu = import ./pcengines/apu;
raspberry-pi-2 = import ./raspberry-pi/2; raspberry-pi-2 = import ./raspberry-pi/2;

View file

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

View file

@ -1,9 +1,4 @@
{ lib, ... }: { lib, ... }:
{ {
# to use the type cover in the initrd imports = [ ../../surface ];
boot.kernelModules = [ "hid-microsoft" ];
# TODO: reverse compat
networking.wireless.enable = lib.mkDefault true;
} }

View file

@ -0,0 +1,73 @@
# Derivatives for Microsoft Surface notebooks
These derivatives use the patches from the [linux-surface repo](https://github.com/linux-surface/linux-surface/tree/master/patches).
## Kernel
The kernel needs several patches to make it work correctly with some of the hardware on various
Surface models, e.g. keyboard/trackpad, camera, wifi.
Not all hardware is fully supported, but the
[linux-surface feature matrix](https://github.com/linux-surface/linux-surface/wiki/Supported-Devices-and-Features#feature-matrix)
provides details on which devices are supported on which types of machine.
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:
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
## Firmware, Drivers and Support Tools
### WiFi
For the Surface Go, please see the "Issues" sections below.
### IPTS
IPTS is used on most of the Surface range, except for Surface Go and Surface Laptop 3 (AMD version).
Older kernels used specialised firmware which used a method that's no longer supported by the
more-recent kernels.
Newer kernels use the kernel-space `intel-precise-touch` driver and user-space `ipstd` daemon.
The `iptsd` daemon works with the `intel-precise-touch` driver to convert raw touch data from the
kernel-space driver into events for the HID / input sub-system.
- https://github.com/linux-surface/iptsd
- https://github.com/linux-surface/intel-precise-touch
- _*NOTE:*_ The patches from this repo are included in the above kernel patches, already.
### DTX, `surface-control`
*TODO*
# ToDo's Not Done
See: [TODO.org](./TODO.org)
# Issues
## TLP daemon
TLP is known to cause problems on Surface unless correctly configured.
See: https://github.com/linux-surface/linux-surface/blob/master/README.md
## Wifi Firmware for Surface Go
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*
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.
References:
- https://github.com/jakeday/linux-surface/issues/441
- https://www.reddit.com/r/SurfaceLinux/comments/e8quqg/surface_go_official_wifi_fix/
- https://hackmd.io/@dasgeek/ryA5i5Dor
- https://github.com/thebitstick/surfacego-wifi
- https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/ath10k
- https://wireless.wiki.kernel.org/en/users/drivers/ath10k/firmware

View file

@ -0,0 +1,38 @@
* Kernel Patching
** DONE Create derivative to patch kernel 5.10.2
- 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
** DONE Fix how Keyboard & Trackpad are not being enabled on SL3
- https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
* Firmware
** DONE Remove old firmware binaries
- Looks like the ath10k files aren't needed, any more
** DONE Create derivative for `ipts` firmware
- [X] Download github.com/linux-surface/surface-ipts-firmware firmware
- [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
- [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
- `board-2.bin` needs to be removed / replaced with `board.bin`
* Support Tools
** TODO Incorporate @hpfr's function(s) from this commit:
- https://github.com/hpfr/system/commit/03fa1b0a83f8a336e812910d0d50f5247a8a630c
** TODO Create derivative for `iptsd` touch-screen daemon
- [ ] Download
- [ ] Install binary
- [ ] Enable via systemd
** TODO Create derivative to patch and rebuild libwacom
- github.com/linux-surface/libwacom-surface
- The plan is to do this in a separate PR against `nixpkgs` instead of `nixos-hardware`
** TODO Create derivative to install `surface-control`
- Download github.com/linux-surface/surface-control
** TODO Create derivative to install `surface-dtx-daemon`
- Download github.com/linux-surface/surface-dtx-daemon

View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, ... }:
{
imports = [
./kernel
./firmware
./hardware_configuration.nix
];
}

View file

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

View file

@ -0,0 +1,18 @@
{ config, lib, pkgs, ... }:
{
boot.extraModprobeConfig = lib.mkDefault ''
options i915 enable_fbc=1 enable_rc6=1 modeset=1
options snd_hda_intel power_save=1
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" ];
# NOTE: Check the README before enabling TLP:
services.tlp.enable = lib.mkDefault false;
hardware.sensor.iio.enable = lib.mkDefault true;
}

View file

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

View file

@ -0,0 +1,112 @@
{ 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";
patch = null;
extraConfig = ''
#
# Surface Aggregator Module
#
SURFACE_AGGREGATOR m
SURFACE_AGGREGATOR_ERROR_INJECTION n
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
#
# These built-in modules are required for the Surface Aggregator Module
# See: https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing
#
SERIAL_DEV_BUS y
SERIAL_DEV_CTRL_TTYPORT y
#
# Surface Hotplug
#
SURFACE_HOTPLUG m
#
# IPTS touchscreen
#
# This only enables the user interface for IPTS data.
# For the touchscreen to work, you need to install iptsd.
#
MISC_IPTS m
#
# Cameras: IPU3
#
## TODO: Fix for kernel 5.10.2:
##VIDEO_IPU3_IMGU m
VIDEO_IPU3_CIO2 m
CIO2_BRIDGE y
INT3472 m
#
# Cameras: Sensor drivers
#
VIDEO_OV5693 m
## TODO: Fix for kernel 5.10.2:
##VIDEO_OV8865 m
#
# Other Drivers
#
INPUT_SOC_BUTTON_ARRAY m
SURFACE_3_BUTTON m
SURFACE_3_POWER_OPREGION m
SURFACE_PRO3_BUTTON m
SURFACE_GPE m
SURFACE_BOOK1_DGPU_SWITCH m
'';
}
{
name = "ms-surface/0001-surface3-oemb";
patch = patches + "/5.10/0001-surface3-oemb.patch";
}
{
name = "ms-surface/0002-wifi";
patch = patches + "/5.10/0002-wifi.patch";
}
{
name = "ms-surface/0003-ipts";
patch = patches + "/5.10/0003-ipts.patch";
}
{
name = "ms-surface/0004-surface-gpe";
patch = patches + "/5.10/0004-surface-gpe.patch";
}
{
name = "ms-surface/0005-surface-sam-over-hid";
patch = patches + "/5.10/0005-surface-sam-over-hid.patch";
}
{
name = "ms-surface/0006-surface-sam";
patch = patches + "/5.10/0006-surface-sam.patch";
}
{
name = "ms-surface/0007-surface-hotplug";
patch = patches + "/5.10/0007-surface-hotplug.patch";
}
{
name = "ms-surface/0008-surface-typecover";
patch = patches + "/5.10/0008-surface-typecover.patch";
}
{
name = "ms-surface/0009-cameras";
patch = patches + "/5.10/0009-cameras.patch";
}
];
in (with pkgs; recurseIntoAttrs (linuxPackagesFor (
callPackage ./linux-5.10.2.nix {
kernelPatches = surface_kernelPatches;
}
)))

View file

@ -0,0 +1,18 @@
{ stdenv, buildPackages, fetchurl, perl, buildLinux, modDirVersionArg ? null, ... } @ args:
with stdenv.lib;
buildLinux (args // rec {
version = "5.10.2";
# 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;
# branchVersion needs to be x.y
extraMeta.branch = versions.majorMinor version;
src = fetchurl {
url = "mirror://kernel/linux/kernel/v5.x/linux-${version}.tar.xz";
sha256 = "18l1ywp99inm90434fm74w8rjfl4yl974kfcpizg2sp2p8xf311v";
};
} // (args.argsOverride or {}))

View file

@ -0,0 +1,8 @@
{ lib, pkgs, fetchgit }:
{
linux-surface = fetchgit {
url="https://github.com/linux-surface/linux-surface.git";
rev="25ab2cf75e5eda5ab9739db1907300010c06dacf";
sha256="0h8624d7ix1p6ysw9bllmnnwnv164z8xkx56zj3vdczn91vmqcf9";
};
}

View file

@ -1,8 +1,5 @@
{ lib, pkgs, ...}: { lib, pkgs, ...}:
let
hasConsoleExtraTTYs = lib.versionAtLeast (lib.versions.majorMinor lib.version) "21.03";
in
{ {
boot = { boot = {
consoleLogLevel = lib.mkDefault 7; consoleLogLevel = lib.mkDefault 7;
@ -21,11 +18,8 @@ in
version = lib.mkDefault 2; version = lib.mkDefault 2;
}; };
}; };
extraTTYs = lib.mkIf (!hasConsoleExtraTTYs) [ "ttyAMA0" ];
}; };
console.extraTTYs = lib.mkIf hasConsoleExtraTTYs [ "ttyAMA0" ];
nix.buildCores = 4; nix.buildCores = 4;
nixpkgs.config.platform = lib.systems.platforms.raspberrypi2; nixpkgs.config.platform = lib.systems.platforms.raspberrypi2;