forked from NixOS/nixos-hardware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
touch-ft5406.nix
58 lines (51 loc) · 1.73 KB
/
touch-ft5406.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
52
53
54
55
56
57
58
{ config, lib, ... }:
let
cfg = config.hardware.raspberry-pi."4".touch-ft5406;
in
{
options.hardware = {
raspberry-pi."4".touch-ft5406 = {
enable = lib.mkEnableOption ''
Enable the touch controller of the official Raspberry Pi touch diplay.
The overlay is taken from the official Raspberry Pi Linux fork, and
the `compatible` field is updated to match the target device tree.
https://github.com/raspberrypi/linux/blob/14b35093ca68bf2c81bbc90aace5007142b40b40/arch/arm/boot/dts/overlays/rpi-ft5406-overlay.dts
For more information about the touch display, please refer to:
https://www.raspberrypi.com/documentation/accessories/display.html
'';
};
};
config = lib.mkIf cfg.enable {
hardware.deviceTree = {
overlays = [
{
name = "rpi-ft5406-overlay";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2711";
fragment@0 {
target-path = "/soc/firmware";
__overlay__ {
ts: touchscreen {
compatible = "raspberrypi,firmware-ts";
touchscreen-size-x = <800>;
touchscreen-size-y = <480>;
};
};
};
__overrides__ {
touchscreen-size-x = <&ts>,"touchscreen-size-x:0";
touchscreen-size-y = <&ts>,"touchscreen-size-y:0";
touchscreen-inverted-x = <&ts>,"touchscreen-inverted-x?";
touchscreen-inverted-y = <&ts>,"touchscreen-inverted-y?";
touchscreen-swapped-x-y = <&ts>,"touchscreen-swapped-x-y?";
};
};
'';
}
];
};
};
}