2 * LCD panel driver for Board based on S5PC100 and S5PC110.
4 * Author: Donghwa Lee <dh09.lee@samsung.com>
6 * Derived from drivers/video/omap/lcd-apollon.c
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include <linux/types.h>
26 #include <asm/arch/cpu.h>
27 #include <asm/arch/gpio.h>
30 /* these machine specific platform data would be setting at universal.c */
31 struct spi_platform_data *ld9040;
33 static const unsigned char SEQ_SWRESET[] = {
37 static const unsigned char SEQ_USER_SETTING[] = {
43 static const unsigned char SEQ_ELVSS[] = {
50 static const unsigned char SEQ_GTCON[] = {
57 static const unsigned char SEQ_GAMMA_SET1[] = {
82 static const unsigned char SEQ_GAMMA_CTRL[] = {
88 static const unsigned char SEQ_APON[] = {
97 static const unsigned char SEQ_DISPCTL[] = {
106 static const unsigned char SEQ_SLPOUT[] = {
110 static const unsigned char SEQ_SLPIN[] = {
114 static const unsigned char SEQ_DISPON[] = {
118 static const unsigned char SEQ_DISPOFF[] = {
122 static const unsigned char SEQ_VCI1_1ST_EN[] = {
131 static const unsigned char SEQ_VL1_EN[] = {
140 static const unsigned char SEQ_VL2_EN[] = {
149 static const unsigned char SEQ_VCI1_2ND_EN[] = {
158 static const unsigned char SEQ_VL3_EN[] = {
167 static const unsigned char SEQ_VREG1_AMP_EN[] = {
176 static const unsigned char SEQ_VGH_AMP_EN[] = {
185 static const unsigned char SEQ_VGL_AMP_EN[] = {
194 static const unsigned char SEQ_VMOS_AMP_EN[] = {
203 static const unsigned char SEQ_VINT_AMP_EN[] = {
207 /* DATA_ONLY, 0x71, VMOS/VBL/VBH not used */
211 /* DATA_ONLY, 0x02, VMOS/VBL/VBH not used */
214 static const unsigned char SEQ_VBH_AMP_EN[] = {
223 static const unsigned char SEQ_VBL_AMP_EN[] = {
232 static const unsigned char SEQ_GAM_AMP_EN[] = {
236 /* DATA_ONLY, 0x73, VMOS/VBL/VBH not used */
240 /* DATA_ONLY, 0x02, VMOS/VBL/VBH not used */
243 static const unsigned char SEQ_SD_AMP_EN[] = {
247 /* DATA_ONLY, 0x73, VMOS/VBL/VBH not used */
251 /* DATA_ONLY, 0x02, VMOS/VBL/VBH not used */
254 static const unsigned char SEQ_GLS_EN[] = {
258 /* DATA_ONLY, 0x73, VMOS/VBL/VBH not used */
262 /* DATA_ONLY, 0x02, VMOS/VBL/VBH not used */
265 static const unsigned char SEQ_ELS_EN[] = {
269 /* DATA_ONLY, 0x73, VMOS/VBL/VBH not used */
273 /* DATA_ONLY, 0x02, VMOS/VBL/VBH not used */
276 static const unsigned char SEQ_EL_ON[] = {
280 /* DATA_ONLY, 0x73, VMOS/VBL/VBH not used */
284 /* DATA_ONLY, 0x02, VMOS/VBL/VBH not used */
287 static void ld9040_spi_write(unsigned char address, unsigned char command)
289 if (address != DATA_ONLY)
290 spi_write_byte(ld9040, 0x0, address);
292 if (command != COMMAND_ONLY)
293 spi_write_byte(ld9040, 0x1, command);
296 static void ld9040_panel_send_sequence(const unsigned char *wbuf, unsigned int size_cmd)
299 while (i < size_cmd) {
300 ld9040_spi_write(wbuf[i], wbuf[i+1]);
305 void ld9040_cfg_ldo(void)
308 /* SMD power on sequence */
309 ld9040_panel_send_sequence(SEQ_USER_SETTING, ARRAY_SIZE(SEQ_USER_SETTING));
310 ld9040_panel_send_sequence(SEQ_ELVSS, ARRAY_SIZE(SEQ_ELVSS));
311 ld9040_panel_send_sequence(SEQ_GTCON, ARRAY_SIZE(SEQ_GTCON));
312 ld9040_panel_send_sequence(SEQ_GAMMA_SET1, ARRAY_SIZE(SEQ_GAMMA_SET1));
313 ld9040_panel_send_sequence(SEQ_GAMMA_CTRL, ARRAY_SIZE(SEQ_GAMMA_CTRL));
314 ld9040_panel_send_sequence(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
319 /* Auto power on sequence */
320 ld9040_panel_send_sequence(SEQ_USER_SETTING, ARRAY_SIZE(SEQ_USER_SETTING));
321 ld9040_panel_send_sequence(SEQ_ELVSS, ARRAY_SIZE(SEQ_ELVSS));
322 ld9040_panel_send_sequence(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
326 /* Manual power on sequence */
327 ld9040_panel_send_sequence(SEQ_SWRESET, ARRAY_SIZE(SEQ_SWRESET));
328 ld9040_panel_send_sequence(SEQ_USER_SETTING, ARRAY_SIZE(SEQ_USER_SETTING));
329 ld9040_panel_send_sequence(SEQ_ELVSS, ARRAY_SIZE(SEQ_ELVSS));
330 ld9040_panel_send_sequence(SEQ_SLPOUT, ARRAY_SIZE(SEQ_SLPOUT));
331 ld9040_panel_send_sequence(SEQ_VCI1_1ST_EN, ARRAY_SIZE(SEQ_VCI1_1ST_EN));
333 ld9040_panel_send_sequence(SEQ_VL1_EN, ARRAY_SIZE(SEQ_VL1_EN));
335 ld9040_panel_send_sequence(SEQ_VL2_EN, ARRAY_SIZE(SEQ_VL2_EN));
337 ld9040_panel_send_sequence(SEQ_VCI1_2ND_EN, ARRAY_SIZE(SEQ_VCI1_2ND_EN));
339 ld9040_panel_send_sequence(SEQ_VL3_EN, ARRAY_SIZE(SEQ_VL3_EN));
341 ld9040_panel_send_sequence(SEQ_VREG1_AMP_EN, ARRAY_SIZE(SEQ_VREG1_AMP_EN));
343 ld9040_panel_send_sequence(SEQ_VGH_AMP_EN, ARRAY_SIZE(SEQ_VGH_AMP_EN));
345 ld9040_panel_send_sequence(SEQ_VGL_AMP_EN, ARRAY_SIZE(SEQ_VGL_AMP_EN));
347 ld9040_panel_send_sequence(SEQ_VMOS_AMP_EN, ARRAY_SIZE(SEQ_VMOS_AMP_EN));
349 ld9040_panel_send_sequence(SEQ_VINT_AMP_EN, ARRAY_SIZE(SEQ_VINT_AMP_EN));
351 ld9040_panel_send_sequence(SEQ_VBH_AMP_EN, ARRAY_SIZE(SEQ_VBH_AMP_EN));
353 ld9040_panel_send_sequence(SEQ_VBL_AMP_EN, ARRAY_SIZE(SEQ_VBL_AMP_EN));
355 ld9040_panel_send_sequence(SEQ_GAM_AMP_EN, ARRAY_SIZE(SEQ_GAM_AMP_EN));
357 ld9040_panel_send_sequence(SEQ_SD_AMP_EN, ARRAY_SIZE(SEQ_SD_AMP_EN));
359 ld9040_panel_send_sequence(SEQ_GLS_EN, ARRAY_SIZE(SEQ_GLS_EN));
361 ld9040_panel_send_sequence(SEQ_ELS_EN, ARRAY_SIZE(SEQ_ELS_EN));
363 ld9040_panel_send_sequence(SEQ_EL_ON, ARRAY_SIZE(SEQ_EL_ON));
370 void ld9040_enable_ldo(unsigned int onoff)
373 ld9040_panel_send_sequence(SEQ_DISPON, ARRAY_SIZE(SEQ_DISPON));
377 /* this function would be called at universal.c */
378 void ld9040_set_platform_data(struct spi_platform_data *pd)
381 printf("pd is NULL.\n");