x13s: fiddle with modules because of screen blanking issues
This commit is contained in:
parent
03c6157ab5
commit
36e3f37245
3 changed files with 118 additions and 78 deletions
|
@ -45,6 +45,13 @@
|
|||
}
|
||||
];
|
||||
|
||||
hardware.thinkpad-x13s = {
|
||||
enable = true;
|
||||
|
||||
# TODO: use hardware address
|
||||
bluetoothMac = "65:9e:7a:8b:86:28";
|
||||
};
|
||||
|
||||
networking = {
|
||||
hostName = nodeName;
|
||||
|
||||
|
@ -59,8 +66,12 @@
|
|||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.sshfs
|
||||
pkgs.util-linux
|
||||
pkgs.coreutils
|
||||
pkgs.vim
|
||||
|
||||
pkgs.git
|
||||
pkgs.git-crypt
|
||||
];
|
||||
}
|
||||
|
|
14
nix/os/devices/steveej-x13s-rmvbl/flake.lock
generated
14
nix/os/devices/steveej-x13s-rmvbl/flake.lock
generated
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"nodes": {
|
||||
"acamcstephens_stop-export": {
|
||||
"adamcstephens_stop-export": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1705858695,
|
||||
"narHash": "sha256-iTIwMsw/cjacCkSzzCwb+nEkpOK/PoPenPHOysWCBSk=",
|
||||
"lastModified": 1705876512,
|
||||
"narHash": "sha256-nvBqLyi8dMQf3xnROwEcUv4iqV55Mr8S8OGYepu14i4=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "8b61e53b83caf55bd374f4ce2b20f1e8012ce2ec",
|
||||
"revCount": 13,
|
||||
"rev": "388684db5b529bbd6f3e948cf175df089eb09766",
|
||||
"revCount": 14,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/adamcstephens/stop-export.git"
|
||||
},
|
||||
|
@ -28,8 +28,8 @@
|
|||
},
|
||||
"original": {
|
||||
"owner": "alsa-project",
|
||||
"ref": "master",
|
||||
"repo": "alsa-ucm-conf",
|
||||
"rev": "e87dde51d68950537f92af955ad0633437cc419a",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -135,7 +135,7 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"acamcstephens_stop-export": "acamcstephens_stop-export",
|
||||
"adamcstephens_stop-export": "adamcstephens_stop-export",
|
||||
"alsa-ucm-conf": "alsa-ucm-conf",
|
||||
"brainwart_x13s-nixos": "brainwart_x13s-nixos",
|
||||
"disko": "disko",
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
acamcstephens_stop-export = {
|
||||
adamcstephens_stop-export = {
|
||||
flake = false;
|
||||
url = "git+https://codeberg.org/adamcstephens/stop-export.git";
|
||||
};
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
alsa-ucm-conf = {
|
||||
flake = false;
|
||||
url = "github:alsa-project/alsa-ucm-conf/e87dde51d68950537f92af955ad0633437cc419a";
|
||||
url = "github:alsa-project/alsa-ucm-conf/master";
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -90,8 +90,24 @@
|
|||
let
|
||||
# TODO: introduce options for these
|
||||
kernelPdMapper = true;
|
||||
cfg = config.hardware.thinkpad-x13s;
|
||||
in
|
||||
{
|
||||
options.hardware.thinkpad-x13s = {
|
||||
# TODO: respect this
|
||||
enable = lib.mkEnableOption "x13s hardware support";
|
||||
|
||||
bluetoothMac = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "mac address to set on boot";
|
||||
};
|
||||
|
||||
bluetoothMacAddr = lib.mkOption {
|
||||
default = "00:00:00:00:00";
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
||||
};
|
||||
config =
|
||||
let
|
||||
inherit (config.boot.loader) efi;
|
||||
|
@ -117,13 +133,18 @@
|
|||
QCOM_TSENS = lib.mkForce yes;
|
||||
NVMEM_QCOM_QFPROM = lib.mkForce yes;
|
||||
ARM_QCOM_CPUFREQ_NVMEM = lib.mkForce yes;
|
||||
} // lib.optionalAttrs kernelPdMapper {
|
||||
QCOM_PD_MAPPER = lib.mkForce yes;
|
||||
QRTR = lib.mkForce yes;
|
||||
VIRTIO_PCI = lib.mkForce module;
|
||||
# forthcoming kernel work: QCOM_PD_MAPPER = lib.mkForce module;
|
||||
};
|
||||
}
|
||||
];
|
||||
|
||||
qrtr = pkgs.callPackage "${self.inputs.adamcstephens_stop-export}/hardware/x13s/qrtr/qrtr.nix" { };
|
||||
pd-mapper = pkgs.callPackage "${self.inputs.adamcstephens_stop-export}/hardware/x13s/qrtr/pd-mapper.nix" {
|
||||
inherit qrtr;
|
||||
};
|
||||
|
||||
|
||||
# We can't quite move to mainline linux
|
||||
linux_x13s_pkg = { buildLinux, ... } @ args:
|
||||
buildLinux (args // rec {
|
||||
|
@ -142,48 +163,43 @@
|
|||
};
|
||||
|
||||
linuxPackages_x13s = pkgs.linuxPackagesFor linux_x13s;
|
||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/sc8280xp-lenovo-thinkpad-x13s.dtb";
|
||||
dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
|
||||
dtb = "${linuxPackages_x13s.kernel}/dtbs/qcom/${dtbName}";
|
||||
|
||||
dtbName = "x13s63rc4.dtb";
|
||||
|
||||
x13_firmware = { stdenvNoCC, fetchFromGitHub }:
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "x13s-extra-firmware";
|
||||
version = "1.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ironrobin";
|
||||
repo = "x13s-alarm";
|
||||
rev = "efa51c3b519f75b3983aef67855b1561d9828771";
|
||||
sha256 = "sha256-weETbWXz9aL2pDQDKk7fkb1ecQH0qrhUYDs2E5EiJcI=";
|
||||
};
|
||||
|
||||
dontFixup = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX
|
||||
cp x13s-firmware/qcvss8280.mbn $out/lib/firmware/qcom/sc8280xp/LENOVO/21BX/
|
||||
'';
|
||||
};
|
||||
x13s_alsa-ucm-conf = pkgs.alsa-ucm-conf.overrideAttrs (prev: {
|
||||
src = self.inputs.alsa-ucm-conf;
|
||||
});
|
||||
alsa-ucm-conf-env.ALSA_CONFIG_UCM2 = "${x13s_alsa-ucm-conf}/share/alsa/ucm2";
|
||||
|
||||
in
|
||||
{
|
||||
nixpkgs.overlays = [
|
||||
(final: prev:
|
||||
{
|
||||
qrtr = final.callPackage "${self.inputs.acamcstephens_stop-export}/hardware/x13s/qrtr/qrtr.nix" { };
|
||||
pd-mapper = final.callPackage "${self.inputs.acamcstephens_stop-export}/hardware/x13s/qrtr/pd-mapper.nix" {
|
||||
inherit (final) qrtr;
|
||||
};
|
||||
x13s_extra-firmware = pkgs.callPackage
|
||||
"${self.inputs.adamcstephens_stop-export}/hardware/x13s/extra-firmware.nix"
|
||||
{ };
|
||||
|
||||
x13s_alsa-ucm-conf = prev.alsa-ucm-conf.overrideAttrs (prev: {
|
||||
src = self.inputs.alsa-ucm-conf;
|
||||
});
|
||||
inherit qrtr pd-mapper;
|
||||
}
|
||||
)
|
||||
];
|
||||
|
||||
# ensure the x13s' dtb file is in the boot partition
|
||||
# TODO:: is this needed for the VT display somehow?
|
||||
system.activationScripts.x13s-dtb = ''
|
||||
in_package="${dtb}"
|
||||
esp_tool_folder="${efi.efiSysMountPoint}/"
|
||||
in_esp="''${esp_tool_folder}${dtbName}"
|
||||
>&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
|
||||
'';
|
||||
|
||||
boot = {
|
||||
loader.systemd-boot.enable = true;
|
||||
loader.systemd-boot.extraFiles = {
|
||||
|
@ -213,6 +229,31 @@
|
|||
|
||||
initrd = {
|
||||
includeDefaultModules = false;
|
||||
|
||||
# kernelModules = [
|
||||
# "nvme"
|
||||
# "phy_qcom_qmp_pcie"
|
||||
# "pcie_qcom"
|
||||
|
||||
# "i2c_core"
|
||||
# "i2c_hid"
|
||||
# "i2c_hid_of"
|
||||
# "i2c_qcom_geni"
|
||||
|
||||
# "leds_qcom_lpg"
|
||||
# "pwm_bl"
|
||||
# "qrtr"
|
||||
# "pmic_glink_altmode"
|
||||
# "gpio_sbu_mux"
|
||||
# "phy_qcom_qmp_combo"
|
||||
# "gpucc_sc8280xp"
|
||||
# "dispcc_sc8280xp"
|
||||
# "phy_qcom_edp"
|
||||
# "panel_edp"
|
||||
# # "msm"
|
||||
|
||||
# ];
|
||||
|
||||
availableKernelModules = [
|
||||
"i2c_hid"
|
||||
"i2c_hid_of"
|
||||
|
@ -223,26 +264,25 @@
|
|||
"pmic_glink_altmode"
|
||||
"gpio_sbu_mux"
|
||||
"phy_qcom_qmp_combo"
|
||||
"panel-edp"
|
||||
"msm"
|
||||
"panel_edp"
|
||||
# "msm"
|
||||
"phy_qcom_edp"
|
||||
"i2c-core"
|
||||
"i2c-hid"
|
||||
"i2c-hid-of"
|
||||
"i2c-qcom-geni"
|
||||
"pcie-qcom"
|
||||
"phy-qcom-qmp-combo"
|
||||
"phy-qcom-qmp-pcie"
|
||||
"phy-qcom-qmp-usb"
|
||||
"phy-qcom-snps-femto-v2"
|
||||
"phy-qcom-usb-hs"
|
||||
"i2c_core"
|
||||
"i2c_hid"
|
||||
"i2c_hid_of"
|
||||
"i2c_qcom_geni"
|
||||
"pcie_qcom"
|
||||
"phy_qcom_qmp_combo"
|
||||
"phy_qcom_qmp_pcie"
|
||||
"phy_qcom_qmp_usb"
|
||||
"phy_qcom_snps_femto_v2"
|
||||
"phy_qcom_usb_hs"
|
||||
"nvme"
|
||||
|
||||
"usbcore"
|
||||
"xhci_hcd"
|
||||
"usbhid"
|
||||
"usb_storage"
|
||||
# "xhci_pci"
|
||||
"uas"
|
||||
];
|
||||
};
|
||||
|
@ -254,44 +294,33 @@
|
|||
|
||||
hardware.enableAllFirmware = true;
|
||||
hardware.firmware = [
|
||||
pkgs.linux-firmware
|
||||
# pkgs.linux-firmware
|
||||
|
||||
(pkgs.callPackage x13_firmware { })
|
||||
(pkgs.callPackage "${self.inputs.brainwart_x13s-nixos}/pkgs/x13s-firmware.nix" { })
|
||||
pkgs.x13s_extra-firmware
|
||||
];
|
||||
|
||||
systemd.services.pd-mapper = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${lib.getExe pkgs.pd-mapper}";
|
||||
ExecStart = "${lib.getExe pd-mapper}";
|
||||
Restart = "always";
|
||||
};
|
||||
};
|
||||
|
||||
# bind mount over existing alsa-ucm-conf
|
||||
# this is just config, but is in the critical path for lots of packages
|
||||
# systemd.services.x13s-alsa-conf = {
|
||||
# wantedBy = [ "multi-user.target" ];
|
||||
|
||||
# serviceConfig = {
|
||||
# Type = "oneshot";
|
||||
# RemainAfterExit = true;
|
||||
|
||||
# ExecStart = "${pkgs.util-linux.mount}/bin/mount -o bind ${pkgs.x13s_alsa-ucm-conf}/share/alsa ${pkgs.alsa-ucm-conf}/share/alsa";
|
||||
# ExecStop = "${pkgs.util-linux.mount}/bin/umount ${pkgs.alsa-ucm-conf}/share/alsa";
|
||||
# };
|
||||
# };
|
||||
environment.sessionVariables = alsa-ucm-conf-env;
|
||||
systemd.user.services.pipewire.environment = alsa-ucm-conf-env;
|
||||
systemd.user.services.wireplumber.environment = alsa-ucm-conf-env;
|
||||
|
||||
systemd.services.bluetooth = {
|
||||
serviceConfig = {
|
||||
# disabled because btmgmt call hangs
|
||||
# ExecStartPre = [
|
||||
# ""
|
||||
# "${pkgs.util-linux}/bin/rfkill block bluetooth"
|
||||
# "${pkgs.bluez5-experimental}/bin/btmgmt public-addr ${cfg.bluetoothMac}"
|
||||
# "${pkgs.util-linux}/bin/rfkill unblock bluetooth"
|
||||
# ];
|
||||
ExecStartPre = [
|
||||
""
|
||||
"${pkgs.util-linux}/bin/rfkill block bluetooth"
|
||||
"${pkgs.bluez5-experimental}/bin/btmgmt public-addr ${cfg.bluetoothMac}"
|
||||
"${pkgs.util-linux}/bin/rfkill unblock bluetooth"
|
||||
];
|
||||
RestartSec = 5;
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue