dtsoverlays

This commit is contained in:
mjallen18
2025-12-29 19:22:11 -06:00
parent 82e062a7e8
commit 209e776640
14 changed files with 315 additions and 53 deletions

View File

@@ -0,0 +1,26 @@
{ config, lib, pkgs, namespace, ... }:
let
cfg = config.${namespace}.hardware.raspberry-pi.pwm;
variant = config.${namespace}.hardware.raspberry-pi.variant;
in
{
options.${namespace}.hardware.raspberry-pi.pwm = {
enable = lib.mkEnableOption "enable pwm dt overlay";
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
{
name = "enable-pwm";
filter = (if (variant == "5") then "*pi5*" else "*rpi-4-b*");
dtsFile = (
if (variant == "5")
then "${pkgs.${namespace}.raspberrypi-overlays}/share/raspberrypi-overlays/pwm-pio-rp1.dts"
else "${pkgs.${namespace}.raspberrypi-overlays}/share/raspberrypi-overlays/pwm1-overlay.dts"
);
}
];
};
};
}