From 416249d1ba7f4312836fe7216a95cb06c288312a Mon Sep 17 00:00:00 2001 From: Stig Palmquist Date: Tue, 29 Aug 2023 02:28:09 +0200 Subject: [PATCH] surface: add kernel 6.4.12 --- microsoft/surface/common/default.nix | 2 +- microsoft/surface/common/kernel/default.nix | 1 + .../common/kernel/linux-6.4.12/default.nix | 38 +++++ .../common/kernel/linux-6.4.12/patches.nix | 138 ++++++++++++++++++ microsoft/surface/common/repos.nix | 4 +- 5 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 microsoft/surface/common/kernel/linux-6.4.12/default.nix create mode 100644 microsoft/surface/common/kernel/linux-6.4.12/patches.nix diff --git a/microsoft/surface/common/default.nix b/microsoft/surface/common/default.nix index 3f54c9c..37db0c8 100644 --- a/microsoft/surface/common/default.nix +++ b/microsoft/surface/common/default.nix @@ -10,7 +10,7 @@ in { ./surface-control ]; - microsoft-surface.kernelVersion = mkDefault "6.1.18"; + microsoft-surface.kernelVersion = mkDefault "6.4.12"; # Seems to be required to properly enable S0ix "Modern Standby": boot.kernelParams = mkDefault [ "mem_sleep_default=deep" ]; diff --git a/microsoft/surface/common/kernel/default.nix b/microsoft/surface/common/kernel/default.nix index ffb4d2b..934dfdf 100644 --- a/microsoft/surface/common/kernel/default.nix +++ b/microsoft/surface/common/kernel/default.nix @@ -8,6 +8,7 @@ in { ./linux-5.19.17 ./linux-6.0.17 ./linux-6.1.18 + ./linux-6.4.12 ]; options.microsoft-surface.kernelVersion = mkOption { diff --git a/microsoft/surface/common/kernel/linux-6.4.12/default.nix b/microsoft/surface/common/kernel/linux-6.4.12/default.nix new file mode 100644 index 0000000..e99c5d4 --- /dev/null +++ b/microsoft/surface/common/kernel/linux-6.4.12/default.nix @@ -0,0 +1,38 @@ +{ config, lib, pkgs, ... }: + +let + inherit (lib) mkIf mkOption types; + inherit (pkgs) fetchurl; + + inherit (pkgs.callPackage ../linux-package.nix { }) linuxPackage repos; + + cfg = config.microsoft-surface; + + version = "6.4.12"; + extraMeta.branch = "6.4"; + patchDir = repos.linux-surface + "/patches/${extraMeta.branch}"; + kernelPatches = pkgs.callPackage ./patches.nix { + inherit (lib) kernel; + inherit version patchDir; + }; + + kernelPackages = linuxPackage { + inherit version extraMeta kernelPatches; + src = fetchurl { + url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; + sha256 = "0x56b4hslm730ghvggz41fjkbzlnxp6k8857dn7iy27yavlipafc"; + }; + }; + + +in { + options.microsoft-surface.kernelVersion = mkOption { + type = types.enum [ "6.4.12" ]; + }; + + config = mkIf (cfg.kernelVersion == "6.4.12") { + boot = { + inherit kernelPackages; + }; + }; +} diff --git a/microsoft/surface/common/kernel/linux-6.4.12/patches.nix b/microsoft/surface/common/kernel/linux-6.4.12/patches.nix new file mode 100644 index 0000000..433ed15 --- /dev/null +++ b/microsoft/surface/common/kernel/linux-6.4.12/patches.nix @@ -0,0 +1,138 @@ +{ kernel, + patchDir, + version, +}: + +[ + { + name = "microsoft-surface-patches-linux-${version}"; + patch = null; + structuredExtraConfig = with kernel; { + STREAMING_MEDIA = yes; + + # + # Surface Aggregator Module + # + SURFACE_AGGREGATOR = module; + SURFACE_AGGREGATOR_ERROR_INJECTION = no; + SURFACE_AGGREGATOR_BUS = yes; + SURFACE_AGGREGATOR_CDEV = module; + SURFACE_AGGREGATOR_HUB = module; + SURFACE_AGGREGATOR_REGISTRY = module; + SURFACE_AGGREGATOR_TABLET_SWITCH = module; + + SURFACE_ACPI_NOTIFY = module; + SURFACE_DTX = module; + SURFACE_PLATFORM_PROFILE = module; + + SURFACE_HID = module; + SURFACE_KBD = module; + + BATTERY_SURFACE = module; + CHARGER_SURFACE = module; + + # + # Surface Hotplug + # + SURFACE_HOTPLUG = module; + + # + # Intel Touch Host Controller + # + HID_ITHC = module; + + # + # IPTS touchscreen + # + # This only enables the user interface for IPTS data. + # For the touchscreen to work, you need to install iptsd. + # + MISC_IPTS = module; + + # + # Cameras: IPU3 + # + VIDEO_DW9719 = module; + VIDEO_IPU3_IMGU = module; + VIDEO_IPU3_CIO2 = module; + CIO2_BRIDGE = yes; + INTEL_SKL_INT3472 = module; + REGULATOR_TPS68470 = module; + COMMON_CLK_TPS68470 = module; + COMMON_LEDS_TPS68470 = module; + + # + # Cameras: Sensor drivers + # + VIDEO_OV5693 = module; + VIDEO_OV7251 = module; + VIDEO_OV8865 = module; + + # + # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + # + APDS9960 = module; + + # + # Other Drivers + # + INPUT_SOC_BUTTON_ARRAY = module; + SURFACE_3_POWER_OPREGION = module; + SURFACE_PRO3_BUTTON = module; + SURFACE_GPE = module; + SURFACE_BOOK1_DGPU_SWITCH = module; + }; + } + { + name = "ms-surface/0001-surface3-oemb"; + patch = patchDir + "/0001-surface3-oemb.patch"; + } + { + name = "ms-surface/0002-mwifiex"; + patch = patchDir + "/0002-mwifiex.patch"; + } + { + name = "ms-surface/0003-ath10k"; + patch = patchDir + "/0003-ath10k.patch"; + } + { + name = "ms-surface/0004-ipts"; + patch = patchDir + "/0004-ipts.patch"; + } + { + name = "ms-surface/0005-ithc"; + patch = patchDir + "/0005-ithc.patch"; + } + { + name = "ms-surface/0006-surface-sam-over-hid"; + patch = patchDir + "/0006-surface-sam-over-hid.patch"; + } + { + name = "ms-surface/0007-surface-button"; + patch = patchDir + "/0007-surface-button.patch"; + } + { + name = "ms-surface/0008-surface-typecover"; + patch = patchDir + "/0008-surface-typecover.patch"; + } + { + name = "ms-surface/0009-surface-shutdown"; + patch = patchDir + "/0009-surface-shutdown.patch"; + } + { + name = "ms-surface/0010-surface-gpe"; + patch = patchDir + "/0010-surface-gpe.patch"; + } + { + name = "ms-surface/0011-cameras"; + patch = patchDir + "/0011-cameras.patch"; + } + { + name = "ms-surface/0012-amd-gpio"; + patch = patchDir + "/0012-amd-gpio.patch"; + } + { + name = "ms-surface/0013-rtc"; + patch = patchDir + "/0013-rtc.patch"; + } +] diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix index 982fefd..9e7bbbf 100644 --- a/microsoft/surface/common/repos.nix +++ b/microsoft/surface/common/repos.nix @@ -4,8 +4,8 @@ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; - rev = "efe7ddadd4aad3d1a6531334fe086931ec8640a1"; - sha256 = "sha256-WgJHLY4vU4lsZ6M0hOng8TMVRALxQeSwQM4QX6DzrbI="; + rev = "32c55fe01ce62bf763181d06f0493c29e178cc62"; + hash = "sha256-oWZeHoLR3jSkMFfc36ikEwyFuXWzwXK/dC4sE98R0oc="; }; # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: