diff --git a/README.md b/README.md index eb9df53..ddc3c83 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,7 @@ See code for all available configurations. | [GPD WIN 2](gpd/win-2) | `` | | [Google Pixelbook](google/pixelbook) | `` | | [HP Elitebook 2560p](hp/elitebook/2560p) | `` | +| [HP Elitebook 845g9](hp/elitebook/845/g9) | `` | | [i.MX8QuadMax Multisensory Enablement Kit](nxp/imx8qm-mek/) | `` | | [Intel NUC 8i7BEH](intel/nuc/8i7beh/) | `` | | [Lenovo IdeaPad Gaming 3 15arh05](lenovo/ideapad/15arh05) | `` | diff --git a/common/cpu/amd/pstate.nix b/common/cpu/amd/pstate.nix index ab07a91..6a84027 100644 --- a/common/cpu/amd/pstate.nix +++ b/common/cpu/amd/pstate.nix @@ -1,6 +1,6 @@ -{ lib, config, ... }: +{ lib, config, ... }: let - kver = config.boot.kernelPackages.kernel.version; + kver = config.boot.kernelPackages.kernel.version; in { # Enables the amd cpu scaling https://www.kernel.org/doc/html/latest/admin-guide/pm/amd-pstate.html @@ -8,15 +8,25 @@ in imports = [ ./. ]; boot = lib.mkMerge [ - (lib.mkIf ( - (lib.versionAtLeast kver "5.17") - && (lib.versionOlder kver "6.1") - ) { - kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; - kernelModules = [ "amd-pstate" ]; - }) - (lib.mkIf (lib.versionAtLeast kver "6.1") { - kernelParams = [ "amd_pstate=passive" ]; + (lib.mkIf + ( + (lib.versionAtLeast kver "5.17") + && (lib.versionOlder kver "6.1") + ) + { + kernelParams = [ "initcall_blacklist=acpi_cpufreq_init" ]; + kernelModules = [ "amd-pstate" ]; + }) + (lib.mkIf + ( + (lib.versionAtLeast kver "6.1") + && (lib.versionOlder kver "6.3") + ) + { + kernelParams = [ "amd_pstate=passive" ]; + }) + (lib.mkIf (lib.versionAtLeast kver "6.3") { + kernelParams = [ "amd_pstate=active" ]; }) ]; } diff --git a/flake.nix b/flake.nix index c6348dc..0992f3a 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,7 @@ gpd-pocket-3 = import ./gpd/pocket-3; gpd-win-2 = import ./gpd/win-2; hp-elitebook-2560p = import ./hp/elitebook/2560p; + hp-elitebook-845g9 = import ./hp/elitebook/845/g9; intel-nuc-8i7beh = import ./intel/nuc/8i7beh; lenovo-ideapad-15arh05 = import ./lenovo/ideapad/15arh05; lenovo-ideapad-z510 = import ./lenovo/ideapad/z510; diff --git a/hp/elitebook/845/g9/default.nix b/hp/elitebook/845/g9/default.nix new file mode 100644 index 0000000..6c0cb49 --- /dev/null +++ b/hp/elitebook/845/g9/default.nix @@ -0,0 +1,25 @@ +{ config, pkgs, lib, ... }: + +{ + imports = + [ + ../../../../common/cpu/amd + ../../../../common/cpu/amd/pstate.nix + ../../../../common/gpu/amd + ../../../../common/pc/laptop + ../../../../common/pc/laptop/acpi_call.nix + ../../../../common/pc/laptop/ssd + ]; + + hardware.enableRedistributableFirmware = lib.mkDefault true; + boot.kernelModules = [ "synaptics_usb" ]; + boot.kernelPackages = lib.mkIf (lib.versionOlder pkgs.linux.version "6.3") (lib.mkDefault pkgs.linuxPackages_latest); + + # disable Scatter/Gather APU recently enabled by default, + # which results in white screen after display reconfiguration + boot.kernelParams = [ "amdgpu.sg_display=0" ]; + + services.xserver = { + videoDrivers = [ "amdgpu" ]; + }; +} diff --git a/raspberry-pi/4/backlight.nix b/raspberry-pi/4/backlight.nix index f871421..31c0e90 100644 --- a/raspberry-pi/4/backlight.nix +++ b/raspberry-pi/4/backlight.nix @@ -16,8 +16,9 @@ in hardware.deviceTree = { overlays = [ # This overlay was originally taken from: - # https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts + # https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts # The only modification made was to change the compatible field to bcm2711 + # this is the same as for the 5.15.y kernel { name = "rpi-backlight-overlay"; dtsText = '' diff --git a/raspberry-pi/4/default.nix b/raspberry-pi/4/default.nix index 6101698..7c442ff 100644 --- a/raspberry-pi/4/default.nix +++ b/raspberry-pi/4/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: +{ lib, pkgs, config, ... }: { imports = [ @@ -32,7 +32,15 @@ }; }; - hardware.deviceTree.filter = "bcm2711-rpi-*.dtb"; + hardware.deviceTree.filter = lib.mkDefault "bcm2711-rpi-*.dtb"; + + + assertions = [ + { + assertion = (lib.versionAtLeast config.boot.kernelPackages.kernel.version "6.1"); + message = "This version of raspberry pi 4 dts overlays requires a newer kernel version (>=6.1). Please upgrade nixpkgs for this system."; + } + ]; # Required for the Wireless firmware hardware.enableRedistributableFirmware = true; diff --git a/raspberry-pi/4/modesetting.nix b/raspberry-pi/4/modesetting.nix index b1f734b..b74e686 100644 --- a/raspberry-pi/4/modesetting.nix +++ b/raspberry-pi/4/modesetting.nix @@ -31,7 +31,7 @@ in hardware.deviceTree = { overlays = [ # Equivalent to: - # https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/cma-overlay.dts + # https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/cma-overlay.dts { name = "rpi4-cma-overlay"; dtsText = '' @@ -52,7 +52,7 @@ in ''; } # Equivalent to: - # https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts + # https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts { name = "rpi4-vc4-fkms-v3d-overlay"; dtsText = '' diff --git a/raspberry-pi/4/poe-hat.nix b/raspberry-pi/4/poe-hat.nix index 6759f42..5d6cf8d 100644 --- a/raspberry-pi/4/poe-hat.nix +++ b/raspberry-pi/4/poe-hat.nix @@ -13,10 +13,12 @@ in { config = lib.mkIf cfg.enable { hardware.raspberry-pi."4".apply-overlays-dtmerge.enable = lib.mkDefault true; + # doesn't work for the CM module, so we exclude e.g. bcm2711-rpi-cm4.dts + hardware.deviceTree.filter = "bcm2711-rpi-4*.dtb"; hardware.deviceTree = { overlays = [ - # Equivalent to: https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts + # Equivalent to: https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts { name = "rpi-poe-overlay"; dtsText = '' @@ -44,50 +46,59 @@ in { fragment@1 { target = <&cpu_thermal>; __overlay__ { - trips { - trip0: trip0 { - temperature = <40000>; - hysteresis = <2000>; - type = "active"; - }; - trip1: trip1 { - temperature = <45000>; - hysteresis = <2000>; - type = "active"; - }; - trip2: trip2 { - temperature = <50000>; - hysteresis = <2000>; - type = "active"; - }; - trip3: trip3 { - temperature = <55000>; - hysteresis = <5000>; - type = "active"; - }; - }; - cooling-maps { - map0 { - trip = <&trip0>; - cooling-device = <&fan 0 1>; - }; - map1 { - trip = <&trip1>; - cooling-device = <&fan 1 2>; - }; - map2 { - trip = <&trip2>; - cooling-device = <&fan 2 3>; - }; - map3 { - trip = <&trip3>; - cooling-device = <&fan 3 4>; - }; - }; + polling-delay = <2000>; /* milliseconds */ }; }; fragment@2 { + target = <&thermal_trips>; + __overlay__ { + trip0: trip0 { + temperature = <40000>; + hysteresis = <2000>; + type = "active"; + }; + trip1: trip1 { + temperature = <45000>; + hysteresis = <2000>; + type = "active"; + }; + trip2: trip2 { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + trip3: trip3 { + temperature = <55000>; + hysteresis = <5000>; + type = "active"; + }; + }; + }; + + fragment@3 { + target = <&cooling_maps>; + __overlay__ { + map0 { + trip = <&trip0>; + cooling-device = <&fan 0 1>; + }; + map1 { + trip = <&trip1>; + cooling-device = <&fan 1 2>; + }; + map2 { + trip = <&trip2>; + cooling-device = <&fan 2 3>; + }; + map3 { + trip = <&trip3>; + cooling-device = <&fan 3 4>; + }; + }; + }; + + fragment@4 { target-path = "/__overrides__"; params: __overlay__ { poe_fan_temp0 = <&trip0>,"temperature:0"; @@ -104,7 +115,7 @@ in { }; }; - fragment@3 { + fragment@5 { target = <&firmware>; __overlay__ { fwpwm: pwm { @@ -114,7 +125,7 @@ in { }; }; - fragment@4 { + fragment@6 { target = <&i2c0>; i2c_bus: __overlay__ { #address-cells = <1>; @@ -135,14 +146,14 @@ in { }; }; - fragment@5 { + fragment@7 { target = <&i2c0if>; __dormant__ { status = "okay"; }; }; - fragment@6 { + fragment@8 { target = <&i2c0mux>; __dormant__ { status = "okay"; diff --git a/raspberry-pi/4/poe-plus-hat.nix b/raspberry-pi/4/poe-plus-hat.nix index e0627b6..bd7c28e 100644 --- a/raspberry-pi/4/poe-plus-hat.nix +++ b/raspberry-pi/4/poe-plus-hat.nix @@ -1,6 +1,6 @@ { config, lib, ... }: -let +let cfg = config.hardware.raspberry-pi."4".poe-plus-hat; in { options.hardware = { @@ -13,12 +13,14 @@ in { config = lib.mkIf cfg.enable { hardware.raspberry-pi."4".apply-overlays-dtmerge.enable = lib.mkDefault true; + # doesn't work for the CM module, so we exclude e.g. bcm2711-rpi-cm4.dts + hardware.deviceTree.filter = "bcm2711-rpi-4*.dtb"; hardware.deviceTree = { overlays = [ # Combined equivalent to: - # * https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts - # * https://github.com/raspberrypi/linux/blob/rpi-5.15.y/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts + # * https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-poe-overlay.dts + # * https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-poe-plus-overlay.dts { name = "rpi-poe-plus-overlay"; dtsText = '' @@ -46,50 +48,59 @@ in { fragment@1 { target = <&cpu_thermal>; __overlay__ { - trips { - trip0: trip0 { - temperature = <40000>; - hysteresis = <2000>; - type = "active"; - }; - trip1: trip1 { - temperature = <45000>; - hysteresis = <2000>; - type = "active"; - }; - trip2: trip2 { - temperature = <50000>; - hysteresis = <2000>; - type = "active"; - }; - trip3: trip3 { - temperature = <55000>; - hysteresis = <5000>; - type = "active"; - }; - }; - cooling-maps { - map0 { - trip = <&trip0>; - cooling-device = <&fan 0 1>; - }; - map1 { - trip = <&trip1>; - cooling-device = <&fan 1 2>; - }; - map2 { - trip = <&trip2>; - cooling-device = <&fan 2 3>; - }; - map3 { - trip = <&trip3>; - cooling-device = <&fan 3 4>; - }; - }; + polling-delay = <2000>; /* milliseconds */ }; }; fragment@2 { + target = <&thermal_trips>; + __overlay__ { + trip0: trip0 { + temperature = <40000>; + hysteresis = <2000>; + type = "active"; + }; + trip1: trip1 { + temperature = <45000>; + hysteresis = <2000>; + type = "active"; + }; + trip2: trip2 { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + trip3: trip3 { + temperature = <55000>; + hysteresis = <5000>; + type = "active"; + }; + }; + }; + + fragment@3 { + target = <&cooling_maps>; + __overlay__ { + map0 { + trip = <&trip0>; + cooling-device = <&fan 0 1>; + }; + map1 { + trip = <&trip1>; + cooling-device = <&fan 1 2>; + }; + map2 { + trip = <&trip2>; + cooling-device = <&fan 2 3>; + }; + map3 { + trip = <&trip3>; + cooling-device = <&fan 3 4>; + }; + }; + }; + + fragment@4 { target-path = "/__overrides__"; params: __overlay__ { poe_fan_temp0 = <&trip0>,"temperature:0"; @@ -106,7 +117,7 @@ in { }; }; - fragment@3 { + fragment@5 { target = <&firmware>; __overlay__ { fwpwm: pwm { @@ -116,7 +127,7 @@ in { }; }; - fragment@4 { + fragment@6 { target = <&i2c0>; i2c_bus: __overlay__ { #address-cells = <1>; @@ -137,14 +148,14 @@ in { }; }; - fragment@5 { + fragment@7 { target = <&i2c0if>; __dormant__ { status = "okay"; }; }; - fragment@6 { + fragment@8 { target = <&i2c0mux>; __dormant__ { status = "okay"; @@ -172,48 +183,48 @@ in { // Overlay for the Raspberry Pi PoE+ HAT. / { - compatible = "brcm,bcm2711"; + compatible = "brcm,bcm2711"; - fragment@10 { - target-path = "/"; - __overlay__ { - rpi_poe_power_supply: rpi-poe-power-supply { - compatible = "raspberrypi,rpi-poe-power-supply"; - firmware = <&firmware>; - status = "okay"; - }; - }; + fragment@10 { + target-path = "/"; + __overlay__ { + rpi_poe_power_supply: rpi-poe-power-supply { + compatible = "raspberrypi,rpi-poe-power-supply"; + firmware = <&firmware>; + status = "okay"; + }; }; - fragment@11 { - target = <&poe_mfd>; - __overlay__ { - rpi-poe-power-supply@f2 { - compatible = "raspberrypi,rpi-poe-power-supply"; - reg = <0xf2>; - status = "okay"; - }; - }; + }; + fragment@11 { + target = <&poe_mfd>; + __overlay__ { + rpi-poe-power-supply@f2 { + compatible = "raspberrypi,rpi-poe-power-supply"; + reg = <0xf2>; + status = "okay"; + }; }; + }; - __overrides__ { - i2c = <0>, "+5+6", - <&fwpwm>,"status=disabled", - <&rpi_poe_power_supply>,"status=disabled", - <&i2c_bus>,"status=okay", - <&poe_mfd>,"status=okay", - <&fan>,"pwms:0=",<&poe_mfd_pwm>; - }; + __overrides__ { + i2c = <0>, "+5+6", + <&fwpwm>,"status=disabled", + <&rpi_poe_power_supply>,"status=disabled", + <&i2c_bus>,"status=okay", + <&poe_mfd>,"status=okay", + <&fan>,"pwms:0=",<&poe_mfd_pwm>; + }; }; &fan { - cooling-levels = <0 32 64 128 255>; + cooling-levels = <0 32 64 128 255>; }; ¶ms { - poe_fan_i2c = <&fwpwm>,"status=disabled", - <&rpi_poe_power_supply>,"status=disabled", - <&poe_mfd>,"status=okay", - <&fan>,"pwms:0=",<&poe_mfd_pwm>; + poe_fan_i2c = <&fwpwm>,"status=disabled", + <&rpi_poe_power_supply>,"status=disabled", + <&poe_mfd>,"status=okay", + <&fan>,"pwms:0=",<&poe_mfd_pwm>; }; ''; }