forked from NixOS/nixos-hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backlight.nix
51 lines (47 loc) · 1.36 KB
/
backlight.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ config, lib, ... }:
let
cfg = config.hardware.raspberry-pi."4".backlight;
in
{
options.hardware = {
raspberry-pi."4".backlight = {
enable = lib.mkEnableOption ''
Enable the backlight support for the Raspberry Pi official Touch Display
'';
};
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
# This overlay was originally taken from:
# https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts
# The only modification made was to change the compatible field to bcm2711
# this is the same as for the 5.15.y kernel
{
name = "rpi-backlight-overlay";
dtsText = ''
/*
* Devicetree overlay for mailbox-driven Raspberry Pi DSI Display
* backlight controller
*/
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
fragment@0 {
target-path = "/";
__overlay__ {
rpi_backlight: rpi_backlight {
compatible = "raspberrypi,rpi-backlight";
firmware = <&firmware>;
status = "okay";
};
};
};
};
'';
}
];
};
};
}