From 626dd6f6d00f92e6d94ad372c31d35497988564c Mon Sep 17 00:00:00 2001 From: Artemis Tosini Date: Thu, 25 Apr 2024 02:40:11 +0000 Subject: [PATCH] smolder: Add external PWM fan --- flake.lock | 58 +++++++++++++++++----------------- system/smolder/boot-config.nix | 10 +++++- system/smolder/fan.dts | 43 +++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 30 deletions(-) create mode 100644 system/smolder/fan.dts diff --git a/flake.lock b/flake.lock index b13da02..89de920 100644 --- a/flake.lock +++ b/flake.lock @@ -63,11 +63,11 @@ ] }, "locked": { - "lastModified": 1713543876, - "narHash": "sha256-olEWxacm1xZhAtpq+ZkEyQgR4zgfE7ddpNtZNvubi3g=", + "lastModified": 1713946171, + "narHash": "sha256-lc75rgRQLdp4Dzogv5cfqOg6qYc5Rp83oedF2t0kDp8=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "9e7c20ffd056e406ddd0276ee9d89f09c5e5f4ed", + "rev": "230a197063de9287128e2c68a7a4b0cd7d0b50a7", "type": "github" }, "original": { @@ -329,11 +329,11 @@ ] }, "locked": { - "lastModified": 1713809191, - "narHash": "sha256-9Tb5JKcacjxNF1f7gsu/4l4Gxa2qflq9x1hhdl10iwM=", + "lastModified": 1713992342, + "narHash": "sha256-bW7K4WPo6jhYMo4ZUGoJfog6xJV0XZh8adXqZKunRoc=", "owner": "nix-community", "repo": "home-manager", - "rev": "e866aae5bbbcfe6798ca05d3004a4e62f1828954", + "rev": "2f072c127c041eec36621b8e38a531fe0fe07961", "type": "github" }, "original": { @@ -350,11 +350,11 @@ ] }, "locked": { - "lastModified": 1713763883, - "narHash": "sha256-/3aEYe0LEoUy5/1cs9EhcFhT4r8RnbHBziuI40vmK6E=", + "lastModified": 1713946567, + "narHash": "sha256-gbffQxWoGmq9rmSwM2y4a+VGaTTuXSN+yyRoCkMuRjs=", "owner": "jovian-experiments", "repo": "jovian-nixos", - "rev": "9bb2ac68cab837aa063b8da40991cecc37de75a1", + "rev": "c3255d642c945847c61a867be15de63b8f81d5dc", "type": "github" }, "original": { @@ -395,11 +395,11 @@ "lix": { "flake": false, "locked": { - "lastModified": 1713713879, - "narHash": "sha256-7B3CVSSM8kyDsAJ8wlxL6Rf3StpBTlryiMLXPQlh4nQ=", + "lastModified": 1713972932, + "narHash": "sha256-5+Mbgk2C8sNm7J2CNSi21YYTf3T6ow4QvgM+YX/t9pg=", "ref": "refs/heads/main", - "rev": "4206635f9140a12ae2e3f1d49714ddfcf44fd2f8", - "revCount": 15414, + "rev": "8175e47ce5ddf3bde64eb0a0f589a307a317c2bb", + "revCount": 15425, "type": "git", "url": "ssh://git@lix.systems/lix-project/lix" }, @@ -423,11 +423,11 @@ ] }, "locked": { - "lastModified": 1713758264, - "narHash": "sha256-x7uHPs9qI9hhWW4BJnJaTSX2KO1CGq/ltUR8XlUpYoQ=", + "lastModified": 1713823914, + "narHash": "sha256-phAcUYvh3tuCTCBkB/i4cfU4QafrNub6rvRqD2Wcbt4=", "ref": "refs/heads/main", - "rev": "71f268f215dbd6d8755813d9674a4cd588f10552", - "revCount": 51, + "rev": "21907b875dcc5472faea29a0eabf114966fcff84", + "revCount": 53, "type": "git", "url": "ssh://git@lix.systems/lix-project/nixos-module" }, @@ -443,11 +443,11 @@ ] }, "locked": { - "lastModified": 1713668931, - "narHash": "sha256-rVlwWQlgFGGK3aPVcKmtYqWgjYnPah5FOIsYAqrMN2w=", + "lastModified": 1713869268, + "narHash": "sha256-o3CMQeu/S8/4zU0pMtYg51rd1FWdJsI2Xohzng1Ysdg=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "07ece11b22217b8459df589f858e92212b74f1a1", + "rev": "dcb6ac44922858ce3a5b46f77a36d6030181460c", "type": "github" }, "original": { @@ -458,11 +458,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1713521961, - "narHash": "sha256-EwR8wW9AqJhSIY+0oxWRybUZ32BVKuZ9bjlRh8SJvQ8=", + "lastModified": 1713864415, + "narHash": "sha256-/BPDMJEkrsFAFOsQWhwm31wezlgshPFlLBn34KEUdVA=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "5d48925b815fd202781bfae8fb6f45c07112fdb2", + "rev": "797f8d8082c7cc3259cba7275c699d4991b09ecc", "type": "github" }, "original": { @@ -473,11 +473,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713714899, - "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", + "lastModified": 1713895582, + "narHash": "sha256-cfh1hi+6muQMbi9acOlju3V1gl8BEaZBXBR9jQfQi4U=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6143fc5eeb9c4f00163267708e26191d1e918932", + "rev": "572af610f6151fd41c212f897c71f7056e3fb518", "type": "github" }, "original": { @@ -520,11 +520,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1713812755, - "narHash": "sha256-L6z7NY0UMbO5DKFFjUleIGcuAt8XwOvD0YUVUqSeGBw=", + "lastModified": 1713939051, + "narHash": "sha256-EwDbsFjpXANXd2MIvRm4Bz2CDNWIhlV/659xOAxhEv0=", "owner": "nix-community", "repo": "nixvim", - "rev": "6ebd538ede5a0de49253620828ba28dc57988305", + "rev": "f2f97d844bb39559f3356e209b49c92900d860b8", "type": "github" }, "original": { diff --git a/system/smolder/boot-config.nix b/system/smolder/boot-config.nix index 27cd222..439eb78 100644 --- a/system/smolder/boot-config.nix +++ b/system/smolder/boot-config.nix @@ -1,6 +1,14 @@ { config, pkgs, ... }: { - hardware.deviceTree.filter = "rk3588-rock-5b.dtb"; + hardware.deviceTree = { + filter = "rk3588-rock-5b.dtb"; + overlays = [ + { + name = "fan"; + dtsFile = ./fan.dts; + } + ]; + }; boot = { loader.grub.enable = false; diff --git a/system/smolder/fan.dts b/system/smolder/fan.dts new file mode 100644 index 0000000..be364f9 --- /dev/null +++ b/system/smolder/fan.dts @@ -0,0 +1,43 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/ { + compatible = "radxa,rock-5b"; + + fragment@0 { + target-path = "/"; + __overlay__ { + vcc12v_dcin: vcc12v-dcin-regulator { + compatible = "regulator-fixed"; + regulator-name = "vcc12v_dcin"; + regulator-always-on; + regulator-boot-on; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + }; + }; + }; + fragment@1 { + target-path = "/"; + __overlay__ { + ext_fan: ext-fan { + compatible = "pwm-fan"; + cooling-levels = <0 95 145 195 255>; + fan-supply = <&vcc12v_dcin>; + pwms = <&pwm12 0 50000 0>; + #cooling-cells = <2>; + }; + }; + }; + + fragment@2 { + target = <&pwm12>; + __overlay__ { + status = "okay"; + }; + }; +};