1/*
2 * Copyright 2017 Lothar Waßmann <LW@KARO-electronics.de>
3 *
4 * This file is dual-licensed: you can use it either under the terms
5 * of the GPL or the X11 license, at your option. Note that this dual
6 * licensing only applies to this file, and not this project as a
7 * whole.
8 *
9 *  a) This file is free software; you can redistribute it and/or
10 *     modify it under the terms of the GNU General Public License
11 *     version 2 as published by the Free Software Foundation.
12 *
13 *     This file is distributed in the hope that it will be useful,
14 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *     GNU General Public License for more details.
17 *
18 * Or, alternatively,
19 *
20 *  b) Permission is hereby granted, free of charge, to any person
21 *     obtaining a copy of this software and associated documentation
22 *     files (the "Software"), to deal in the Software without
23 *     restriction, including without limitation the rights to use,
24 *     copy, modify, merge, publish, distribute, sublicense, and/or
25 *     sell copies of the Software, and to permit persons to whom the
26 *     Software is furnished to do so, subject to the following
27 *     conditions:
28 *
29 *     The above copyright notice and this permission notice shall be
30 *     included in all copies or substantial portions of the Software.
31 *
32 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
34 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
35 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
36 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
37 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
38 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
39 *     OTHER DEALINGS IN THE SOFTWARE.
40 */
41
42/ {
43	aliases {
44		display = &display;
45	};
46
47	backlight: backlight {
48		compatible = "pwm-backlight";
49		pwms = <&pwm2 0 500000 PWM_POLARITY_INVERTED>;
50		pinctrl-names = "default";
51		pinctrl-0 = <&pinctrl_lcd1_pwr>;
52		enable-gpios = <&gpio2 31 GPIO_ACTIVE_HIGH>;
53		power-supply = <&reg_3v3>;
54		turn-on-delay-ms = <35>;
55		/*
56		 * a poor man's way to create a 1:1 relationship between
57		 * the PWM value and the actual duty cycle
58		 */
59		brightness-levels = < 0  1  2  3  4  5  6  7  8  9
60				     10 11 12 13 14 15 16 17 18 19
61				     20 21 22 23 24 25 26 27 28 29
62				     30 31 32 33 34 35 36 37 38 39
63				     40 41 42 43 44 45 46 47 48 49
64				     50 51 52 53 54 55 56 57 58 59
65				     60 61 62 63 64 65 66 67 68 69
66				     70 71 72 73 74 75 76 77 78 79
67				     80 81 82 83 84 85 86 87 88 89
68				     90 91 92 93 94 95 96 97 98 99
69				    100>;
70		default-brightness-level = <50>;
71	};
72
73	lcd_panel: lcd-panel {
74		compatible = "edt,etm0700g0dh6";
75		pinctrl-names = "default";
76		pinctrl-0 = <&pinctrl_lcd0_pwr>;
77		enable-gpios = <&gpio3 29 GPIO_ACTIVE_HIGH>;
78		power-supply = <&reg_3v3>;
79		backlight = <&backlight>;
80
81		port {
82			lcd_panel_in: endpoint {
83				remote-endpoint = <&lcd_out>;
84			};
85		};
86	};
87
88	display: disp0 {
89		compatible = "fsl,imx-parallel-display";
90		#address-cells = <1>;
91		#size-cells = <0>;
92		pinctrl-names = "default";
93		pinctrl-0 = <&pinctrl_disp0_1>;
94		status = "okay";
95
96		port@0 {
97			reg = <0>;
98
99			lcd_in: endpoint {
100				remote-endpoint = <&ipu1_di0_disp0>;
101			};
102		};
103
104		port@1 {
105			reg = <1>;
106
107			lcd_out: endpoint {
108				remote-endpoint = <&lcd_panel_in>;
109			};
110		};
111
112		display-timings {
113			VGA {
114				clock-frequency = <25200000>;
115				hactive = <640>;
116				vactive = <480>;
117				hback-porch = <48>;
118				hsync-len = <96>;
119				hfront-porch = <16>;
120				vback-porch = <31>;
121				vsync-len = <2>;
122				vfront-porch = <12>;
123				hsync-active = <0>;
124				vsync-active = <0>;
125				de-active = <1>;
126				pixelclk-active = <0>;
127			};
128
129			ETV570 {
130				u-boot,panel-name = "edt,et057090dhu";
131				clock-frequency = <25200000>;
132				hactive = <640>;
133				vactive = <480>;
134				hback-porch = <114>;
135				hsync-len = <30>;
136				hfront-porch = <16>;
137				vback-porch = <32>;
138				vsync-len = <3>;
139				vfront-porch = <10>;
140				hsync-active = <0>;
141				vsync-active = <0>;
142				de-active = <1>;
143				pixelclk-active = <0>;
144			};
145
146			ET0350 {
147				u-boot,panel-name = "edt,et0350g0dh6";
148				clock-frequency = <6413760>;
149				hactive = <320>;
150				vactive = <240>;
151				hback-porch = <34>;
152				hsync-len = <34>;
153				hfront-porch = <20>;
154				vback-porch = <15>;
155				vsync-len = <3>;
156				vfront-porch = <4>;
157				hsync-active = <0>;
158				vsync-active = <0>;
159				de-active = <1>;
160				pixelclk-active = <0>;
161			};
162
163			ET0430 {
164				u-boot,panel-name = "edt,et0430g0dh6";
165				clock-frequency = <9009000>;
166				hactive = <480>;
167				vactive = <272>;
168				hback-porch = <2>;
169				hsync-len = <41>;
170				hfront-porch = <2>;
171				vback-porch = <2>;
172				vsync-len = <10>;
173				vfront-porch = <2>;
174				hsync-active = <0>;
175				vsync-active = <0>;
176				de-active = <1>;
177				pixelclk-active = <1>;
178			};
179
180			ET0500 {
181				clock-frequency = <33264000>;
182				hactive = <800>;
183				vactive = <480>;
184				hback-porch = <88>;
185				hsync-len = <128>;
186				hfront-porch = <40>;
187				vback-porch = <33>;
188				vsync-len = <2>;
189				vfront-porch = <10>;
190				hsync-active = <0>;
191				vsync-active = <0>;
192				de-active = <1>;
193				pixelclk-active = <0>;
194			};
195
196			ET0700 { /* same as ET0500 */
197				u-boot,panel-name = "edt,etm0700g0dh6";
198				clock-frequency = <33264000>;
199				hactive = <800>;
200				vactive = <480>;
201				hback-porch = <88>;
202				hsync-len = <128>;
203				hfront-porch = <40>;
204				vback-porch = <33>;
205				vsync-len = <2>;
206				vfront-porch = <10>;
207				hsync-active = <0>;
208				vsync-active = <0>;
209				de-active = <1>;
210				pixelclk-active = <0>;
211			};
212
213			ETQ570 {
214				clock-frequency = <6596040>;
215				hactive = <320>;
216				vactive = <240>;
217				hback-porch = <38>;
218				hsync-len = <30>;
219				hfront-porch = <30>;
220				vback-porch = <16>;
221				vsync-len = <3>;
222				vfront-porch = <4>;
223				hsync-active = <0>;
224				vsync-active = <0>;
225				de-active = <1>;
226				pixelclk-active = <0>;
227			};
228
229			CoMTFT { /* same as ET0700 but with inverted pixel clock */
230				u-boot,panel-name = "edt,etm0700g0edh6";
231				clock-frequency = <33264000>;
232				hactive = <800>;
233				vactive = <480>;
234				hback-porch = <88>;
235				hsync-len = <128>;
236				hfront-porch = <40>;
237				vback-porch = <33>;
238				vsync-len = <2>;
239				vfront-porch = <10>;
240				hsync-active = <0>;
241				vsync-active = <0>;
242				de-active = <1>;
243				pixelclk-active = <1>;
244			};
245		};
246	};
247};
248
249&ipu1_di0_disp0 {
250	remote-endpoint = <&lcd_in>;
251};
252