From 800786f11d0d195af558d67db151a33055604087 Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 9 Jan 2023 23:05:15 +1300 Subject: [PATCH 1/9] Add Kernel 6.0.17 --- microsoft/surface/kernel/default.nix | 1 + .../surface/kernel/linux-6.0.17/default.nix | 38 ++++++ .../surface/kernel/linux-6.0.17/patches.nix | 122 ++++++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 microsoft/surface/kernel/linux-6.0.17/default.nix create mode 100644 microsoft/surface/kernel/linux-6.0.17/patches.nix diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/kernel/default.nix index 6eba2ca8..2b19413b 100644 --- a/microsoft/surface/kernel/default.nix +++ b/microsoft/surface/kernel/default.nix @@ -7,6 +7,7 @@ in { imports = [ ./linux-5.19.17 ./linux-6.0.11 + ./linux-6.0.17 ]; options.microsoft-surface.kernelVersion = mkOption { diff --git a/microsoft/surface/kernel/linux-6.0.17/default.nix b/microsoft/surface/kernel/linux-6.0.17/default.nix new file mode 100644 index 00000000..51960650 --- /dev/null +++ b/microsoft/surface/kernel/linux-6.0.17/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.0.17"; + extraMeta.branch = "6.0"; + 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-p+6SCSpUWbtGq/C1RJpOV+i3klkaxOesBO0lQtLOHQg="; + }; + }; + + +in { + options.microsoft-surface.kernelVersion = mkOption { + type = types.enum [ "6.0.17" ]; + }; + + config = mkIf (cfg.kernelVersion == "6.0.17") { + boot = { + inherit kernelPackages; + }; + }; +} diff --git a/microsoft/surface/kernel/linux-6.0.17/patches.nix b/microsoft/surface/kernel/linux-6.0.17/patches.nix new file mode 100644 index 00000000..7b0d0967 --- /dev/null +++ b/microsoft/surface/kernel/linux-6.0.17/patches.nix @@ -0,0 +1,122 @@ +{ kernel, + patchDir, + version, +}: + +[ + { + name = "microsoft-surface-patches-linux-${version}"; + patch = null; + structuredExtraConfig = with kernel; { + # + # 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; + + CONFIG_SURFACE_ACPI_NOTIFY = module; + CONFIG_SURFACE_DTX = module; + CONFIG_SURFACE_PLATFORM_PROFILE = module; + + CONFIG_SURFACE_HID = module; + CONFIG_SURFACE_KBD = module; + + CONFIG_BATTERY_SURFACE = module; + CONFIG_CHARGER_SURFACE = module; + + # + # Surface Hotplug + # + CONFIG_SURFACE_HOTPLUG = module; + + # + # IPTS touchscreen + # + # This only enables the user interface for IPTS data. + # For the touchscreen to work, you need to install iptsd. + # + CONFIG_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; + + # + # Cameras: Sensor drivers + # + CONFIG_VIDEO_OV5693 = module; + CONFIG_VIDEO_OV7251 = module; + CONFIG_VIDEO_OV8865 = module; + + # + # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 + # + CONFIG_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; + }; + } + { + 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"; + } +] From 0ee9d61fa68486b1b9ff8ddaf9f0dd91662e8766 Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 9 Jan 2023 23:44:36 +1300 Subject: [PATCH 2/9] Update the rev. and sha256 of linux-surface repo to match latest "master" --- microsoft/surface/repos.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microsoft/surface/repos.nix b/microsoft/surface/repos.nix index b15dd7ec..eb9e5fa3 100644 --- a/microsoft/surface/repos.nix +++ b/microsoft/surface/repos.nix @@ -4,8 +4,8 @@ linux-surface = fetchFromGitHub { owner = "linux-surface"; repo = "linux-surface"; - rev = "8995c6b3b4fb659397f4ebc760c6ac8b5efc5488"; - sha256 = "sha256-r7nbW0WKmvw7mMZL1BzuFwgwftyN5FIfP5xLDiQMEiI="; + rev = "487e64047ca047dde9a062909a87410e7bb86845"; + sha256 = "sha256-HTIuRBZk0prhUPd2KnsXGo+ZyBsMwERN7P8WJH1RG3M="; }; # This is the owner and repo for the pre-patched kernel from the "linux-surface" project: From 9020a320f5bd3c550a427b3a6c945979a68168bf Mon Sep 17 00:00:00 2001 From: mexisme Date: Mon, 9 Jan 2023 23:45:16 +1300 Subject: [PATCH 3/9] Install kernel 6.0.17 by default --- microsoft/surface/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 2952daed..1c0e6280 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -9,7 +9,7 @@ in { ./firmware/surface-go/ath10k ]; - microsoft-surface.kernelVersion = mkDefault "6.0.11"; + microsoft-surface.kernelVersion = mkDefault "6.0.17"; boot.extraModprobeConfig = mkDefault '' options i915 enable_fbc=1 enable_rc6=1 modeset=1 From 51e3be9885b7d095eb1f7ba8a62ef6771e616e28 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 12:41:58 +1300 Subject: [PATCH 4/9] Remove kernel 6.0.11 from MS Surface profile --- microsoft/surface/kernel/default.nix | 1 - .../surface/kernel/linux-6.0.11/default.nix | 38 ------ .../surface/kernel/linux-6.0.11/patches.nix | 118 ------------------ 3 files changed, 157 deletions(-) delete mode 100644 microsoft/surface/kernel/linux-6.0.11/default.nix delete mode 100644 microsoft/surface/kernel/linux-6.0.11/patches.nix diff --git a/microsoft/surface/kernel/default.nix b/microsoft/surface/kernel/default.nix index 2b19413b..af2a2ba6 100644 --- a/microsoft/surface/kernel/default.nix +++ b/microsoft/surface/kernel/default.nix @@ -6,7 +6,6 @@ let in { imports = [ ./linux-5.19.17 - ./linux-6.0.11 ./linux-6.0.17 ]; diff --git a/microsoft/surface/kernel/linux-6.0.11/default.nix b/microsoft/surface/kernel/linux-6.0.11/default.nix deleted file mode 100644 index 652f2412..00000000 --- a/microsoft/surface/kernel/linux-6.0.11/default.nix +++ /dev/null @@ -1,38 +0,0 @@ -{ 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.0.11"; - extraMeta.branch = "6.0"; - 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-K65hMeZJceHjT/OV+lQpcRNMhXvbCykGmrhHx8mpx2I="; - }; - }; - - -in { - options.microsoft-surface.kernelVersion = mkOption { - type = types.enum [ "6.0.11" ]; - }; - - config = mkIf (cfg.kernelVersion == "6.0.11") { - boot = { - inherit kernelPackages; - }; - }; -} diff --git a/microsoft/surface/kernel/linux-6.0.11/patches.nix b/microsoft/surface/kernel/linux-6.0.11/patches.nix deleted file mode 100644 index e111c268..00000000 --- a/microsoft/surface/kernel/linux-6.0.11/patches.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ kernel, - patchDir, - version, -}: - -[ - { - name = "microsoft-surface-patches-linux-${version}"; - patch = null; - structuredExtraConfig = with kernel; { - # - # 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; - - CONFIG_SURFACE_ACPI_NOTIFY = module; - CONFIG_SURFACE_DTX = module; - CONFIG_SURFACE_PLATFORM_PROFILE = module; - - CONFIG_SURFACE_HID = module; - CONFIG_SURFACE_KBD = module; - - CONFIG_BATTERY_SURFACE = module; - CONFIG_CHARGER_SURFACE = module; - - # - # Surface Hotplug - # - CONFIG_SURFACE_HOTPLUG = module; - - # - # IPTS touchscreen - # - # This only enables the user interface for IPTS data. - # For the touchscreen to work, you need to install iptsd. - # - CONFIG_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; - - # - # Cameras: Sensor drivers - # - CONFIG_VIDEO_OV5693 = module; - CONFIG_VIDEO_OV7251 = module; - CONFIG_VIDEO_OV8865 = module; - - # - # ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7 - # - CONFIG_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; - }; - } - { - 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"; - # } -] From c1580f8d81c63ce2b3396d304f5db6fdaf782582 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 22:03:38 +1300 Subject: [PATCH 5/9] Update warning message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jörg Thalheim --- microsoft/surface/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 63aac11c..0d9a22f8 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -6,7 +6,7 @@ let in { imports = [ ( warn - "Please don't import microsoft/surface/ (default.nix) any longer; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." + "Please do not import microsoft/surface/ (default.nix) directly; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." ./old ) ]; } From 157a74d8a47e46da908e1c1f22d645b2085343c1 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 22:32:40 +1300 Subject: [PATCH 6/9] "old" --> "deprecated" --- README.md | 4 ++-- flake.nix | 2 +- .../surface/{old/README.md => OLD-BEHAVIOUR-DEPRECATION.md} | 6 +++--- microsoft/surface/README.md | 2 +- microsoft/surface/default.nix | 2 +- microsoft/surface/{old => deprecated}/default.nix | 0 6 files changed, 8 insertions(+), 8 deletions(-) rename microsoft/surface/{old/README.md => OLD-BEHAVIOUR-DEPRECATION.md} (91%) rename microsoft/surface/{old => deprecated}/default.nix (100%) diff --git a/README.md b/README.md index b0fa76ea..12360329 100644 --- a/README.md +++ b/README.md @@ -194,8 +194,8 @@ See code for all available configurations. | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Range (Deprecated version)](microsoft/surface) | `` | -| [Microsoft Surface Range (Old Behaviour)](microsoft/surface/old) | `` | +| [Microsoft Surface Range (Deprecated)](microsoft/surface) | `` | +| [Microsoft Surface Range (Deprecated)](microsoft/surface/deprecated)| `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 82d769b3..233aec5f 100644 --- a/flake.nix +++ b/flake.nix @@ -131,7 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; - microsoft-surface-old-behaviour = import ./microsoft/surface/old; + microsoft-surface-deprecated = import ./microsoft/surface/deprecated; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/old/README.md b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md similarity index 91% rename from microsoft/surface/old/README.md rename to microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md index a61fc5f4..1519a832 100644 --- a/microsoft/surface/old/README.md +++ b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md @@ -33,12 +33,12 @@ Tools / services that are shared among several models are now extracted to their `common/` and imported by `common/default.nix`. These new "common" modules now have an `enable` option, which is `false` by default. -### "Old Behaviour" module +### "Deprecated Behaviour" module -The original `./default.nix` module has been replaced by a new `old/` module, which replicates the +The original `./default.nix` module has been replaced by a new `deprecated/` module, which replicates the original behaviour. -The new `./default.nix` will load the new `old/` module, but will also pop-up a warning asking users +The new `./default.nix` will load the new `deprecated/` module, but will also pop-up a warning asking users to update how they use the microsoft/surface profile from now on. This warning will probably change to a fail assertion at some point in the future. diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 57a35bd3..6238eb63 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,6 +1,6 @@ # NOTE: Structure changes from 2023-01-10 -Please read the [Old Behaviour README](./old/README.md) to understand how some structural changes to +Please read the [Deprecated Behaviour README](./deprecated/README.md) to understand how some structural changes to the code might affect you! # Derivatives for Microsoft Surface notebooks diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 0d9a22f8..5ed90462 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -7,6 +7,6 @@ in { imports = [ ( warn "Please do not import microsoft/surface/ (default.nix) directly; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." - ./old ) + ./deprecated ) ]; } diff --git a/microsoft/surface/old/default.nix b/microsoft/surface/deprecated/default.nix similarity index 100% rename from microsoft/surface/old/default.nix rename to microsoft/surface/deprecated/default.nix From f00dee1fdfe2975c5f80dbb79a4e6ff8fee1d3c0 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 23:22:29 +1300 Subject: [PATCH 7/9] Remove the "deprecated" module - It makes more sense to error-out and provide information on how to update. --- README.md | 1 - flake.nix | 1 - microsoft/surface/deprecated/default.nix | 22 ---------------------- 3 files changed, 24 deletions(-) delete mode 100644 microsoft/surface/deprecated/default.nix diff --git a/README.md b/README.md index 12360329..7fc7517e 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,6 @@ See code for all available configurations. | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | | [Microsoft Surface Range (Deprecated)](microsoft/surface) | `` | -| [Microsoft Surface Range (Deprecated)](microsoft/surface/deprecated)| `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 233aec5f..67aeeb48 100644 --- a/flake.nix +++ b/flake.nix @@ -131,7 +131,6 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; - microsoft-surface-deprecated = import ./microsoft/surface/deprecated; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/deprecated/default.nix b/microsoft/surface/deprecated/default.nix deleted file mode 100644 index d8a2d675..00000000 --- a/microsoft/surface/deprecated/default.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ lib, pkgs, ... }: - -let - inherit (lib) mkDefault; - -in { - imports = [ - ../common - ../surface-go/firmware/ath10k - ]; - - boot.extraModprobeConfig = 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 - ''; - - microsoft-surface.surface-control.enable = true; - microsoft-surface.ipts.enable = true; -} From 9d4505d4e11afd3c7037b74d87ace16fb047de06 Mon Sep 17 00:00:00 2001 From: mexisme Date: Tue, 10 Jan 2023 23:05:27 +1300 Subject: [PATCH 8/9] Update README --- README.md | 2 +- flake.nix | 1 + .../surface/OLD-BEHAVIOUR-DEPRECATION.md | 10 ++++ microsoft/surface/README.md | 46 ++++++++++++++----- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 7fc7517e..3306655c 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ See code for all available configurations. | [MSI GS60 2QE](msi/gs60) | `` | | [MSI GL62/CX62](msi/gl62) | `` | | [Microsoft Surface Pro 3](microsoft/surface-pro/3) | `` | -| [Microsoft Surface Range (Deprecated)](microsoft/surface) | `` | +| [Microsoft Surface Range (Common Modules)](microsoft/surface/common)| `` | | [Omen en00015p](omen/en00015p) | `` | | [One-Netbook OneNetbook 4](onenetbook/4) | `` | | [Panasonic Let's Note CF-LX4 ](panasonic/letsnote/cf-lx4) | `` | diff --git a/flake.nix b/flake.nix index 67aeeb48..87acc3e7 100644 --- a/flake.nix +++ b/flake.nix @@ -131,6 +131,7 @@ lenovo-yoga-6-13ALC6 = import ./lenovo/yoga/6/13ALC6; letsnote-cf-lx4 = import ./panasonic/letsnote/cf-lx4; microsoft-surface = import ./microsoft/surface; + microsoft-surface-common = import ./microsoft/surface/common; microsoft-surface-pro-3 = import ./microsoft/surface-pro/3; msi-gs60 = import ./msi/gs60; msi-gl62 = import ./msi/gl62; diff --git a/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md index 1519a832..e93a81d8 100644 --- a/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md +++ b/microsoft/surface/OLD-BEHAVIOUR-DEPRECATION.md @@ -11,6 +11,16 @@ models, and they would fail gracefully enough that we could mostly ignore warnin Now, however --- as-of 2023-01-10 --- we have a much wider variety of chipsets, incl. models with some of the newer AMD CPUs, and this is breaking small things in annoying ways for more people. +## How to update + +By preference, there will already be a specialised module for your model's configuration. + +If not, the `microsoft/surface/common/` module can also be imported directly, and the options +provided can be used in your own system's configuration. + +Alternatively, you can create a new specialisation for your model under `microsoft/surface` +configured for that model. + ## Changes ### Model Specialisations diff --git a/microsoft/surface/README.md b/microsoft/surface/README.md index 6238eb63..6b16cdf8 100644 --- a/microsoft/surface/README.md +++ b/microsoft/surface/README.md @@ -1,13 +1,28 @@ # NOTE: Structure changes from 2023-01-10 -Please read the [Deprecated Behaviour README](./deprecated/README.md) to understand how some structural changes to +Please read the [Deprecated Behaviour README](./OLD-BEHAVIOUR-DEPRECATED.md) to understand how some structural changes to the code might affect you! -# Derivatives for Microsoft Surface notebooks +# Derivations 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 +## Importing + +By preference, there will already be a specialised module for your model's configuration. + +If not, the `microsoft/surface/common/` module can also be imported directly, and the options +provided can be used in your own system's configuration. + +Alternatively, you can create a new specialisation for your model under `microsoft/surface` +configured for that model. + +## Common Modules + +Most shared / common modules are under the [`common/`](./common/) directory. +This includes the patched kernel build modules, as well as tools and service like `IPTSd` and `surface-control`. + +### 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. @@ -16,21 +31,19 @@ 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. +The kernel-specific derivations are under the [`common/kernel/`](./common/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. +### Support Tools ### IPTS +Enable this with the `microsoft-surface.ipts.enable = true;` config option. + 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 @@ -49,10 +62,21 @@ kernel-space driver into events for the HID / input sub-system. #### surface-control +Enable this with the `config.microsoft-surface.surface-control.enable = true;` config option. + For controlling the performance modes and other aspects of the device, the [`surface-control`](https://github.com/linux-surface/surface-control) tool is included. To be able to control the performance mode without using `sudo`, add your user to the `surface-control` group. +## Firmware and Drivers + +### WiFi on Surface Go + +For the Surface Go, please see the "Issues" sections below. + +Including the [`microsoft/surface/surface-go/firmware/ath-10k/`](./surface-go/firmware/ath-10k/) +module will replace the default firmware with the updated firmware. + # ToDo's Not Done See: [TODO.org](./TODO.org) @@ -73,8 +97,8 @@ 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`. +The derivative in `surface-go/firmware/ath10k/` can configure this, with the +`config.hardware.microsoft-surface.firmware.surface-go-ath10k.replace = true` config option. _*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. From ee8fef414961d3d04250a03cb5a071882f286f44 Mon Sep 17 00:00:00 2001 From: mexisme Date: Wed, 11 Jan 2023 00:01:21 +1300 Subject: [PATCH 9/9] Use the module assertions option, instead - Assertion (failure) when trying to use microsoft/surface/default.nix --- microsoft/surface/default.nix | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/microsoft/surface/default.nix b/microsoft/surface/default.nix index 5ed90462..395e05de 100644 --- a/microsoft/surface/default.nix +++ b/microsoft/surface/default.nix @@ -1,12 +1,10 @@ -{ lib, ... }: +{ ... }: -let - inherit (lib) warn; - -in { - imports = [ - ( warn - "Please do not import microsoft/surface/ (default.nix) directly; use microsoft/surface/old or see microsoft/surface/old/README.md for more details." - ./deprecated ) +{ + assertions = [ + { + assertion = false; + message = "Importing microsoft/surface/ (default.nix) directly is deprecated! See microsoft/surface/OLD-BEHAVIOUR-DEPRECATED.md for more details."; + } ]; }