2 * JzRISC lcd controller
4 * xiangfu liu <xiangfu.z@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22 #ifndef __QI_LB60_GPM940B0_H__
23 #define __QI_LB60_GPM940B0_H__
27 #define mdelay(n) udelay((n)*1000)
29 #define NR_PALETTE 256
32 unsigned int next_desc
; /* LCDDAx */
33 unsigned int databuf
; /* LCDSAx */
34 unsigned int frame_id
; /* LCDFIDx */
35 unsigned int cmd
; /* LCDCMDx */
38 #define MODE_MASK 0x0f
39 #define MODE_TFT_GEN 0x00
40 #define MODE_TFT_SHARP 0x01
41 #define MODE_TFT_CASIO 0x02
42 #define MODE_TFT_SAMSUNG 0x03
43 #define MODE_CCIR656_NONINT 0x04
44 #define MODE_CCIR656_INT 0x05
45 #define MODE_STN_COLOR_SINGLE 0x08
46 #define MODE_STN_MONO_SINGLE 0x09
47 #define MODE_STN_COLOR_DUAL 0x0a
48 #define MODE_STN_MONO_DUAL 0x0b
49 #define MODE_8BIT_SERIAL_TFT 0x0c
51 #define MODE_TFT_18BIT (1<<7)
53 #define STN_DAT_PIN1 (0x00 << 4)
54 #define STN_DAT_PIN2 (0x01 << 4)
55 #define STN_DAT_PIN4 (0x02 << 4)
56 #define STN_DAT_PIN8 (0x03 << 4)
57 #define STN_DAT_PINMASK STN_DAT_PIN8
59 #define STFT_PSHI (1 << 15)
60 #define STFT_CLSHI (1 << 14)
61 #define STFT_SPLHI (1 << 13)
62 #define STFT_REVHI (1 << 12)
64 #define SYNC_MASTER (0 << 16)
65 #define SYNC_SLAVE (1 << 16)
70 #define PCLK_P (0 << 10)
71 #define PCLK_N (1 << 10)
73 #define HSYNC_P (0 << 11)
74 #define HSYNC_N (1 << 11)
76 #define VSYNC_P (0 << 8)
77 #define VSYNC_N (1 << 8)
79 #define DATA_NORMAL (0 << 17)
80 #define DATA_INVERSE (1 << 17)
83 /* Jz LCDFB supported I/O controls. */
84 #define FBIOSETBACKLIGHT 0x4688
85 #define FBIODISPON 0x4689
86 #define FBIODISPOFF 0x468a
87 #define FBIORESET 0x468b
88 #define FBIOPRINT_REG 0x468c
91 * LCD panel specific definition
93 #define MODE 0xc9 /* 8bit serial RGB */
94 #define SPEN (32*2+21) /*LCD_SPL */
95 #define SPCK (32*2+23) /*LCD_CLS */
96 #define SPDA (32*2+22) /*LCD_D12 */
97 #define LCD_RET (32*3+27)
99 #define __spi_write_reg1(reg, val) \
102 unsigned short value;\
107 __gpio_set_pin(SPEN);\
108 __gpio_set_pin(SPCK);\
109 __gpio_clear_pin(SPDA);\
110 __gpio_clear_pin(SPEN);\
112 value=((a<<8)|(b&0xFF));\
113 for(no=0;no<16;no++)\
115 __gpio_clear_pin(SPCK);\
116 if((value&0x8000)==0x8000)\
117 __gpio_set_pin(SPDA);\
119 __gpio_clear_pin(SPDA);\
121 __gpio_set_pin(SPCK);\
125 __gpio_set_pin(SPEN);\
129 #define __spi_write_reg(reg, val) \
131 __spi_write_reg1((reg<<2|2), val);\
135 #define __lcd_special_pin_init() \
137 __gpio_as_output(SPEN); /* use SPDA */\
138 __gpio_as_output(SPCK); /* use SPCK */\
139 __gpio_as_output(SPDA); /* use SPDA */\
140 __gpio_as_output(LCD_RET);\
143 #define __lcd_special_on() \
145 __spi_write_reg1(0x05, 0x1e); \
147 __spi_write_reg1(0x05, 0x5d); \
148 __spi_write_reg1(0x0B, 0x81); \
149 __spi_write_reg1(0x01, 0x95); \
150 __spi_write_reg1(0x00, 0x07); \
151 __spi_write_reg1(0x06, 0x15); \
152 __spi_write_reg1(0x07, 0x8d); \
153 __spi_write_reg1(0x04, 0x0f); \
154 __spi_write_reg1(0x0d, 0x3d); \
155 __spi_write_reg1(0x10, 0x42); \
156 __spi_write_reg1(0x11, 0x3a); \
157 __spi_write_reg1(0x05, 0x5f); \
160 #define __lcd_special_off() \
162 __spi_write_reg1(0x05, 0x5e); \
165 #define __lcd_display_pin_init() \
167 __lcd_special_pin_init();\
169 __lcd_set_backlight_level(8);\
172 #define __lcd_display_on() \
174 __lcd_set_backlight_level(8); \
178 #define __lcd_display_off() \
180 __lcd_set_backlight_level(0); \
181 __lcd_special_off();\
184 #define __lcd_set_backlight_level(n)\
186 __gpio_as_output(LCD_RET); \
187 __gpio_set_pin(LCD_RET); \
190 #if defined(CONFIG_SAKC)
191 #define __lcd_close_backlight() \
193 __gpio_as_output(GPIO_PWM); \
194 __gpio_clear_pin(GPIO_PWM); \
198 #if defined(CONFIG_SAKC)
199 #define __lcd_display_pin_init() \
202 __lcd_special_pin_init(); \
205 #define __lcd_display_on() \
207 __lcd_special_on(); \
210 #define __lcd_display_off() \
212 __lcd_special_off(); \
215 #define __lcd_display_pin_init() \
218 __lcd_special_pin_init(); \
221 #define __lcd_display_on() \
223 __gpio_set_pin(GPIO_DISP_OFF_N); \
224 __lcd_special_on(); \
227 #define __lcd_display_off() \
229 __lcd_special_off(); \
230 __gpio_clear_pin(GPIO_DISP_OFF_N); \
234 #endif /* __QI_LB60_GPM940B0_H__ */
This page took 0.056289 seconds and 5 git commands to generate.