Compare commits

..

No commits in common. "dd5ec42dd9bc510022a7d5ff9855d88ffdb3736f" and "18aa1fc67e7fb4529164032c9b8f521e68e03569" have entirely different histories.

11 changed files with 64 additions and 347 deletions

View File

@ -11,7 +11,6 @@
pkgs.linux-firmware (pkgs.callPackage ./pkgs/t14s-firmware.nix { }) pkgs.linux-firmware (pkgs.callPackage ./pkgs/t14s-firmware.nix { })
]; ];
boot.loader.efi.canTouchEfiVariables = false;
boot.loader.systemd-boot = { boot.loader.systemd-boot = {
enable = true; enable = true;
extraFiles = { extraFiles = {
@ -49,38 +48,6 @@
services.getty.autologinUser = lib.mkDefault "root"; services.getty.autologinUser = lib.mkDefault "root";
nixpkgs.overlays = [
(final: prev: {
qrtr = prev.callPackage ./pkgs/qrtr.nix {};
qmic = prev.callPackage ./pkgs/qmic.nix {};
rmtfs = prev.callPackage ./pkgs/rmtfs.nix { inherit (final) qrtr qmic; };
pd-mapper = final.callPackage ./pkgs/pd-mapper.nix { inherit (final) qrtr; };
})
];
systemd.services = {
pd-mapper = {
unitConfig = {
Requires = "qrtr-ns.service";
After = "qrtr-ns.service";
};
serviceConfig = {
Restart = "always";
ExecStart = "${pkgs.pd-mapper}/bin/pd-mapper";
};
wantedBy = [
"multi-user.target"
];
};
qrtr-ns = {
serviceConfig = {
ExecStart = "${pkgs.qrtr}/bin/qrtr-ns -v -f 1";
Restart = "always";
};
wantedBy = ["multi-user.target"];
};
};
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
nix.settings = { nix.settings = {

View File

@ -1,102 +1,71 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
inherit (config.boot.loader) efi;
linux_x1e_pkg = { buildLinux, ... } @ args: linux_x1e_pkg = { buildLinux, ... } @ args:
buildLinux (args // rec { buildLinux (args // rec {
version = "6.12.0"; version = "6.10.0";
modDirVersion = "6.12.0-rc3"; modDirVersion = "6.10.0-next-20240725";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitLab {
owner = "jhovold"; domain = "git.codelinaro.org";
owner = "abel.vesa";
repo = "linux"; repo = "linux";
# wip/x1e80100-6.12-rc3 rev = "x1e80100-20240725"; # "x1e80100-next";
rev = "84318c8e3038f579070e7c5d109d1d2311a5f437"; hash = "sha256-0DFmPJEFl+cQT3Li4vuptBwavRc9CQOatd8TIYht+54=";
hash = "sha256-kpuzjqcI4YGS+S9OvIUhm6z8xCGMA5h5+JlcHhoEETM=";
}; };
kernelPatches = (args.kernelPatches or [ ]); kernelPatches = (args.kernelPatches or [ ]);
extraMeta.branch = "6.12"; extraMeta.branch = "6.10";
} // (args.argsOverride or { })); } // (args.argsOverride or { }));
linux_x1e = pkgs.callPackage linux_x1e_pkg { linux_x1e = pkgs.callPackage linux_x1e_pkg { defconfig = "x1e_defconfig"; };
defconfig = "johan_defconfig";
};
linuxPackages_x1e = pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_x1e); linuxPackages_x1e = pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_x1e);
dtb = "${linuxPackages_x1e.kernel}/dtbs/qcom/x1e78100-lenovo-thinkpad-t14s.dtb";
dtbHash = builtins.hashFile "md5" dtb;
dtbName = "x1e78100-${dtbHash}.dtb";
in { in {
hardware = {
deviceTree = {
enable = true;
name = "qcom/x1e78100-lenovo-thinkpad-t14s.dtb";
};
};
boot = { boot = {
kernelPackages = linuxPackages_x1e; 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 = [ kernelParams = [
"dtb=${dtbName}"
#"initcall_debug"
#"earlycon=efifb"
"console=tty0"
#"ignore_loglevel"
#"keep_bootcon"
"regulator_ignore_unused" "regulator_ignore_unused"
"clk_ignore_unused" "clk_ignore_unused"
"pd_ignore_unused" "pd_ignore_unused"
"arm64.nopauth" "arm64.nopauth"
#"acpi=no"
"efi=novamap" "efi=novamap"
#"efi=noruntime"
"pcie_aspm.policy=powersupersave" "pcie_aspm.policy=powersupersave"
"iommu.strict=0" "iommu.strict=0"
"iommu.passthrough=0" "iommu.passthrough=0"
#"earlyprintk=xdbc"
#"usbcore.autosuspend=-1"
"module_blacklist=edac_core,qcom_q6v5_pas"
]; ];
supportedFilesystems.zfs = false; supportedFilesystems.zfs = false;
initrd = { initrd = {
systemd = {
enable = true;
tpm2.enable = false;
};
includeDefaultModules = false; includeDefaultModules = false;
availableKernelModules = [ availableKernelModules = [
"nvme" "nvme"
"uas" "uas"
"usb-storage" "usb-storage"
"pcie-qcom"
"gpio-sbu-mux" "gpio-sbu-mux"
"leds-qcom-lpg" "leds-qcom-lpg"
@ -127,6 +96,36 @@ in {
# fat32 # fat32
"vfat" "nls-cp437" "nls-iso8859-1" "vfat" "nls-cp437" "nls-iso8859-1"
]; ];
systemd = {
enable = true;
enableTpm2 = false;
}; };
}; };
loader = {
systemd-boot.enable = lib.mkForce true;
efi.canTouchEfiVariables = false;
systemd-boot.extraFiles = {
"${dtbName}" = dtb;
};
};
};
system.activationScripts.t14s-gen6-dtb = ''
in_package="${dtb}"
esp_tool_folder="${efi.efiSysMountPoint}/"
in_esp="''${esp_tool_folder}${dtbName}"
in_esp_backup="''${esp_tool_folder}/dtb/${dtbName}"
in_esp_backup_dir="''${esp_tool_folder}/dtb/"
mkdir -p "$in_esp_backup_dir"
cp "$in_package" "$in_esp_backup"
>&2 echo "Ensuring $in_esp in EFI System Partition"
if ! ${pkgs.diffutils}/bin/cmp --silent "$in_package" "$in_esp"; then
>&2 echo "Copying $in_package -> $in_esp"
mkdir -p "$esp_tool_folder"
cp "$in_package" "$in_esp"
sync
fi
'';
} }

View File

@ -1,51 +0,0 @@
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";
};

View File

@ -1,48 +0,0 @@
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

@ -1,27 +0,0 @@
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

@ -1,33 +0,0 @@
{
stdenv,
lib,
fetchFromGitHub,
pkg-config,
qrtr,
lzma,
}:
stdenv.mkDerivation {
pname = "pd-mapper";
version = "2024-06-19";
src = fetchFromGitHub {
owner = "linux-msm";
repo = "pd-mapper";
rev = "e7c42e1522249593302a5b8920b9e7b42dc3f25e";
sha256 = "sha256-gTUpltbY5439IEEvnxnt8WOFUgfpQUJWr5f+OB12W8A=";
};
nativeBuildInputs = [ pkg-config lzma ];
buildInputs = [ qrtr ];
installFlags = [ "prefix=$(out)" ];
meta = with lib; {
description = "pd mapper";
homepage = "https://github.com/linux-msm/pd-mapper";
license = licenses.bsd3;
platforms = platforms.linux;
};
}

View File

@ -1,26 +0,0 @@
{
stdenv,
lib,
fetchFromGitHub
}:
stdenv.mkDerivation {
pname = "qmic";
version = "2022-07-18";
src = fetchFromGitHub {
owner = "linux-msm";
repo = "qmic";
rev = "4574736afce75aa5eec1e1069a19563410167c9f";
sha256 = "sha256-0/mIg98pN66ZaVsQ6KmZINuNfiKvdEHMsqDx0iciF8w=";
};
installFlags = [ "prefix=$(out)" ];
meta = with lib; {
description = "QMI IDL compiler";
homepage = "https://github.com/linux-msm/qmic";
license = licenses.bsd3;
platforms = platforms.aarch64;
};
}

View File

@ -1,33 +0,0 @@
{
stdenv,
lib,
fetchFromGitHub,
meson,
cmake,
pkg-config,
systemd,
ninja,
}:
stdenv.mkDerivation {
pname = "qrtr";
version = "2024-05-21";
src = fetchFromGitHub {
owner = "linux-msm";
repo = "qrtr";
rev = "daf7f4cc326a5036dcce2bd7deaf2c32841b0336";
hash = "sha256-OGx5fxxtrNN9EJJxxH4MTDRFGsyu4LNo+ks46zbJqF0=";
};
nativeBuildInputs = [ meson cmake pkg-config systemd ninja ];
installFlags = [ "prefix=$(out)" ];
meta = with lib; {
description = "QMI IDL compiler";
homepage = "https://github.com/linux-msm/qrtr";
license = licenses.bsd3;
platforms = platforms.aarch64;
};
}

View File

@ -1,31 +0,0 @@
{
lib,
stdenv,
fetchFromGitHub,
udev,
qrtr,
qmic
}:
stdenv.mkDerivation {
pname = "rmtfs";
version = "2024-03-18";
buildInputs = [ udev qrtr qmic ];
src = fetchFromGitHub {
owner = "linux-msm";
repo = "rmtfs";
rev = "33e1e40615efc59b17a515afe857c51b8b8c1ad1";
hash = "sha256-AxFuDmfLTcnnwm+nezwLc8yaHcX+pFkX5qSIO38T/BM=";
};
installFlags = [ "prefix=$(out)" ];
meta = with lib; {
description = "Qualcomm Remote Filesystem Service";
homepage = "https://github.com/linux-msm/rmtfs";
license = licenses.bsd3;
platforms = platforms.aarch64;
};
}

View File

@ -7,13 +7,13 @@
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
pname = "linux-firmware"; pname = "linux-firmware";
version = "20241003"; version = "20240726";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "jollheef"; owner = "jollheef";
repo = "linux-firmware-x1e78100-lenovo-thinkpad-t14s"; repo = "linux-firmware-x1e78100-lenovo-thinkpad-t14s";
rev = "e3ba8bb550b023b9f8501360f1d85d74d3de96b4"; rev = "4ba0b781ffc27cb48736942822192b548a316838";
hash = "sha256-REkQpg+27to11VoDfAksvqzi5M7MDjAcAvR7P8cnRk0="; hash = "sha256-ZeV6JRxU1gMwtWZH8sePCrZXFa27GxoKpLK4sg3Ljyo=";
}; };
installPhase = '' installPhase = ''

View File

@ -23,7 +23,7 @@ mkdir /mnt/boot
mount ${drive}p1 /mnt/boot mount ${drive}p1 /mnt/boot
mkdir -p /mnt/etc/nixos mkdir -p /mnt/etc/nixos
cp -r patches pkgs *.nix /mnt/etc/nixos/ cp -r pkgs *.nix /mnt/etc/nixos/
nixos-install --root /mnt --no-root-password nixos-install --root /mnt --no-root-password
umount -R /mnt umount -R /mnt