2021-09-04 18:16:58 +00:00
|
|
|
{ pkgs, ... }:
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
let
|
2021-09-04 18:16:58 +00:00
|
|
|
fetchpatch = pkgs.fetchpatch;
|
2021-09-03 13:17:43 +00:00
|
|
|
commit = "f69eefacf7304857f8c0ce7ac0ebf4971121da72";
|
|
|
|
mkPatch = name: sha256: {
|
|
|
|
name = name;
|
|
|
|
patch = fetchpatch {
|
|
|
|
name = name + ".patch";
|
|
|
|
url = "https://raw.githubusercontent.com/linux-surface/linux-surface/${commit}/patches/5.13/${name}.patch";
|
|
|
|
sha256 = sha256;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in {
|
2021-09-04 18:16:58 +00:00
|
|
|
environment.etc."ipts.conf".text = ''
|
2021-09-03 13:17:43 +00:00
|
|
|
[Config]
|
|
|
|
BlockOnPalm = true
|
|
|
|
'';
|
2021-09-05 11:26:29 +00:00
|
|
|
|
|
|
|
powerManagement = {
|
|
|
|
enable = true;
|
|
|
|
cpuFreqGovernor = "powersave";
|
|
|
|
};
|
|
|
|
hardware.video.hidpi.enable = true;
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
systemd.services.iptsd = {
|
|
|
|
description = "Userspace daemon for Intel Precise Touch & Stylus";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
wants = [ "dev-ipts-15.device" ];
|
|
|
|
after = [ "dev-ipts-15.device" ];
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "simple";
|
2021-09-04 18:16:58 +00:00
|
|
|
ExecStart = "${pkgs.iptsd}/bin/iptsd";
|
2021-09-03 13:17:43 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [ iptsd surface-control ];
|
|
|
|
services.udev.packages = with pkgs; [ iptsd surface-control ];
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
kernelPackages = pkgs.linuxPackages_5_13;
|
|
|
|
kernelPatches = [
|
2021-09-04 18:16:58 +00:00
|
|
|
(mkPatch "0001-surface3-oemb" "1h5f4qgrv74x8q02f29xfia9imcm6svh5gv5vb5izxx6w5i6c9fh")
|
|
|
|
#(mkPatch "0002-mwifiex" "1qn5lqhbg67j1226msiijq42zdjwmvxzyfd5q366hlczcsw7a7r2")
|
|
|
|
(mkPatch "0003-ath10k" "0zwyb1vksh6sjbwy5fp2c108m6fqzrv78cz3a296cff550ldn0fj")
|
|
|
|
(mkPatch "0004-ipts" "0ap5li17zyvba1zx4ryyyk42m00rg5ympj2n24g5ylrld0n2xc3x")
|
|
|
|
(mkPatch "0005-surface-sam-over-hid" "1vm4v84zbyiiqwby3cr7n8ffibx072rb7rhrl5hv37dsdr03gsa3")
|
|
|
|
(mkPatch "0006-surface-sam" "1fi0w9bnfnwllmypk3llc58dmfsvx34772g8c52dgi4h9wsgnbhj")
|
|
|
|
(mkPatch "0007-surface-hotplug" "0g3fkc12pc15aqq6nqk1zfp99lj1wj7cgc1n9691bp8fhqx5aj28")
|
|
|
|
(mkPatch "0008-surface-typecover" "0803nd0w5rv17kwk3y577pm22zwzpcb52ddlkanm7jrbsrhk130f")
|
|
|
|
#(mkPatch "0009-cameras" "1i5c16bx8drzagv5nkvmsyixvsz3w75lblabsmgxlh1znxsh7cj5")
|
|
|
|
(mkPatch "0010-amd-gpio" "0qibdak0ivsch0r5kxd5hhmvw7rd75xy9mmxjbcmysv8q2y9m6hn") # TODO: Maybe drop
|
|
|
|
(mkPatch "0011-amd-s0ix" "0awv32wqwkjsxs1bhg82rqq3c4ni2f9vsdm7iscilbad28ngdab8") # TODO: Maybe drop
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
name = "surface-config";
|
|
|
|
patch = null;
|
|
|
|
# Options from https://github.com/linux-surface/linux-surface/blob/master/configs/surface-5.13.config
|
|
|
|
extraConfig = ''
|
|
|
|
#
|
|
|
|
# Surface Aggregator Module
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
SURFACE_AGGREGATOR m
|
|
|
|
SURFACE_AGGREGATOR_ERROR_INJECTION n
|
|
|
|
SURFACE_AGGREGATOR_BUS y
|
|
|
|
SURFACE_AGGREGATOR_CDEV m
|
|
|
|
SURFACE_AGGREGATOR_REGISTRY m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
2021-09-04 18:16:58 +00:00
|
|
|
SURFACE_ACPI_NOTIFY m
|
|
|
|
SURFACE_DTX m
|
|
|
|
SURFACE_PLATFORM_PROFILE m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
2021-09-04 18:16:58 +00:00
|
|
|
SURFACE_HID m
|
|
|
|
SURFACE_KBD m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
2021-09-04 18:16:58 +00:00
|
|
|
BATTERY_SURFACE m
|
|
|
|
CHARGER_SURFACE m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Surface Hotplug
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
SURFACE_HOTPLUG m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# IPTS touchscreen
|
|
|
|
#
|
|
|
|
# This only enables the user interface for IPTS data.
|
|
|
|
# For the touchscreen to work, you need to install iptsd.
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
MISC_IPTS m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Cameras: IPU3
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
#VIDEO_IPU3_IMGU m
|
|
|
|
VIDEO_IPU3_CIO2 m
|
|
|
|
CIO2_BRIDGE y
|
|
|
|
#INTEL_SKL_INT3472 m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Cameras: Sensor drivers
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
#VIDEO_OV5693 m
|
|
|
|
VIDEO_OV8865 m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# ALS Sensor for Surface Book 3, Surface Laptop 3, Surface Pro 7
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
APDS9960 m
|
2021-09-03 13:17:43 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Other Drivers
|
|
|
|
#
|
2021-09-04 18:16:58 +00:00
|
|
|
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
|
2021-09-04 22:27:42 +00:00
|
|
|
|
2021-09-06 16:20:13 +00:00
|
|
|
#
|
|
|
|
# Other
|
|
|
|
#
|
|
|
|
# Prevent a non-fatal "kernel oops" at boot crashing udev
|
|
|
|
# (https://github.com/linux-surface/linux-surface/issues/61#issuecomment-579298172)
|
|
|
|
PINCTRL_INTEL y
|
|
|
|
PINCTRL_SUNRISEPOINT y
|
2021-09-06 19:12:37 +00:00
|
|
|
# Required for reading battery data
|
2021-09-06 16:20:13 +00:00
|
|
|
# (https://github.com/linux-surface/surface-aggregator-module/wiki/Testing-and-Installing)
|
|
|
|
SERIAL_DEV_BUS y
|
|
|
|
SERIAL_DEV_CTRL_TTYPORT y
|
|
|
|
MFD_INTEL_LPSS_PCI y
|
|
|
|
INTEL_IDMA64 y
|
2021-09-03 13:17:43 +00:00
|
|
|
'';
|
|
|
|
}
|
2021-09-04 18:16:58 +00:00
|
|
|
];
|
2021-09-03 13:17:43 +00:00
|
|
|
};
|
|
|
|
}
|