feat: update kernel, add patches for backlight, etc.

This commit is contained in:
dump_stack() 2024-10-18 15:33:55 +00:00
parent c79f9f40c3
commit 3c12210398
Signed by: dump_stack
GPG Key ID: C9905BA72B5E02BB
5 changed files with 182 additions and 34 deletions

View File

@ -1,26 +1,27 @@
{ config, lib, pkgs, ... }:
let
inherit (config.boot.loader) efi;
linux_x1e_pkg = { buildLinux, ... } @ args:
buildLinux (args // rec {
version = "6.10.0";
modDirVersion = "6.10.0-next-20240725";
version = "6.12.0";
modDirVersion = "6.12.0-rc3";
src = pkgs.fetchFromGitLab {
domain = "git.codelinaro.org";
owner = "abel.vesa";
src = pkgs.fetchFromGitHub {
owner = "jhovold";
repo = "linux";
rev = "x1e80100-20240725"; # "x1e80100-next";
hash = "sha256-0DFmPJEFl+cQT3Li4vuptBwavRc9CQOatd8TIYht+54=";
# wip/x1e80100-6.12-rc3
rev = "84318c8e3038f579070e7c5d109d1d2311a5f437";
hash = "sha256-kpuzjqcI4YGS+S9OvIUhm6z8xCGMA5h5+JlcHhoEETM=";
};
kernelPatches = (args.kernelPatches or [ ]);
extraMeta.branch = "6.10";
extraMeta.branch = "6.12";
} // (args.argsOverride or { }));
linux_x1e = pkgs.callPackage linux_x1e_pkg { defconfig = "x1e_defconfig"; };
linux_x1e = pkgs.callPackage linux_x1e_pkg {
defconfig = "johan_defconfig";
};
linuxPackages_x1e = pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_x1e);
in {
@ -34,42 +35,68 @@ in {
boot = {
kernelPackages = linuxPackages_x1e;
kernelPatches = [
{
name = "backlight";
patch = ./patches/backlight.patch;
}
{
name = "bluetooth";
patch = ./patches/bluetooth.patch;
}
{
name = "disable-type-c-dp";
patch = ./patches/disable-type-c-dp.patch;
}
{
name = "vmlinuz.efi";
patch = null;
extraStructuredConfig = with lib.kernel; {
EFI_ZBOOT = lib.mkForce no;
};
}
{
name = "disable-qr-code-panic-screen";
patch = null;
extraStructuredConfig = with lib.kernel; {
DRM_PANIC_SCREEN_QR_CODE = lib.mkForce no;
};
}
{
name = "disable-rust";
patch = null;
extraStructuredConfig = with lib.kernel; {
RUST = lib.mkForce no;
};
}
];
kernelParams = [
"dtb=${dtbName}"
#"initcall_debug"
#"earlycon=efifb"
"console=tty0"
#"ignore_loglevel"
#"keep_bootcon"
"regulator_ignore_unused"
"clk_ignore_unused"
"pd_ignore_unused"
"arm64.nopauth"
#"acpi=no"
"efi=novamap"
#"efi=noruntime"
"pcie_aspm.policy=powersupersave"
"iommu.strict=0"
"iommu.passthrough=0"
#"earlyprintk=xdbc"
#"usbcore.autosuspend=-1"
"module_blacklist=edac_core,qcom_q6v5_pas"
];
supportedFilesystems.zfs = false;
initrd = {
systemd = {
enable = true;
tpm2.enable = false;
};
includeDefaultModules = false;
availableKernelModules = [
"nvme"
"uas"
"usb-storage"
"pcie-qcom"
"gpio-sbu-mux"
"leds-qcom-lpg"
@ -100,11 +127,6 @@ in {
# fat32
"vfat" "nls-cp437" "nls-iso8859-1"
];
systemd = {
enable = true;
enableTpm2 = false;
};
};
};
}

51
patches/backlight.patch Normal file
View File

@ -0,0 +1,51 @@
diff --git a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
index 04d6983ca8f3..0d42b275fd66 100644
--- a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
+++ b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
@@ -19,6 +19,14 @@ / {
compatible = "lenovo,thinkpad-t14s", "qcom,x1e78100", "qcom,x1e80100";
chassis-type = "laptop";
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ pwms = <&pmk8550_pwm 0 5000000>;
+ enable-gpios = <&pmc8380_3_gpios 4 GPIO_ACTIVE_HIGH>;
+ pinctrl-0 = <&edp_bl_en>, <&edp_bl_pwm>;
+ pinctrl-names = "default";
+ };
+
gpio-keys {
compatible = "gpio-keys";
@@ -744,12 +752,9 @@ &mdss_dp3 {
aux-bus {
panel {
compatible = "edp-panel";
- enable-gpios = <&pmc8380_3_gpios 4 GPIO_ACTIVE_HIGH>;
+ backlight = <&backlight>;
power-supply = <&vreg_edp_3p3>;
- pinctrl-0 = <&edp_bl_en>;
- pinctrl-names = "default";
-
port {
edp_panel_in: endpoint {
remote-endpoint = <&mdss_dp3_out>;
@@ -849,6 +854,17 @@ rtmr0_1p15_reg_en: rtmr0-1p15-reg-en-state {
};
};
+&pmk8550_pwm {
+ status = "okay";
+};
+
+&pmk8550_gpios {
+ edp_bl_pwm: edp-bl-pwm-state {
+ pins = "gpio5";
+ function = "func3";
+ };
+};
+
&qupv3_0 {
status = "okay";
};

48
patches/bluetooth.patch Normal file
View File

@ -0,0 +1,48 @@
diff --git a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
index 04d6983ca8f3..0bb3ca93cfaa 100644
--- a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
+++ b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
@@ -19,6 +19,11 @@ / {
compatible = "lenovo,thinkpad-t14s", "qcom,x1e78100", "qcom,x1e80100";
chassis-type = "laptop";
+ aliases {
+ serial0 = &uart21;
+ serial1 = &uart14;
+ };
+
gpio-keys {
compatible = "gpio-keys";
@@ -1013,6 +1018,31 @@ wcd_default: wcd-reset-n-active-state {
bias-disable;
output-low;
};
+
+ bt_en_default: bt-en-sleep {
+ pins = "gpio116";
+ function = "gpio";
+ output-low;
+ bias-disable;
+ qcom,drive-strength = <16>;
+ };
+};
+
+&uart14 {
+ status = "okay";
+
+ bluetooth: bt_wcn7850 {
+ compatible = "qcom,wcn7850-bt";
+ pinctrl-names = "default";
+ pinctrl-0 = <&bt_en_default>;
+ enable-gpios = <&tlmm 116 GPIO_ACTIVE_HIGH>;
+ max-speed = <3200000>;
+ };
+};
+
+&uart21 {
+ compatible = "qcom,geni-debug-uart";
+ status = "okay";
};
&usb_1_ss0_hsphy {

View File

@ -0,0 +1,27 @@
diff --git a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
index 04d6983ca8f3..998cb8920dbc 100644
--- a/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
+++ b/arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts
@@ -719,22 +719,6 @@ &mdss {
status = "okay";
};
-&mdss_dp0 {
- status = "okay";
-};
-
-&mdss_dp0_out {
- data-lanes = <0 1 2 3>;
-};
-
-&mdss_dp1 {
- status = "okay";
-};
-
-&mdss_dp1_out {
- data-lanes = <0 1 2 3>;
-};
-
&mdss_dp3 {
compatible = "qcom,x1e80100-dp";
/delete-property/ #sound-dai-cells;

View File

@ -5,7 +5,7 @@ efi_part_label=i_t14sg6_efi
nix_part_label=i_t14sg6_nix
boot_size=256M
fallocate -l4G ${file}
fallocate -l14G ${file}
parted ${file} mklabel gpt
parted ${file} mkpart ${efi_part_label} fat32 0% ${boot_size}
@ -23,7 +23,7 @@ mkdir /mnt/boot
mount ${drive}p1 /mnt/boot
mkdir -p /mnt/etc/nixos
cp -r pkgs *.nix /mnt/etc/nixos/
cp -r patches pkgs *.nix /mnt/etc/nixos/
nixos-install --root /mnt --no-root-password
umount -R /mnt