2024-01-04 21:51:13 +05:30
|
|
|
{ lib, ... }: {
|
2023-11-04 16:12:45 +05:30
|
|
|
imports = [ ./filesystem.nix ./kernel.nix ];
|
2023-11-11 19:48:38 +05:30
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
#hardware.raspberry-pi."4".poe-plus-hat.enable = true;
|
|
|
|
hardware.raspberry-pi."4".apply-overlays-dtmerge.enable = lib.mkDefault true;
|
|
|
|
hardware.deviceTree.filter = "bcm2711-rpi-4*.dtb";
|
|
|
|
hardware.deviceTree = {
|
|
|
|
overlays = [
|
|
|
|
# Combined equivalent to:
|
|
|
|
# * 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 = ''
|
|
|
|
/*
|
|
|
|
* Overlay for the Raspberry Pi POE HAT.
|
|
|
|
*/
|
|
|
|
/dts-v1/;
|
|
|
|
/plugin/;
|
|
|
|
|
|
|
|
/ {
|
|
|
|
compatible = "brcm,bcm2711";
|
|
|
|
|
|
|
|
fragment@0 {
|
|
|
|
target-path = "/";
|
|
|
|
__overlay__ {
|
|
|
|
fan: pwm-fan {
|
|
|
|
compatible = "pwm-fan";
|
|
|
|
cooling-levels = <0 1 10 100 255>;
|
|
|
|
#cooling-cells = <2>;
|
|
|
|
pwms = <&fwpwm 0 80000>;
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
fragment@1 {
|
|
|
|
target = <&cpu_thermal>;
|
|
|
|
__overlay__ {
|
|
|
|
polling-delay = <2000>; /* milliseconds */
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
fragment@2 {
|
|
|
|
target = <&thermal_trips>;
|
|
|
|
__overlay__ {
|
|
|
|
trip0: trip0 {
|
2024-01-04 21:51:13 +05:30
|
|
|
temperature = <55000>;
|
2024-01-04 21:51:13 +05:30
|
|
|
hysteresis = <2000>;
|
|
|
|
type = "active";
|
|
|
|
};
|
|
|
|
trip1: trip1 {
|
2024-01-04 21:51:13 +05:30
|
|
|
temperature = <58000>;
|
2024-01-04 21:51:13 +05:30
|
|
|
hysteresis = <2000>;
|
|
|
|
type = "active";
|
|
|
|
};
|
|
|
|
trip2: trip2 {
|
2024-01-04 21:51:13 +05:30
|
|
|
temperature = <61000>;
|
2024-01-04 21:51:13 +05:30
|
|
|
hysteresis = <2000>;
|
|
|
|
type = "active";
|
|
|
|
};
|
|
|
|
trip3: trip3 {
|
2024-01-04 21:51:13 +05:30
|
|
|
temperature = <64000>;
|
2024-01-04 21:51:13 +05:30
|
|
|
hysteresis = <5000>;
|
|
|
|
type = "active";
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
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>;
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
fragment@4 {
|
|
|
|
target-path = "/__overrides__";
|
|
|
|
params: __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";
|
|
|
|
poe_fan_i2c = <&fwpwm>,"status=disabled",
|
|
|
|
<&poe_mfd>,"status=okay",
|
|
|
|
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
fragment@5 {
|
|
|
|
target = <&firmware>;
|
|
|
|
__overlay__ {
|
|
|
|
fwpwm: pwm {
|
|
|
|
compatible = "raspberrypi,firmware-poe-pwm";
|
|
|
|
#pwm-cells = <2>;
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
fragment@6 {
|
|
|
|
target = <&i2c0>;
|
|
|
|
i2c_bus: __overlay__ {
|
|
|
|
#address-cells = <1>;
|
|
|
|
#size-cells = <0>;
|
|
|
|
|
|
|
|
poe_mfd: poe@51 {
|
|
|
|
compatible = "raspberrypi,poe-core";
|
|
|
|
reg = <0x51>;
|
|
|
|
status = "disabled";
|
|
|
|
|
|
|
|
poe_mfd_pwm: poe_pwm@f0 {
|
|
|
|
compatible = "raspberrypi,poe-pwm";
|
|
|
|
reg = <0xf0>;
|
|
|
|
status = "okay";
|
|
|
|
#pwm-cells = <2>;
|
|
|
|
};
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
fragment@7 {
|
|
|
|
target = <&i2c0if>;
|
|
|
|
__dormant__ {
|
|
|
|
status = "okay";
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
fragment@8 {
|
|
|
|
target = <&i2c0mux>;
|
|
|
|
__dormant__ {
|
|
|
|
status = "okay";
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
__overrides__ {
|
2024-01-04 21:51:13 +05:30
|
|
|
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";
|
2024-01-04 21:51:13 +05:30
|
|
|
i2c = <0>, "+5+6",
|
|
|
|
<&fwpwm>,"status=disabled",
|
|
|
|
<&i2c_bus>,"status=okay",
|
2024-01-04 21:51:13 +05:30
|
|
|
<&poe_mfd>,"status=okay",
|
|
|
|
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
// SPDX-License-Identifier: (GPL-2.0 OR MIT)
|
|
|
|
// Overlay for the Raspberry Pi PoE+ HAT.
|
2024-01-04 21:51:13 +05:30
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
/ {
|
|
|
|
compatible = "brcm,bcm2711";
|
2024-01-04 21:51:13 +05:30
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
fragment@10 {
|
|
|
|
target-path = "/";
|
|
|
|
__overlay__ {
|
|
|
|
rpi_poe_power_supply: rpi-poe-power-supply {
|
|
|
|
compatible = "raspberrypi,rpi-poe-power-supply";
|
|
|
|
firmware = <&firmware>;
|
2024-01-04 21:51:13 +05:30
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
fragment@11 {
|
|
|
|
target = <&poe_mfd>;
|
|
|
|
__overlay__ {
|
|
|
|
rpi-poe-power-supply@f2 {
|
|
|
|
compatible = "raspberrypi,rpi-poe-power-supply";
|
|
|
|
reg = <0xf2>;
|
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
__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>;
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
&fan {
|
|
|
|
cooling-levels = <0 32 64 128 255>;
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
|
|
|
|
2024-01-04 21:51:13 +05:30
|
|
|
¶ms {
|
|
|
|
poe_fan_i2c = <&fwpwm>,"status=disabled",
|
|
|
|
<&rpi_poe_power_supply>,"status=disabled",
|
|
|
|
<&poe_mfd>,"status=okay",
|
|
|
|
<&fan>,"pwms:0=",<&poe_mfd_pwm>;
|
2024-01-04 21:51:13 +05:30
|
|
|
};
|
2024-01-04 21:51:13 +05:30
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2023-08-15 13:06:06 +05:30
|
|
|
}
|