diff --git a/lenovo/thinkpad/t440p/default.nix b/lenovo/thinkpad/t440p/default.nix index 53a93c2..144b7d0 100644 --- a/lenovo/thinkpad/t440p/default.nix +++ b/lenovo/thinkpad/t440p/default.nix @@ -7,8 +7,9 @@ ]; boot = { - extraModprobeConfig = lib.mkDefault '' + extraModprobeConfig = '' options bbswitch use_acpi_to_detect_card_state=1 + options thinkpad_acpi force_load=1 fan_control=1 ''; # TODO: probably enable tcsd? Is this line necessary? kernelModules = [ "tpm-rng" ]; diff --git a/microsoft/surface/common/kernel/default.nix b/microsoft/surface/common/kernel/default.nix index af2a2ba..f8044d3 100644 --- a/microsoft/surface/common/kernel/default.nix +++ b/microsoft/surface/common/kernel/default.nix @@ -7,6 +7,7 @@ in { imports = [ ./linux-5.19.17 ./linux-6.0.17 + ./linux-6.1.6 ]; options.microsoft-surface.kernelVersion = mkOption { diff --git a/microsoft/surface/common/kernel/linux-6.0.17/patches.nix b/microsoft/surface/common/kernel/linux-6.0.17/patches.nix index 7b0d096..f0ba2c9 100644 --- a/microsoft/surface/common/kernel/linux-6.0.17/patches.nix +++ b/microsoft/surface/common/kernel/linux-6.0.17/patches.nix @@ -11,28 +11,28 @@ # # Surface Aggregator Module # - CONFIG_SURFACE_AGGREGATOR = module; - CONFIG_SURFACE_AGGREGATOR_ERROR_INJECTION = no; - CONFIG_SURFACE_AGGREGATOR_BUS = yes; - CONFIG_SURFACE_AGGREGATOR_CDEV = module; - CONFIG_SURFACE_AGGREGATOR_HUB = module; - CONFIG_SURFACE_AGGREGATOR_REGISTRY = module; - CONFIG_SURFACE_AGGREGATOR_TABLET_SWITCH = 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; - CONFIG_SURFACE_ACPI_NOTIFY = module; - CONFIG_SURFACE_DTX = module; - CONFIG_SURFACE_PLATFORM_PROFILE = module; + SURFACE_ACPI_NOTIFY = module; + SURFACE_DTX = module; + SURFACE_PLATFORM_PROFILE = module; - CONFIG_SURFACE_HID = module; - CONFIG_SURFACE_KBD = module; + SURFACE_HID = module; + SURFACE_KBD = module; - CONFIG_BATTERY_SURFACE = module; - CONFIG_CHARGER_SURFACE = module; + BATTERY_SURFACE = module; + CHARGER_SURFACE = module; # # Surface Hotplug # - CONFIG_SURFACE_HOTPLUG = module; + SURFACE_HOTPLUG = module; # # IPTS touchscreen @@ -40,39 +40,39 @@ # This only enables the user interface for IPTS data. # For the touchscreen to work, you need to install iptsd. # - CONFIG_MISC_IPTS = module; + MISC_IPTS = module; # # Cameras: IPU3 # - CONFIG_VIDEO_DW9719 = module; - CONFIG_VIDEO_IPU3_IMGU = module; - CONFIG_VIDEO_IPU3_CIO2 = module; - CONFIG_CIO2_BRIDGE = yes; - CONFIG_INTEL_SKL_INT3472 = module; - CONFIG_REGULATOR_TPS68470 = module; - CONFIG_COMMON_CLK_TPS68470 = module; + 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; # # Cameras: Sensor drivers # - CONFIG_VIDEO_OV5693 = module; - CONFIG_VIDEO_OV7251 = module; - CONFIG_VIDEO_OV8865 = module; + VIDEO_OV5693 = module; + VIDEO_OV7251 = module; + VIDEO_OV8865 = module; # # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 # - CONFIG_APDS9960 = module; + APDS9960 = module; # # Other Drivers # - CONFIG_INPUT_SOC_BUTTON_ARRAY = module; - CONFIG_SURFACE_3_POWER_OPREGION = module; - CONFIG_SURFACE_PRO3_BUTTON = module; - CONFIG_SURFACE_GPE = module; - CONFIG_SURFACE_BOOK1_DGPU_SWITCH = module; + INPUT_SOC_BUTTON_ARRAY = module; + SURFACE_3_POWER_OPREGION = module; + SURFACE_PRO3_BUTTON = module; + SURFACE_GPE = module; + SURFACE_BOOK1_DGPU_SWITCH = module; }; } { diff --git a/microsoft/surface/common/kernel/linux-6.1.6/default.nix b/microsoft/surface/common/kernel/linux-6.1.6/default.nix new file mode 100644 index 0000000..86c17a9 --- /dev/null +++ b/microsoft/surface/common/kernel/linux-6.1.6/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.1.6"; + extraMeta.branch = "6.1"; + 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 = "sha256-Pk2OVh2lcDogWujXsr7WxcZPxCme68v9IEgeY7V9XuM="; + }; + }; + + +in { + options.microsoft-surface.kernelVersion = mkOption { + type = types.enum [ "6.1.6" ]; + }; + + config = mkIf (cfg.kernelVersion == "6.1.6") { + boot = { + inherit kernelPackages; + }; + }; +} diff --git a/microsoft/surface/common/kernel/linux-6.1.6/patches.nix b/microsoft/surface/common/kernel/linux-6.1.6/patches.nix new file mode 100644 index 0000000..7b3cfdc --- /dev/null +++ b/microsoft/surface/common/kernel/linux-6.1.6/patches.nix @@ -0,0 +1,124 @@ +{ 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; + + # + # 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; + + # + # 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-surface-sam"; + patch = patchDir + "/0005-surface-sam.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-cameras"; + patch = patchDir + "/0009-cameras.patch"; + } + { + name = "ms-surface/0010-amd-gpio"; + patch = patchDir + "/0010-amd-gpio.patch"; + } + { + name = "ms-surface/0011-rtc"; + patch = patchDir + "/0011-rtc.patch"; + } +] diff --git a/microsoft/surface/common/repos.nix b/microsoft/surface/common/repos.nix index eb9e5fa..f10ad9a 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 = "487e64047ca047dde9a062909a87410e7bb86845"; - sha256 = "sha256-HTIuRBZk0prhUPd2KnsXGo+ZyBsMwERN7P8WJH1RG3M="; + rev = "91240ac43dfdfb3e68bbc604def84685a218fab9"; + sha256 = "sha256-Jf7tthFWj67Esjx+/ZwG7BYlN7zWS26e1TbsznNxE9Q="; }; # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: diff --git a/microsoft/surface/surface-go/default.nix b/microsoft/surface/surface-go/default.nix index fdd13f6..b57d73e 100644 --- a/microsoft/surface/surface-go/default.nix +++ b/microsoft/surface/surface-go/default.nix @@ -17,6 +17,8 @@ in { ../../../common/cpu/intel/kaby-lake ]; + microsoft-surface.kernelVersion = "6.1.6"; + boot.kernelParams = [ "i915.enable_rc6=1" "i915.modeset=1"