1/*
2 * ubicom32lcd.h
3 *	Ubicom32 lcd panel drivers
4 *
5 * (C) Copyright 2009, Ubicom, Inc.
6 *
7 * This file is part of the Ubicom32 Linux Kernel Port.
8 *
9 * This Ubicom32 library is free software: you can redistribute
10 * it and/or modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation, either version 2 of the
12 * License, or (at your option) any later version.
13 *
14 * This Ubicom32 library is distributed in the hope that it
15 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
17 * the GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with the Ubicom32 Linux Kernel Port.  If not,
21 * see <http://www.gnu.org/licenses/>.
22 */
23
24#ifndef _UBICOM32LCD_H_
25#define _UBICOM32LCD_H_
26
27enum ubicom32lcd_op {
28	/*
29	 * Sleep for (data) ms
30	 */
31	LCD_STEP_SLEEP,
32
33	/*
34	 * Execute write of command
35	 */
36	LCD_STEP_CMD,
37
38	/*
39	 * Execute write of data
40	 */
41	LCD_STEP_DATA,
42
43	/*
44	 * Execute write of command/data
45	 */
46	LCD_STEP_CMD_DATA,
47
48	/*
49	 * Script done
50	 */
51	LCD_STEP_DONE,
52};
53
54struct ubicom32lcd_step {
55	enum ubicom32lcd_op		op;
56	u16				cmd;
57	u16				data;
58};
59
60struct ubicom32lcd_panel {
61	const struct ubicom32lcd_step	*init_seq;
62	const char			*desc;
63
64	u32				xres;
65	u32				yres;
66	u32				stride;
67	u32				flags;
68
69	u16				id;
70	u16				horz_reg;
71	u16				vert_reg;
72	u16				gram_reg;
73};
74
75#ifdef CONFIG_LCD_UBICOM32_CFAF240320KTTS
76static const struct ubicom32lcd_step cfaf240320ktts_init_0[] = {
77	{LCD_STEP_CMD_DATA, 0x0001, 0x0000,}, // Driver Output Control Register (R01h)		Page 14, SPFD5408B Datasheet
78	{LCD_STEP_CMD_DATA, 0x0002, 0x0700,}, // LCD Driving Waveform Control (R02h)		Page 15, SPFD5408B Datasheet
79	{LCD_STEP_CMD_DATA, 0x0003, 0x50A0,}, // Entry Mode (R03h)				0 degrees
80	{LCD_STEP_CMD_DATA, 0x0004, 0x0000,}, // Scaling Control register (R04h)		Page 16, SPFD5408B Datasheet
81	{LCD_STEP_CMD_DATA, 0x0008, 0x0207,}, // Display Control 2 (R08h)			Page 17, SPFD5408B Datasheet
82	{LCD_STEP_CMD_DATA, 0x0009, 0x0000,}, // Display Control 3 (R09h)			Page 18, SPFD5408B Datasheet
83	{LCD_STEP_CMD_DATA, 0x000A, 0x0000,}, // Frame Cycle Control (R0Ah)			Page 19, SPFD5408B Datasheet
84	{LCD_STEP_CMD_DATA, 0x000C, 0x0000,}, // External Display Interface Control 1 (R0Ch)	Page 20, SPFD5408B Datasheet
85	{LCD_STEP_CMD_DATA, 0x000D, 0x0000,}, // Frame Maker Position (R0Dh)			Page 21, SPFD5408B Datasheet
86	{LCD_STEP_CMD_DATA, 0x000F, 0x0000,}, // External Display Interface Control 2 (R0Fh)	Page 21, SPFD5408B Datasheet
87	{LCD_STEP_CMD_DATA, 0x0010, 0x0000,}, // Power Control 1 (R10h)				Page 22, SPFD5408B Datasheet
88	{LCD_STEP_CMD_DATA, 0x0011, 0x0007,}, // Power Control 2 (R11h)				Page 23, SPFD5408B Datasheet
89	{LCD_STEP_CMD_DATA, 0x0012, 0x0000,}, // Power Control 3 (R12h)				Page 24, SPFD5408B Datasheet
90	{LCD_STEP_CMD_DATA, 0x0013, 0x0000,}, // Power Control 4 (R13h)				Page 25, SPFD5408B Datasheet
91	{LCD_STEP_SLEEP, 0, 200},
92	{LCD_STEP_CMD_DATA, 0x0007, 0x0101,}, // Display Control (R07h)				Page 16, SPFD5408B Datasheet
93	{LCD_STEP_CMD_DATA, 0x0010, 0x12B0,}, // Power Control 1 (R10h)				Page 22, SPFD5408B Datasheet
94	{LCD_STEP_CMD_DATA, 0x0011, 0x0007,}, // Power Control 2 (R11h)				Page 23, SPFD5408B Datasheet
95	{LCD_STEP_CMD_DATA, 0x0012, 0x01BB,}, // Power Control 3 (R12h)				Page 24, SPFD5408B Datasheet
96	{LCD_STEP_SLEEP, 0, 50},
97	{LCD_STEP_CMD_DATA, 0x0013, 0x1300,}, // Power Control 4 (R13h)				Page 25, SPFD5408B Datasheet
98	{LCD_STEP_CMD_DATA, 0x0029, 0x0010,}, // NVM read data 2 (R29h)				Page 30, SPFD5408B Datasheet
99	{LCD_STEP_SLEEP, 0, 50},
100	{LCD_STEP_CMD_DATA, 0x0030, 0x000A,}, // Gamma Control 1       			 	Page 32, SPFD5408B Datasheet
101	{LCD_STEP_CMD_DATA, 0x0031, 0x1326,}, // Gamma Control 2       			 	Page 32, SPFD5408B Datasheet
102	{LCD_STEP_CMD_DATA, 0x0032, 0x0A29,}, // Gamma Control 3       			 	Page 32, SPFD5408B Datasheet
103	{LCD_STEP_CMD_DATA, 0x0033, 0x290A,}, // Gamma Control 4       			 	Page 32, SPFD5408B Datasheet
104	{LCD_STEP_CMD_DATA, 0x0034, 0x2613,}, // Gamma Control 5       			 	Page 32, SPFD5408B Datasheet
105	{LCD_STEP_CMD_DATA, 0x0035, 0x0A0A,}, // Gamma Control 6       			 	Page 32, SPFD5408B Datasheet
106	{LCD_STEP_CMD_DATA, 0x0036, 0x1E03,}, // Gamma Control 7       			 	Page 32, SPFD5408B Datasheet
107	{LCD_STEP_CMD_DATA, 0x0037, 0x031E,}, // Gamma Control 8       			 	Page 32, SPFD5408B Datasheet
108	{LCD_STEP_CMD_DATA, 0x0038, 0x0706,}, // Gamma Control 9       			 	Page 32, SPFD5408B Datasheet
109	{LCD_STEP_CMD_DATA, 0x0039, 0x0303,}, // Gamma Control 10      			 	Page 32, SPFD5408B Datasheet
110	{LCD_STEP_CMD_DATA, 0x003A, 0x0E04,}, // Gamma Control 11      			 	Page 32, SPFD5408B Datasheet
111	{LCD_STEP_CMD_DATA, 0x003B, 0x0E01,}, // Gamma Control 12      			 	Page 32, SPFD5408B Datasheet
112	{LCD_STEP_CMD_DATA, 0x003C, 0x010E,}, // Gamma Control 13      			 	Page 32, SPFD5408B Datasheet
113	{LCD_STEP_CMD_DATA, 0x003D, 0x040E,}, // Gamma Control 14      			 	Page 32, SPFD5408B Datasheet
114	{LCD_STEP_CMD_DATA, 0x003E, 0x0303,}, // Gamma Control 15      			 	Page 32, SPFD5408B Datasheet
115	{LCD_STEP_CMD_DATA, 0x003F, 0x0607,}, // Gamma Control 16      			 	Page 32, SPFD5408B Datasheet
116	{LCD_STEP_CMD_DATA, 0x0050, 0x0000,}, // Window Horizontal RAM Address Start (R50h)	Page 32, SPFD5408B Datasheet
117	{LCD_STEP_CMD_DATA, 0x0051, 0x00EF,}, // Window Horizontal RAM Address End (R51h)	Page 32, SPFD5408B Datasheet
118	{LCD_STEP_CMD_DATA, 0x0052, 0x0000,}, // Window Vertical RAM Address Start (R52h)	Page 33, SPFD5408B Datasheet
119	{LCD_STEP_CMD_DATA, 0x0053, 0x013F,}, // Window Vertical RAM Address End (R53h)		Page 33, SPFD5408B Datasheet
120	{LCD_STEP_CMD_DATA, 0x0060, 0x2700,}, // Driver Output Control (R60h)			Page 33, SPFD5408B Datasheet
121	{LCD_STEP_CMD_DATA, 0x0061, 0x0001,}, // Driver Output Control (R61h)			Page 35, SPFD5408B Datasheet
122	{LCD_STEP_CMD_DATA, 0x006A, 0x0000,}, // Vertical Scroll Control (R6Ah)			Page 35, SPFD5408B Datasheet
123	{LCD_STEP_CMD_DATA, 0x0080, 0x0000,}, // Display Position - Partial Display 1 (R80h)	Page 35, SPFD5408B Datasheet
124	{LCD_STEP_CMD_DATA, 0x0081, 0x0000,}, // RAM Address Start - Partial Display 1 (R81h)	Page 35, SPFD5408B Datasheet
125	{LCD_STEP_CMD_DATA, 0x0082, 0x0000,}, // RAM Address End - Partial Display 1 (R82h)	Page 36, SPFD5408B Datasheet
126	{LCD_STEP_CMD_DATA, 0x0083, 0x0000,}, // Display Position - Partial Display 2 (R83h)	Page 36, SPFD5408B Datasheet
127	{LCD_STEP_CMD_DATA, 0x0084, 0x0000,}, // RAM Address Start - Partial Display 2 (R84h)	Page 36, SPFD5408B Datasheet
128	{LCD_STEP_CMD_DATA, 0x0085, 0x0000,}, // RAM Address End - Partial Display 2 (R85h)	Page 36, SPFD5408B Datasheet
129	{LCD_STEP_CMD_DATA, 0x0090, 0x0010,}, // Panel Interface Control 1 (R90h)		Page 36, SPFD5408B Datasheet
130	{LCD_STEP_CMD_DATA, 0x0092, 0x0000,}, // Panel Interface Control 2 (R92h)		Page 37, SPFD5408B Datasheet
131	{LCD_STEP_CMD_DATA, 0x0093, 0x0103,}, // Panel Interface control 3 (R93h)		Page 38, SPFD5408B Datasheet
132	{LCD_STEP_CMD_DATA, 0x0095, 0x0210,}, // Panel Interface control 4 (R95h)		Page 38, SPFD5408B Datasheet
133	{LCD_STEP_CMD_DATA, 0x0097, 0x0000,}, // Panel Interface Control 5 (R97h)		Page 40, SPFD5408B Datasheet
134	{LCD_STEP_CMD_DATA, 0x0098, 0x0000,}, // Panel Interface Control 6 (R98h)		Page 41, SPFD5408B Datasheet
135	{LCD_STEP_CMD_DATA, 0x0007, 0x0173,}, // Display Control (R07h)				Page 16, SPFD5408B Datasheet
136	{LCD_STEP_DONE, 0, 0},
137};
138
139const struct ubicom32lcd_panel cfaf240320ktts_0 = {
140	.desc		= "CFAF240320KTTS",
141	.init_seq	= cfaf240320ktts_init_0,
142	.horz_reg	= 0x20,
143	.vert_reg	= 0x21,
144	.gram_reg	= 0x22,
145	.xres		= 240,
146	.yres		= 320,
147	.stride		= 240,
148	.id		= 0x5408,
149};
150#endif
151
152#ifdef CONFIG_LCD_UBICOM32_CFAF240320KTTS_180
153static const struct ubicom32lcd_step cfaf240320ktts_init_180[] = {
154	{LCD_STEP_CMD_DATA, 0x0001, 0x0000,}, // Driver Output Control Register (R01h)		Page 14, SPFD5408B Datasheet
155	{LCD_STEP_CMD_DATA, 0x0002, 0x0700,}, // LCD Driving Waveform Control (R02h)		Page 15, SPFD5408B Datasheet
156	{LCD_STEP_CMD_DATA, 0x0003, 0x5000,}, // Entry Mode (R03h)				180 degrees
157	{LCD_STEP_CMD_DATA, 0x0004, 0x0000,}, // Scaling Control register (R04h)		Page 16, SPFD5408B Datasheet
158	{LCD_STEP_CMD_DATA, 0x0008, 0x0207,}, // Display Control 2 (R08h)			Page 17, SPFD5408B Datasheet
159	{LCD_STEP_CMD_DATA, 0x0009, 0x0000,}, // Display Control 3 (R09h)			Page 18, SPFD5408B Datasheet
160	{LCD_STEP_CMD_DATA, 0x000A, 0x0000,}, // Frame Cycle Control (R0Ah)			Page 19, SPFD5408B Datasheet
161	{LCD_STEP_CMD_DATA, 0x000C, 0x0000,}, // External Display Interface Control 1 (R0Ch)	Page 20, SPFD5408B Datasheet
162	{LCD_STEP_CMD_DATA, 0x000D, 0x0000,}, // Frame Maker Position (R0Dh)			Page 21, SPFD5408B Datasheet
163	{LCD_STEP_CMD_DATA, 0x000F, 0x0000,}, // External Display Interface Control 2 (R0Fh)	Page 21, SPFD5408B Datasheet
164	{LCD_STEP_CMD_DATA, 0x0010, 0x0000,}, // Power Control 1 (R10h)				Page 22, SPFD5408B Datasheet
165	{LCD_STEP_CMD_DATA, 0x0011, 0x0007,}, // Power Control 2 (R11h)				Page 23, SPFD5408B Datasheet
166	{LCD_STEP_CMD_DATA, 0x0012, 0x0000,}, // Power Control 3 (R12h)				Page 24, SPFD5408B Datasheet
167	{LCD_STEP_CMD_DATA, 0x0013, 0x0000,}, // Power Control 4 (R13h)				Page 25, SPFD5408B Datasheet
168	{LCD_STEP_SLEEP, 0, 200},
169	{LCD_STEP_CMD_DATA, 0x0007, 0x0101,}, // Display Control (R07h)				Page 16, SPFD5408B Datasheet
170	{LCD_STEP_CMD_DATA, 0x0010, 0x12B0,}, // Power Control 1 (R10h)				Page 22, SPFD5408B Datasheet
171	{LCD_STEP_CMD_DATA, 0x0011, 0x0007,}, // Power Control 2 (R11h)				Page 23, SPFD5408B Datasheet
172	{LCD_STEP_CMD_DATA, 0x0012, 0x01BB,}, // Power Control 3 (R12h)				Page 24, SPFD5408B Datasheet
173	{LCD_STEP_SLEEP, 0, 50},
174	{LCD_STEP_CMD_DATA, 0x0013, 0x1300,}, // Power Control 4 (R13h)				Page 25, SPFD5408B Datasheet
175	{LCD_STEP_CMD_DATA, 0x0029, 0x0010,}, // NVM read data 2 (R29h)				Page 30, SPFD5408B Datasheet
176	{LCD_STEP_SLEEP, 0, 50},
177	{LCD_STEP_CMD_DATA, 0x0030, 0x000A,}, // Gamma Control 1       			 	Page 32, SPFD5408B Datasheet
178	{LCD_STEP_CMD_DATA, 0x0031, 0x1326,}, // Gamma Control 2       			 	Page 32, SPFD5408B Datasheet
179	{LCD_STEP_CMD_DATA, 0x0032, 0x0A29,}, // Gamma Control 3       			 	Page 32, SPFD5408B Datasheet
180	{LCD_STEP_CMD_DATA, 0x0033, 0x290A,}, // Gamma Control 4       			 	Page 32, SPFD5408B Datasheet
181	{LCD_STEP_CMD_DATA, 0x0034, 0x2613,}, // Gamma Control 5       			 	Page 32, SPFD5408B Datasheet
182	{LCD_STEP_CMD_DATA, 0x0035, 0x0A0A,}, // Gamma Control 6       			 	Page 32, SPFD5408B Datasheet
183	{LCD_STEP_CMD_DATA, 0x0036, 0x1E03,}, // Gamma Control 7       			 	Page 32, SPFD5408B Datasheet
184	{LCD_STEP_CMD_DATA, 0x0037, 0x031E,}, // Gamma Control 8       			 	Page 32, SPFD5408B Datasheet
185	{LCD_STEP_CMD_DATA, 0x0038, 0x0706,}, // Gamma Control 9       			 	Page 32, SPFD5408B Datasheet
186	{LCD_STEP_CMD_DATA, 0x0039, 0x0303,}, // Gamma Control 10      			 	Page 32, SPFD5408B Datasheet
187	{LCD_STEP_CMD_DATA, 0x003A, 0x0E04,}, // Gamma Control 11      			 	Page 32, SPFD5408B Datasheet
188	{LCD_STEP_CMD_DATA, 0x003B, 0x0E01,}, // Gamma Control 12      			 	Page 32, SPFD5408B Datasheet
189	{LCD_STEP_CMD_DATA, 0x003C, 0x010E,}, // Gamma Control 13      			 	Page 32, SPFD5408B Datasheet
190	{LCD_STEP_CMD_DATA, 0x003D, 0x040E,}, // Gamma Control 14      			 	Page 32, SPFD5408B Datasheet
191	{LCD_STEP_CMD_DATA, 0x003E, 0x0303,}, // Gamma Control 15      			 	Page 32, SPFD5408B Datasheet
192	{LCD_STEP_CMD_DATA, 0x003F, 0x0607,}, // Gamma Control 16      			 	Page 32, SPFD5408B Datasheet
193	{LCD_STEP_CMD_DATA, 0x0050, 0x0000,}, // Window Horizontal RAM Address Start (R50h)	Page 32, SPFD5408B Datasheet
194	{LCD_STEP_CMD_DATA, 0x0051, 0x00EF,}, // Window Horizontal RAM Address End (R51h)	Page 32, SPFD5408B Datasheet
195	{LCD_STEP_CMD_DATA, 0x0052, 0x0000,}, // Window Vertical RAM Address Start (R52h)	Page 33, SPFD5408B Datasheet
196	{LCD_STEP_CMD_DATA, 0x0053, 0x013F,}, // Window Vertical RAM Address End (R53h)		Page 33, SPFD5408B Datasheet
197	{LCD_STEP_CMD_DATA, 0x0060, 0x2700,}, // Driver Output Control (R60h)			Page 33, SPFD5408B Datasheet
198	{LCD_STEP_CMD_DATA, 0x0061, 0x0001,}, // Driver Output Control (R61h)			Page 35, SPFD5408B Datasheet
199	{LCD_STEP_CMD_DATA, 0x006A, 0x0000,}, // Vertical Scroll Control (R6Ah)			Page 35, SPFD5408B Datasheet
200	{LCD_STEP_CMD_DATA, 0x0080, 0x0000,}, // Display Position - Partial Display 1 (R80h)	Page 35, SPFD5408B Datasheet
201	{LCD_STEP_CMD_DATA, 0x0081, 0x0000,}, // RAM Address Start - Partial Display 1 (R81h)	Page 35, SPFD5408B Datasheet
202	{LCD_STEP_CMD_DATA, 0x0082, 0x0000,}, // RAM Address End - Partial Display 1 (R82h)	Page 36, SPFD5408B Datasheet
203	{LCD_STEP_CMD_DATA, 0x0083, 0x0000,}, // Display Position - Partial Display 2 (R83h)	Page 36, SPFD5408B Datasheet
204	{LCD_STEP_CMD_DATA, 0x0084, 0x0000,}, // RAM Address Start - Partial Display 2 (R84h)	Page 36, SPFD5408B Datasheet
205	{LCD_STEP_CMD_DATA, 0x0085, 0x0000,}, // RAM Address End - Partial Display 2 (R85h)	Page 36, SPFD5408B Datasheet
206	{LCD_STEP_CMD_DATA, 0x0090, 0x0010,}, // Panel Interface Control 1 (R90h)		Page 36, SPFD5408B Datasheet
207	{LCD_STEP_CMD_DATA, 0x0092, 0x0000,}, // Panel Interface Control 2 (R92h)		Page 37, SPFD5408B Datasheet
208	{LCD_STEP_CMD_DATA, 0x0093, 0x0103,}, // Panel Interface control 3 (R93h)		Page 38, SPFD5408B Datasheet
209	{LCD_STEP_CMD_DATA, 0x0095, 0x0210,}, // Panel Interface control 4 (R95h)		Page 38, SPFD5408B Datasheet
210	{LCD_STEP_CMD_DATA, 0x0097, 0x0000,}, // Panel Interface Control 5 (R97h)		Page 40, SPFD5408B Datasheet
211	{LCD_STEP_CMD_DATA, 0x0098, 0x0000,}, // Panel Interface Control 6 (R98h)		Page 41, SPFD5408B Datasheet
212	{LCD_STEP_CMD_DATA, 0x0007, 0x0173,}, // Display Control (R07h)				Page 16, SPFD5408B Datasheet
213	{LCD_STEP_DONE, 0, 0},
214};
215
216const struct ubicom32lcd_panel cfaf240320ktts_180 = {
217	.desc		= "CFAF240320KTTS 180",
218	.init_seq	= cfaf240320ktts_init_180,
219	.horz_reg	= 0x20,
220	.vert_reg	= 0x21,
221	.gram_reg	= 0x22,
222	.xres		= 240,
223	.yres		= 320,
224	.stride		= 240,
225	.id		= 0x5408,
226};
227#endif
228
229#ifdef CONFIG_LCD_UBICOM32_TFT2N0369E_P
230static const struct ubicom32lcd_step tft2n0369ep_init[] = {
231	{LCD_STEP_CMD_DATA, 0x0028, 0x0006},
232	{LCD_STEP_CMD_DATA, 0x0000, 0x0001},
233	{LCD_STEP_SLEEP, 0, 15},
234	{LCD_STEP_CMD_DATA, 0x002B, 0x9532},
235	{LCD_STEP_CMD_DATA, 0x0003, 0xAAAC},
236	{LCD_STEP_CMD_DATA, 0x000C, 0x0002},
237	{LCD_STEP_CMD_DATA, 0x000D, 0x000A},
238	{LCD_STEP_CMD_DATA, 0x000E, 0x2C00},
239	{LCD_STEP_CMD_DATA, 0x001E, 0x00AA},
240	{LCD_STEP_CMD_DATA, 0x0025, 0x8000},
241	{LCD_STEP_SLEEP, 0, 15},
242	{LCD_STEP_CMD_DATA, 0x0001, 0x2B3F},
243	{LCD_STEP_CMD_DATA, 0x0002, 0x0600},
244	{LCD_STEP_CMD_DATA, 0x0010, 0x0000},
245	{LCD_STEP_CMD_DATA, 0x0011, 0x6030},
246	{LCD_STEP_SLEEP, 0, 20},
247	{LCD_STEP_CMD_DATA, 0x0005, 0x0000},
248	{LCD_STEP_CMD_DATA, 0x0006, 0x0000},
249	{LCD_STEP_CMD_DATA, 0x0016, 0xEF1C},
250	{LCD_STEP_CMD_DATA, 0x0017, 0x0003},
251	{LCD_STEP_CMD_DATA, 0x0007, 0x0233},
252	{LCD_STEP_CMD_DATA, 0x000B, 0x5312},
253	{LCD_STEP_CMD_DATA, 0x000F, 0x0000},
254	{LCD_STEP_SLEEP, 0, 20},
255	{LCD_STEP_CMD_DATA, 0x0041, 0x0000},
256	{LCD_STEP_CMD_DATA, 0x0042, 0x0000},
257	{LCD_STEP_CMD_DATA, 0x0048, 0x0000},
258	{LCD_STEP_CMD_DATA, 0x0049, 0x013F},
259	{LCD_STEP_CMD_DATA, 0x0044, 0xEF00},
260	{LCD_STEP_CMD_DATA, 0x0045, 0x0000},
261	{LCD_STEP_CMD_DATA, 0x0046, 0x013F},
262	{LCD_STEP_CMD_DATA, 0x004A, 0x0000},
263	{LCD_STEP_CMD_DATA, 0x004B, 0x0000},
264	{LCD_STEP_SLEEP, 0, 20},
265	{LCD_STEP_CMD_DATA, 0x0030, 0x0707},
266	{LCD_STEP_CMD_DATA, 0x0031, 0x0704},
267	{LCD_STEP_CMD_DATA, 0x0032, 0x0204},
268	{LCD_STEP_CMD_DATA, 0x0033, 0x0201},
269	{LCD_STEP_CMD_DATA, 0x0034, 0x0203},
270	{LCD_STEP_CMD_DATA, 0x0035, 0x0204},
271	{LCD_STEP_CMD_DATA, 0x0036, 0x0204},
272	{LCD_STEP_CMD_DATA, 0x0037, 0x0502},
273	{LCD_STEP_CMD_DATA, 0x003A, 0x0302},
274	{LCD_STEP_CMD_DATA, 0x003B, 0x0500},
275	{LCD_STEP_SLEEP, 0, 20},
276	{LCD_STEP_CMD_DATA, 0x0044, 239 << 8 | 0},
277	{LCD_STEP_CMD_DATA, 0x0045, 0x0000},
278	{LCD_STEP_CMD_DATA, 0x0046, 319},
279	{LCD_STEP_DONE, 0, 0},
280};
281
282const struct ubicom32lcd_panel tft2n0369ep = {
283	.desc		= "TFT2N0369E-Portrait",
284	.init_seq	= tft2n0369ep_init,
285	.horz_reg	= 0x4e,
286	.vert_reg	= 0x4f,
287	.gram_reg	= 0x22,
288	.xres		= 240,
289	.yres		= 320,
290	.stride		= 240,
291	.id		= 0x8989,
292};
293#endif
294
295#ifdef CONFIG_LCD_UBICOM32_TFT2N0369E_L
296static const struct ubicom32lcd_step tft2n0369e_init[] = {
297	{LCD_STEP_CMD_DATA, 0x0028, 0x0006},
298	{LCD_STEP_CMD_DATA, 0x0000, 0x0001},
299	{LCD_STEP_SLEEP, 0, 15},
300	{LCD_STEP_CMD_DATA, 0x002B, 0x9532},
301	{LCD_STEP_CMD_DATA, 0x0003, 0xAAAC},
302	{LCD_STEP_CMD_DATA, 0x000C, 0x0002},
303	{LCD_STEP_CMD_DATA, 0x000D, 0x000A},
304	{LCD_STEP_CMD_DATA, 0x000E, 0x2C00},
305	{LCD_STEP_CMD_DATA, 0x001E, 0x00AA},
306	{LCD_STEP_CMD_DATA, 0x0025, 0x8000},
307	{LCD_STEP_SLEEP, 0, 15},
308	{LCD_STEP_CMD_DATA, 0x0001, 0x2B3F},
309	{LCD_STEP_CMD_DATA, 0x0002, 0x0600},
310	{LCD_STEP_CMD_DATA, 0x0010, 0x0000},
311	{LCD_STEP_CMD_DATA, 0x0011, 0x60A8},
312	{LCD_STEP_SLEEP, 0, 20},
313	{LCD_STEP_CMD_DATA, 0x0005, 0x0000},
314	{LCD_STEP_CMD_DATA, 0x0006, 0x0000},
315	{LCD_STEP_CMD_DATA, 0x0016, 0xEF1C},
316	{LCD_STEP_CMD_DATA, 0x0017, 0x0003},
317	{LCD_STEP_CMD_DATA, 0x0007, 0x0233},
318	{LCD_STEP_CMD_DATA, 0x000B, 0x5312},
319	{LCD_STEP_CMD_DATA, 0x000F, 0x0000},
320	{LCD_STEP_SLEEP, 0, 20},
321	{LCD_STEP_CMD_DATA, 0x0041, 0x0000},
322	{LCD_STEP_CMD_DATA, 0x0042, 0x0000},
323	{LCD_STEP_CMD_DATA, 0x0048, 0x0000},
324	{LCD_STEP_CMD_DATA, 0x0049, 0x013F},
325	{LCD_STEP_CMD_DATA, 0x0044, 0xEF00},
326	{LCD_STEP_CMD_DATA, 0x0045, 0x0000},
327	{LCD_STEP_CMD_DATA, 0x0046, 0x013F},
328	{LCD_STEP_CMD_DATA, 0x004A, 0x0000},
329	{LCD_STEP_CMD_DATA, 0x004B, 0x0000},
330	{LCD_STEP_SLEEP, 0, 20},
331	{LCD_STEP_CMD_DATA, 0x0030, 0x0707},
332	{LCD_STEP_CMD_DATA, 0x0031, 0x0704},
333	{LCD_STEP_CMD_DATA, 0x0032, 0x0204},
334	{LCD_STEP_CMD_DATA, 0x0033, 0x0201},
335	{LCD_STEP_CMD_DATA, 0x0034, 0x0203},
336	{LCD_STEP_CMD_DATA, 0x0035, 0x0204},
337	{LCD_STEP_CMD_DATA, 0x0036, 0x0204},
338	{LCD_STEP_CMD_DATA, 0x0037, 0x0502},
339	{LCD_STEP_CMD_DATA, 0x003A, 0x0302},
340	{LCD_STEP_CMD_DATA, 0x003B, 0x0500},
341	{LCD_STEP_SLEEP, 0, 20},
342	{LCD_STEP_CMD_DATA, 0x0044, 239 << 8 | 0},
343	{LCD_STEP_CMD_DATA, 0x0045, 0x0000},
344	{LCD_STEP_CMD_DATA, 0x0046, 319},
345	{LCD_STEP_DONE, 0, 0},
346};
347
348const struct ubicom32lcd_panel tft2n0369e = {
349	.desc		= "TFT2N0369E-Landscape",
350	.init_seq	= tft2n0369e_init,
351	.horz_reg	= 0x4e,
352	.vert_reg	= 0x4f,
353	.gram_reg	= 0x22,
354	.xres		= 320,
355	.yres		= 240,
356	.stride		= 320,
357	.id		= 0x8989,
358};
359#endif
360
361#ifdef CONFIG_LCD_UBICOM32_CFAF240400D
362static const struct ubicom32lcd_step cfaf240400d_init[] = {
363	{LCD_STEP_CMD_DATA, 0x0606, 0x0000},	// Pin Control (R606h)		// Page 41 of SPFD5420A Datasheet
364	{LCD_STEP_SLEEP, 0, 50},
365	{LCD_STEP_CMD_DATA, 0x0007, 0x0001},	// Display Control 1 (R007h)	// Page 16 of SPFD5420A Datasheet
366	{LCD_STEP_SLEEP, 0, 50},
367	{LCD_STEP_CMD_DATA, 0x0110, 0x0001},	// Power Control 6(R110h)	// Page 30 of SPFD5420A Datasheet
368	{LCD_STEP_SLEEP, 0, 50},
369	{LCD_STEP_CMD_DATA, 0x0100, 0x17B0},	// Power Control 1 (R100h)	// Page 26 of SPFD5420A Datasheet
370	{LCD_STEP_CMD_DATA, 0x0101, 0x0147},	// Power Control 2 (R101h)	// Page 27 of SPFD5420A Datasheet
371	{LCD_STEP_CMD_DATA, 0x0102, 0x019D},	// Power Control 3 (R102h)	// Page 28 of SPFD5420A Datasheet
372	{LCD_STEP_CMD_DATA, 0x0103, 0x3600},	// Power Control 4 (R103h)	// Page 29 of SPFD5420A Datasheet
373	{LCD_STEP_CMD_DATA, 0x0281, 0x0010},	// NVM read data 2 (R281h)  	// Page 34 of SPFD5420A Datasheet
374	{LCD_STEP_SLEEP, 0, 50},
375	{LCD_STEP_CMD_DATA, 0x0102, 0x01BD},	// Power Control 3 (R102h)	// Page 28 of SPFD5420A Datasheet
376	{LCD_STEP_SLEEP, 0, 50},
377
378	//--------------- Power control 1~6 ---------------//
379	{LCD_STEP_CMD_DATA, 0x0100, 0x16B0},	// Power Control 1 (R100h)	// Page 26 of SPFD5420A Datasheet
380	{LCD_STEP_CMD_DATA, 0x0101, 0x0147},	// Power Control 2 (R101h)	// Page 27 of SPFD5420A Datasheet
381	{LCD_STEP_CMD_DATA, 0x0102, 0x01BD},	// Power Control 3 (R102h)	// Page 28 of SPFD5420A Datasheet
382	{LCD_STEP_CMD_DATA, 0x0103, 0x2d00},	// Power Control 4 (R103h)	// Page 29 of SPFD5420A Datasheet
383	{LCD_STEP_CMD_DATA, 0x0107, 0x0000},	// Power Control 5 (R107h)	// Page 30 of SPFD5420A Datasheet
384	{LCD_STEP_CMD_DATA, 0x0110, 0x0001},	// Power Control 6(R110h)	// Page 30 of SPFD5420A Datasheet
385	{LCD_STEP_CMD_DATA, 0x0280, 0x0000},	// NVM read data 1 (R280h)	// Page 33 of SPFD5420A Datasheet
386	{LCD_STEP_CMD_DATA, 0x0281, 0x0006},	// NVM read data 2 (R281h)	// Page 34 of SPFD5420A Datasheet
387	{LCD_STEP_CMD_DATA, 0x0282, 0x0000},	// NVM read data 3 (R282h)	// Page 34 of SPFD5420A Datasheet
388
389	//------- Gamma 2.2 control (R300h to R30Fh) ------//
390	{LCD_STEP_CMD_DATA, 0x0300, 0x0101},
391	{LCD_STEP_CMD_DATA, 0x0301, 0x0b27},
392	{LCD_STEP_CMD_DATA, 0x0302, 0x132a},
393	{LCD_STEP_CMD_DATA, 0x0303, 0x2a13},
394	{LCD_STEP_CMD_DATA, 0x0304, 0x270b},
395	{LCD_STEP_CMD_DATA, 0x0305, 0x0101},
396	{LCD_STEP_CMD_DATA, 0x0306, 0x1205},
397	{LCD_STEP_CMD_DATA, 0x0307, 0x0512},
398	{LCD_STEP_CMD_DATA, 0x0308, 0x0005},
399	{LCD_STEP_CMD_DATA, 0x0309, 0x0003},
400	{LCD_STEP_CMD_DATA, 0x030A, 0x0f04},
401	{LCD_STEP_CMD_DATA, 0x030B, 0x0f00},
402	{LCD_STEP_CMD_DATA, 0x030C, 0x000f},
403	{LCD_STEP_CMD_DATA, 0x030D, 0x040f},
404	{LCD_STEP_CMD_DATA, 0x030E, 0x0300},
405	{LCD_STEP_CMD_DATA, 0x030F, 0x0500},
406
407	{LCD_STEP_CMD_DATA, 0x0400, 0x3500},	// Base Image Number of Line (R400h)		// Page 36 of SPFD5420A Datasheet
408	{LCD_STEP_CMD_DATA, 0x0401, 0x0001},	// Base Image Display Control (R401h)		// Page 39 of SPFD5420A Datasheet
409	{LCD_STEP_CMD_DATA, 0x0404, 0x0000},	// Based Image Vertical Scroll Control (R404h)	// Page 40 of SPFD5420A Datasheet
410
411	//--------------- Normal set ---------------//
412	{LCD_STEP_CMD_DATA, 0x0000, 0x0000},	// ID Read Register (R000h)			// Page 13 of SPFD5420A Datasheet
413	{LCD_STEP_CMD_DATA, 0x0001, 0x0100},	// Driver Output Control Register (R001h)	// Page 14 of SPFD5420A Datasheet
414	{LCD_STEP_CMD_DATA, 0x0002, 0x0100},	// LCD Driving Waveform Control (R002h)		// Page 14 of SPFD5420A Datasheet
415	{LCD_STEP_CMD_DATA, 0x0003, 0x1030},	// Entry Mode (R003h)				// Page 15 of SPFD5420A Datasheet
416	{LCD_STEP_CMD_DATA, 0x0006, 0x0000},	// Display Control 1 (R007h)			// Page 16 of SPFD5420A Datasheet
417	{LCD_STEP_CMD_DATA, 0x0008, 0x0808},	// Display Control 2 (R008h)			// Page 17 of SPFD5420A Datasheet
418	{LCD_STEP_CMD_DATA, 0x0009, 0x0001},	// Display Control 3 (R009h)			// Page 18 of SPFD5420A Datasheet
419	{LCD_STEP_CMD_DATA, 0x000B, 0x0010},	// Low Power Control (R00Bh)			// Page 19 of SPFD5420A Datasheet
420	{LCD_STEP_CMD_DATA, 0x000C, 0x0000},	// External Display Interface Control 1 (R00Ch)	// Page 19 of SPFD5420A Datasheet
421	{LCD_STEP_CMD_DATA, 0x000F, 0x0000},	// External Display Interface Control 2 (R00Fh)	// Page 20 of SPFD5420A Datasheet
422	{LCD_STEP_CMD_DATA, 0x0007, 0x0001},	// Display Control 1 (R007h)			// Page 16 of SPFD5420A Datasheet
423
424	//--------------- Panel interface control 1~6 ---------------//
425	{LCD_STEP_CMD_DATA, 0x0010, 0x0012},	// Panel Interface Control 1 (R010h)		// Page 20 of SPFD5420A Datasheet
426	{LCD_STEP_CMD_DATA, 0x0011, 0x0202},	// Panel Interface Control 2 (R011h)		// Page 21 of SPFD5420A Datasheet
427	{LCD_STEP_CMD_DATA, 0x0012, 0x0300},	// Panel Interface control 3 (R012h)		// Page 22 of SPFD5420A Datasheet
428	{LCD_STEP_CMD_DATA, 0x0020, 0x021E},	// Panel Interface control 4 (R020h)		// Page 22 of SPFD5420A Datasheet
429	{LCD_STEP_CMD_DATA, 0x0021, 0x0202},	// Panel Interface Control 5 (021Rh)		// Page 24 of SPFD5420A Datasheet
430	{LCD_STEP_CMD_DATA, 0x0022, 0x0100},	// Panel Interface Control 6 (R022h)		// Page 25 of SPFD5420A Datasheet
431	{LCD_STEP_CMD_DATA, 0x0090, 0x8000},	// Frame Marker Control (R090h)			// Page 25 of SPFD5420A Datasheet
432
433	//--------------- Partial display ---------------//
434	{LCD_STEP_CMD_DATA, 0x0210, 0x0000},	// Window Horizontal RAM Address Start (R210h)	// Page 35 of SPFD5420A Datasheet
435	{LCD_STEP_CMD_DATA, 0x0211, 0x00EF},	// Window Horziontal RAM Address End (R211h)	// Page 35 of SPFD5420A Datasheet
436	{LCD_STEP_CMD_DATA, 0x0212, 0x0000},	// Window Vertical RAM Address Start (R212h)	// Page 35 of SPFD5420A Datasheet
437	{LCD_STEP_CMD_DATA, 0x0213, 0x018F},	// Window Vertical RAM Address End (R213h)	// Page 35 of SPFD5420A Datasheet
438	{LCD_STEP_CMD_DATA, 0x0500, 0x0000},	// Display Position - Partial Display 1 (R500h)	// Page 40 of SPFD5420A Datasheet
439	{LCD_STEP_CMD_DATA, 0x0501, 0x0000},	// RAM Address Start - Partial Display 1 (R501h)// Page 40 of SPFD5420A Datasheet
440	{LCD_STEP_CMD_DATA, 0x0502, 0x0000},	// RAM Address End - Partail Display 1 (R502h)	// Page 40 of SPFD5420A Datasheet
441	{LCD_STEP_CMD_DATA, 0x0503, 0x0000},	// Display Position - Partial Display 2 (R503h)	// Page 40 of SPFD5420A Datasheet
442	{LCD_STEP_CMD_DATA, 0x0504, 0x0000},	// RAM Address Start . Partial Display 2 (R504h)// Page 41 of SPFD5420A Datasheet
443	{LCD_STEP_CMD_DATA, 0x0505, 0x0000},	// RAM Address End . Partial Display 2 (R505h)	// Page 41 of SPFD5420A Datasheet
444	{LCD_STEP_CMD_DATA, 0x0606, 0x0000},	// Pin Control (R606h)				// Page 41 of SPFD5420A Datasheet
445	{LCD_STEP_CMD_DATA, 0x06F0, 0x0000},	// NVM Access Control (R6F0h)			// Page 41 of SPFD5420A Datasheet
446	{LCD_STEP_CMD_DATA, 0x0007, 0x0173},	// Display Control 1 (R007h)			// Page 16 of SPFD5420A Datasheet
447	{LCD_STEP_SLEEP, 0, 50},
448	{LCD_STEP_CMD_DATA, 0x0007, 0x0171},	// Display Control 1 (R007h)			// Page 16 of SPFD5420A Datasheet
449	{LCD_STEP_SLEEP, 0, 10},
450	{LCD_STEP_CMD_DATA, 0x0007, 0x0173},	// Display Control 1 (R007h)			// Page 16 of SPFD5420A Datasheet
451	{LCD_STEP_DONE, 0, 0},
452};
453
454const struct ubicom32lcd_panel cfaf240400d = {
455	.desc		= "CFAF240400D",
456	.init_seq	= cfaf240400d_init,
457	.horz_reg	= 0x0200,
458	.vert_reg	= 0x0201,
459	.gram_reg	= 0x0202,
460	.xres		= 240,
461	.yres		= 400,
462	.stride		= 240,
463	.id		= 0x5420,
464};
465#endif
466
467#ifdef CONFIG_LCD_UBICOM32_CFAF240400F
468static const struct ubicom32lcd_step cfaf320240f_init[] = {
469	{LCD_STEP_CMD_DATA, 0x0028, 0x0006},	// VCOM OTP			 	Page 55-56 of SSD2119 datasheet
470	{LCD_STEP_CMD_DATA, 0x0000, 0x0001},	// start Oscillator		 	Page 36 of SSD2119 datasheet
471	{LCD_STEP_CMD_DATA, 0x0010, 0x0000},	// Sleep mode			 	Page 49 of SSD2119 datasheet
472	{LCD_STEP_CMD_DATA, 0x0001, 0x32EF},	// Driver Output Control	 	Page 36-39 of SSD2119 datasheet
473	{LCD_STEP_CMD_DATA, 0x0002, 0x0600},	// LCD Driving Waveform Control	 	Page 40-42 of SSD2119 datasheet
474	{LCD_STEP_CMD_DATA, 0x0003, 0x6A38},	// Power Control 1		 	Page 43-44 of SSD2119 datasheet
475	{LCD_STEP_CMD_DATA, 0x0011, 0x6870},	// Entry Mode			 	Page 50-52 of SSD2119 datasheet
476	{LCD_STEP_CMD_DATA, 0X000F, 0x0000},	// Gate Scan Position		 	Page 49 of SSD2119 datasheet
477	{LCD_STEP_CMD_DATA, 0X000B, 0x5308},	// Frame Cycle Control		 	Page 45 of SSD2119 datasheet
478	{LCD_STEP_CMD_DATA, 0x000C, 0x0003},	// Power Control 2		 	Page 47 of SSD2119 datasheet
479	{LCD_STEP_CMD_DATA, 0x000D, 0x000A},	// Power Control 3		 	Page 48 of SSD2119 datasheet
480	{LCD_STEP_CMD_DATA, 0x000E, 0x2E00},	// Power Control 4		 	Page 48 of SSD2119 datasheet
481	{LCD_STEP_CMD_DATA, 0x001E, 0x00BE},	// Power Control 5		 	Page 53 of SSD2119 datasheet
482	{LCD_STEP_CMD_DATA, 0x0025, 0x8000},	// Frame Frequency Control	 	Page 53 of SSD2119 datasheet
483	{LCD_STEP_CMD_DATA, 0x0026, 0x7800},	// Analog setting		 	Page 54 of SSD2119 datasheet
484	{LCD_STEP_CMD_DATA, 0x004E, 0x0000},	// Ram Address Set		 	Page 58 of SSD2119 datasheet
485	{LCD_STEP_CMD_DATA, 0x004F, 0x0000},	// Ram Address Set		 	Page 58 of SSD2119 datasheet
486	{LCD_STEP_CMD_DATA, 0x0012, 0x08D9},	// Sleep mode			 	Page 49 of SSD2119 datasheet
487
488	// Gamma Control (R30h to R3Bh) -- Page 56 of SSD2119 datasheet
489	{LCD_STEP_CMD_DATA, 0x0030, 0x0000},
490	{LCD_STEP_CMD_DATA, 0x0031, 0x0104},
491	{LCD_STEP_CMD_DATA, 0x0032, 0x0100},
492	{LCD_STEP_CMD_DATA, 0x0033, 0x0305},
493	{LCD_STEP_CMD_DATA, 0x0034, 0x0505},
494	{LCD_STEP_CMD_DATA, 0x0035, 0x0305},
495	{LCD_STEP_CMD_DATA, 0x0036, 0x0707},
496	{LCD_STEP_CMD_DATA, 0x0037, 0x0300},
497	{LCD_STEP_CMD_DATA, 0x003A, 0x1200},
498	{LCD_STEP_CMD_DATA, 0x003B, 0x0800},
499
500	{LCD_STEP_CMD_DATA, 0x0007, 0x0033},	// Display Control 			 Page 45 of SSD2119 datasheet
501
502	{LCD_STEP_CMD_DATA, 0x0044, 0xEF00},	// Vertical RAM address position	 Page 57 of SSD2119 datasheet
503	{LCD_STEP_CMD_DATA, 0x0045, 0x0000},	// Horizontal RAM address position 	 Page 57 of SSD2119 datasheet
504	{LCD_STEP_CMD_DATA, 0x0046, 0x013F},	// Horizontal RAM address position	 Page 57 of SSD2119 datasheet
505
506	{LCD_STEP_SLEEP, 0, 150},
507
508	{LCD_STEP_DONE, 0, 0},
509};
510
511const struct ubicom32lcd_panel cfaf320240f = {
512	.desc		= "CFAF320240F",
513	.init_seq	= cfaf320240f_init,
514	.horz_reg	= 0x4e,
515	.vert_reg	= 0x4f,
516	.gram_reg	= 0x22,
517	.xres		= 320,
518	.yres		= 240,
519	.stride		= 320,
520	.id		= 0x9919,
521};
522#endif
523
524const struct ubicom32lcd_panel *ubicom32lcd_panels[] = {
525#ifdef CONFIG_LCD_UBICOM32_CFAF240400KTTS_180
526	&cfaf240320ktts_180,
527#endif
528#ifdef CONFIG_LCD_UBICOM32_CFAF240400KTTS
529	&cfaf240320ktts_0,
530#endif
531#ifdef CONFIG_LCD_UBICOM32_CFAF240400D
532	&cfaf240400d,
533#endif
534#ifdef CONFIG_LCD_UBICOM32_TFT2N0369E_P
535	&tft2n0369ep,
536#endif
537#ifdef CONFIG_LCD_UBICOM32_TFT2N0369E_L
538	&tft2n0369e,
539#endif
540#ifdef CONFIG_LCD_UBICOM32_CFAF240400F
541	&cfaf320240f,
542#endif
543	NULL,
544};
545
546#endif
547