1
0
Fork 0
mirror of https://github.com/NixOS/nixos-hardware synced 2024-11-23 03:19:42 +01:00

Merge pull request #383 from ettom/master

Add rpi4 pwm0 support
This commit is contained in:
Jörg Thalheim 2022-03-04 12:52:02 +00:00 committed by GitHub
commit a7bca8d0d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 0 deletions

View file

@ -8,6 +8,7 @@
./modesetting.nix
./poe-hat.nix
./tc358743.nix
./pwm0.nix
];
boot = {

50
raspberry-pi/4/pwm0.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
let
cfg = config.hardware.raspberry-pi."4".pwm0;
in
{
options.hardware = {
raspberry-pi."4".pwm0 = {
enable = lib.mkEnableOption ''
Enable support for the hardware pwm0 channel on GPIO_18
'';
};
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [{
name = "pwm-overlay";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
fragment@0 {
target = <&gpio>;
__overlay__ {
pwm_pins: pwm_pins {
brcm,pins = <18>;
brcm,function = <2>; /* Alt5 */
};
};
};
fragment@1 {
target = <&pwm>;
__overlay__ {
pinctrl-names = "default";
assigned-clock-rates = <100000000>;
status = "okay";
pinctrl-0 = <&pwm_pins>;
};
};
};
'';
}];
};
};
}