🧊 get rpi poe fans working!

This commit is contained in:
James Walker 2021-05-19 21:15:38 -04:00
parent 4fb6c04299
commit b0a456b824
Signed by: walkah
GPG Key ID: 3C127179D6086E93
4 changed files with 117 additions and 7 deletions

View File

@ -3,6 +3,7 @@
{
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
./rpi-poe.nix
];
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)

View File

@ -12,7 +12,7 @@
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};

109
hosts/aristotle/rpi-poe.nix Normal file
View File

@ -0,0 +1,109 @@
{ config, lib, pkgs, ... }:
{
hardware = {
deviceTree = {
filter = "bcm2711-rpi-*.dtb";
overlays = [{
name = "rpi-poe";
dtsText = ''
/*
* Overlay for the Raspberry Pi POE HAT.
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
fragment@0 {
target-path = "/";
__overlay__ {
fan0: rpi-poe-fan@0 {
compatible = "raspberrypi,rpi-poe-fan";
firmware = <&firmware>;
cooling-min-state = <0>;
cooling-max-state = <4>;
#cooling-cells = <2>;
cooling-levels = <0 1 10 100 255>;
status = "okay";
};
};
};
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 = <&fan0 0 1>;
};
map1 {
trip = <&trip1>;
cooling-device = <&fan0 1 2>;
};
map2 {
trip = <&trip2>;
cooling-device = <&fan0 2 3>;
};
map3 {
trip = <&trip3>;
cooling-device = <&fan0 3 4>;
};
};
};
};
fragment@2 {
target-path = "/__overrides__";
__overlay__ {
poe_fan_temp0 = <&trip0>,"temperature:0";
poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
poe_fan_temp1 = <&trip1>,"temperature:0";
poe_fan_temp1_hyst = <&trip1>,"hysteresis:0";
poe_fan_temp2 = <&trip2>,"temperature:0";
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
poe_fan_temp3 = <&trip3>,"temperature:0";
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
};
};
__overrides__ {
poe_fan_temp0 = <&trip0>,"temperature:0";
poe_fan_temp0_hyst = <&trip0>,"hysteresis:0";
poe_fan_temp1 = <&trip1>,"temperature:0";
poe_fan_temp1_hyst = <&trip1>,"hysteresis:0";
poe_fan_temp2 = <&trip2>,"temperature:0";
poe_fan_temp2_hyst = <&trip2>,"hysteresis:0";
poe_fan_temp3 = <&trip3>,"temperature:0";
poe_fan_temp3_hyst = <&trip3>,"hysteresis:0";
};
};
'';
}];
};
};
}

View File

@ -5,10 +5,10 @@
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "af958e8057f345ee1aca714c1247ef3ba1c15f5e",
"sha256": "1qjavxabbrsh73yck5dcq8jggvh3r2jkbr6b5nlz5d9yrqm9255n",
"rev": "94080ae8286024820c570a2a24ed7c36d7ad04a9",
"sha256": "0wlk52zwlrq727x3z1vg9d9qq4zw62ab5jzg4068iqb6hyb0cr0w",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/af958e8057f345ee1aca714c1247ef3ba1c15f5e.tar.gz",
"url": "https://github.com/nmattia/niv/archive/94080ae8286024820c570a2a24ed7c36d7ad04a9.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
@ -17,10 +17,10 @@
"homepage": "",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1c16013bd6e94da748b41cc123c6b509a23eb440",
"sha256": "1m2wif0qnci0q14plbqlb95vx214pxqgw5li86lyw6hsiy7y3zfn",
"rev": "7013a0f2791da4c38c7e6f56d48139aeb344991b",
"sha256": "1az617wpx535nfn0rz63cyvv8b5rlsp80cdq07da2dws8zzylnbm",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/1c16013bd6e94da748b41cc123c6b509a23eb440.tar.gz",
"url": "https://github.com/NixOS/nixpkgs/archive/7013a0f2791da4c38c7e6f56d48139aeb344991b.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}