2023-03-26 00:38:01 +01:00
|
|
|
{ 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:
|
2023-05-12 17:57:39 +02:00
|
|
|
# https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts
|
2023-03-26 00:38:01 +01:00
|
|
|
# The only modification made was to change the compatible field to bcm2711
|
2023-05-12 17:57:39 +02:00
|
|
|
# this is the same as for the 5.15.y kernel
|
2023-03-26 00:38:01 +01:00
|
|
|
{
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|