summary refs log tree commit diff
path: root/dts/mhs35-overlay.dts
blob: e30e596dda5749668130aa723fd517ea4b6e4d79 (plain)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// SPDX-License-Identifier: GPL-2.0+
/*
 * device tree overlay for a goodtft mhs-3.5 raspberry pi spi display.
 *
 * for touch, see `./mhs35-touch-overlay.dts`!
 *
 * Copyright (c) 2026 Mel G. <mel@rnrd.eu>
 */

/dts-v1/;
/plugin/;

/ {
	compatible = "brcm,bcm2711";

	fragment@0 {
		target = <&spi0>;

		__overlay__ {
			status = "okay";

			spidev@0 {
				status = "disabled";
			};
		};
	};

	fragment@1 {
		target = <&gpio>;

		__overlay__ {
			mhs35_pins: mhs35_pins@0 {
				brcm,pins = <25 24>; // reset, dc
				brcm,function = <0 0>;
			};
		};
	};

	fragment@2 {
		target = <&spi0>;

		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;

			mhs35: mhs35@0 {
				compatible = "goodtft,mhs35";
				reg = <0>;
				pinctrl-names = "default";
				pinctrl-0 = <&mhs35_pins>;

				// very conservative default that works pretty well,
				// though is quite slow (you can see the screen update!)
				// according to spec, should go upto 125mhz.
				spi-max-frequency = <8000000>;

				// orientation relative to a raspberry pi 4:
				// 0 = landscape, usb/ethernet ports on left
				// 180 = landscape, ports on right
				// 90 = portrait, ports on top
				// 270 portrait, ports on bottom
				rotation = <180>;

				reset-gpios = <&gpio 25 1>;
				dc-gpios = <&gpio 24 0>;
			};
		};
	};

	__overrides__ {
		speed =    <&mhs35>,"spi-max-frequency:0";
		rotation = <&mhs35>,"rotation:0";
	};
};