[PATCH] hwmon: hwmon vs i2c, second round (07/11)
[linux-2.6/linux-loongson.git] / drivers / video / au1100fb.h
blob657c560ab73c62a22677e5b0280a678298a9c956
1 /*
2 * BRIEF MODULE DESCRIPTION
3 * Hardware definitions for the Au1100 LCD controller
5 * Copyright 2002 MontaVista Software
6 * Copyright 2002 Alchemy Semiconductor
7 * Author: Alchemy Semiconductor, MontaVista Software
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 #ifndef _AU1100LCD_H
31 #define _AU1100LCD_H
33 /********************************************************************/
34 #define uint32 unsigned long
35 typedef volatile struct
37 uint32 lcd_control;
38 uint32 lcd_intstatus;
39 uint32 lcd_intenable;
40 uint32 lcd_horztiming;
41 uint32 lcd_verttiming;
42 uint32 lcd_clkcontrol;
43 uint32 lcd_dmaaddr0;
44 uint32 lcd_dmaaddr1;
45 uint32 lcd_words;
46 uint32 lcd_pwmdiv;
47 uint32 lcd_pwmhi;
48 uint32 reserved[(0x0400-0x002C)/4];
49 uint32 lcd_pallettebase[256];
51 } AU1100_LCD;
53 /********************************************************************/
55 #define AU1100_LCD_ADDR 0xB5000000
58 * Register bit definitions
61 /* lcd_control */
62 #define LCD_CONTROL_SBPPF (7<<18)
63 #define LCD_CONTROL_SBPPF_655 (0<<18)
64 #define LCD_CONTROL_SBPPF_565 (1<<18)
65 #define LCD_CONTROL_SBPPF_556 (2<<18)
66 #define LCD_CONTROL_SBPPF_1555 (3<<18)
67 #define LCD_CONTROL_SBPPF_5551 (4<<18)
68 #define LCD_CONTROL_WP (1<<17)
69 #define LCD_CONTROL_WD (1<<16)
70 #define LCD_CONTROL_C (1<<15)
71 #define LCD_CONTROL_SM (3<<13)
72 #define LCD_CONTROL_SM_0 (0<<13)
73 #define LCD_CONTROL_SM_90 (1<<13)
74 #define LCD_CONTROL_SM_180 (2<<13)
75 #define LCD_CONTROL_SM_270 (3<<13)
76 #define LCD_CONTROL_DB (1<<12)
77 #define LCD_CONTROL_CCO (1<<11)
78 #define LCD_CONTROL_DP (1<<10)
79 #define LCD_CONTROL_PO (3<<8)
80 #define LCD_CONTROL_PO_00 (0<<8)
81 #define LCD_CONTROL_PO_01 (1<<8)
82 #define LCD_CONTROL_PO_10 (2<<8)
83 #define LCD_CONTROL_PO_11 (3<<8)
84 #define LCD_CONTROL_MPI (1<<7)
85 #define LCD_CONTROL_PT (1<<6)
86 #define LCD_CONTROL_PC (1<<5)
87 #define LCD_CONTROL_BPP (7<<1)
88 #define LCD_CONTROL_BPP_1 (0<<1)
89 #define LCD_CONTROL_BPP_2 (1<<1)
90 #define LCD_CONTROL_BPP_4 (2<<1)
91 #define LCD_CONTROL_BPP_8 (3<<1)
92 #define LCD_CONTROL_BPP_12 (4<<1)
93 #define LCD_CONTROL_BPP_16 (5<<1)
94 #define LCD_CONTROL_GO (1<<0)
96 /* lcd_intstatus, lcd_intenable */
97 #define LCD_INT_SD (1<<7)
98 #define LCD_INT_OF (1<<6)
99 #define LCD_INT_UF (1<<5)
100 #define LCD_INT_SA (1<<3)
101 #define LCD_INT_SS (1<<2)
102 #define LCD_INT_S1 (1<<1)
103 #define LCD_INT_S0 (1<<0)
105 /* lcd_horztiming */
106 #define LCD_HORZTIMING_HN2 (255<<24)
107 #define LCD_HORZTIMING_HN2_N(N) (((N)-1)<<24)
108 #define LCD_HORZTIMING_HN1 (255<<16)
109 #define LCD_HORZTIMING_HN1_N(N) (((N)-1)<<16)
110 #define LCD_HORZTIMING_HPW (63<<10)
111 #define LCD_HORZTIMING_HPW_N(N) (((N)-1)<<10)
112 #define LCD_HORZTIMING_PPL (1023<<0)
113 #define LCD_HORZTIMING_PPL_N(N) (((N)-1)<<0)
115 /* lcd_verttiming */
116 #define LCD_VERTTIMING_VN2 (255<<24)
117 #define LCD_VERTTIMING_VN2_N(N) (((N)-1)<<24)
118 #define LCD_VERTTIMING_VN1 (255<<16)
119 #define LCD_VERTTIMING_VN1_N(N) (((N)-1)<<16)
120 #define LCD_VERTTIMING_VPW (63<<10)
121 #define LCD_VERTTIMING_VPW_N(N) (((N)-1)<<10)
122 #define LCD_VERTTIMING_LPP (1023<<0)
123 #define LCD_VERTTIMING_LPP_N(N) (((N)-1)<<0)
125 /* lcd_clkcontrol */
126 #define LCD_CLKCONTROL_IB (1<<18)
127 #define LCD_CLKCONTROL_IC (1<<17)
128 #define LCD_CLKCONTROL_IH (1<<16)
129 #define LCD_CLKCONTROL_IV (1<<15)
130 #define LCD_CLKCONTROL_BF (31<<10)
131 #define LCD_CLKCONTROL_BF_N(N) (((N)-1)<<10)
132 #define LCD_CLKCONTROL_PCD (1023<<0)
133 #define LCD_CLKCONTROL_PCD_N(N) ((N)<<0)
135 /* lcd_pwmdiv */
136 #define LCD_PWMDIV_EN (1<<12)
137 #define LCD_PWMDIV_PWMDIV (2047<<0)
138 #define LCD_PWMDIV_PWMDIV_N(N) (((N)-1)<<0)
140 /* lcd_pwmhi */
141 #define LCD_PWMHI_PWMHI1 (2047<<12)
142 #define LCD_PWMHI_PWMHI1_N(N) ((N)<<12)
143 #define LCD_PWMHI_PWMHI0 (2047<<0)
144 #define LCD_PWMHI_PWMHI0_N(N) ((N)<<0)
146 /* lcd_pallettebase - MONOCHROME */
147 #define LCD_PALLETTE_MONO_MI (15<<0)
148 #define LCD_PALLETTE_MONO_MI_N(N) ((N)<<0)
150 /* lcd_pallettebase - COLOR */
151 #define LCD_PALLETTE_COLOR_BI (15<<8)
152 #define LCD_PALLETTE_COLOR_BI_N(N) ((N)<<8)
153 #define LCD_PALLETTE_COLOR_GI (15<<4)
154 #define LCD_PALLETTE_COLOR_GI_N(N) ((N)<<4)
155 #define LCD_PALLETTE_COLOR_RI (15<<0)
156 #define LCD_PALLETTE_COLOR_RI_N(N) ((N)<<0)
158 /* lcd_palletebase - COLOR TFT PALLETIZED */
159 #define LCD_PALLETTE_TFT_DC (65535<<0)
160 #define LCD_PALLETTE_TFT_DC_N(N) ((N)<<0)
162 /********************************************************************/
164 struct known_lcd_panels
166 uint32 xres;
167 uint32 yres;
168 uint32 bpp;
169 unsigned char panel_name[256];
170 uint32 mode_control;
171 uint32 mode_horztiming;
172 uint32 mode_verttiming;
173 uint32 mode_clkcontrol;
174 uint32 mode_pwmdiv;
175 uint32 mode_pwmhi;
176 uint32 mode_toyclksrc;
177 uint32 mode_backlight;
181 #if defined(__BIG_ENDIAN)
182 #define LCD_DEFAULT_PIX_FORMAT LCD_CONTROL_PO_11
183 #else
184 #define LCD_DEFAULT_PIX_FORMAT LCD_CONTROL_PO_00
185 #endif
188 * The fb driver assumes that AUX PLL is at 48MHz. That can
189 * cover up to 800x600 resolution; if you need higher resolution,
190 * you should modify the driver as needed, not just this structure.
192 struct known_lcd_panels panels[] =
194 { /* 0: Pb1100 LCDA: Sharp 320x240 TFT panel */
195 320, /* xres */
196 240, /* yres */
197 16, /* bpp */
199 "Sharp_320x240_16",
200 /* mode_control */
201 ( LCD_CONTROL_SBPPF_565
202 /*LCD_CONTROL_WP*/
203 /*LCD_CONTROL_WD*/
204 | LCD_CONTROL_C
205 | LCD_CONTROL_SM_0
206 /*LCD_CONTROL_DB*/
207 /*LCD_CONTROL_CCO*/
208 /*LCD_CONTROL_DP*/
209 | LCD_DEFAULT_PIX_FORMAT
210 /*LCD_CONTROL_MPI*/
211 | LCD_CONTROL_PT
212 | LCD_CONTROL_PC
213 | LCD_CONTROL_BPP_16 ),
215 /* mode_horztiming */
216 ( LCD_HORZTIMING_HN2_N(8)
217 | LCD_HORZTIMING_HN1_N(60)
218 | LCD_HORZTIMING_HPW_N(12)
219 | LCD_HORZTIMING_PPL_N(320) ),
221 /* mode_verttiming */
222 ( LCD_VERTTIMING_VN2_N(5)
223 | LCD_VERTTIMING_VN1_N(17)
224 | LCD_VERTTIMING_VPW_N(1)
225 | LCD_VERTTIMING_LPP_N(240) ),
227 /* mode_clkcontrol */
229 /*LCD_CLKCONTROL_IB*/
230 /*LCD_CLKCONTROL_IC*/
231 /*LCD_CLKCONTROL_IH*/
232 /*LCD_CLKCONTROL_IV*/
233 | LCD_CLKCONTROL_PCD_N(1) ),
235 /* mode_pwmdiv */
238 /* mode_pwmhi */
241 /* mode_toyclksrc */
242 ((1<<7) | (1<<6) | (1<<5)),
244 /* mode_backlight */
248 { /* 1: Pb1100 LCDC 640x480 TFT panel */
249 640, /* xres */
250 480, /* yres */
251 16, /* bpp */
253 "Generic_640x480_16",
255 /* mode_control */
256 0x004806a | LCD_DEFAULT_PIX_FORMAT,
258 /* mode_horztiming */
259 0x3434d67f,
261 /* mode_verttiming */
262 0x0e0e39df,
264 /* mode_clkcontrol */
266 /*LCD_CLKCONTROL_IB*/
267 /*LCD_CLKCONTROL_IC*/
268 /*LCD_CLKCONTROL_IH*/
269 /*LCD_CLKCONTROL_IV*/
270 | LCD_CLKCONTROL_PCD_N(1) ),
272 /* mode_pwmdiv */
275 /* mode_pwmhi */
278 /* mode_toyclksrc */
279 ((1<<7) | (1<<6) | (0<<5)),
281 /* mode_backlight */
285 { /* 2: Pb1100 LCDB 640x480 PrimeView TFT panel */
286 640, /* xres */
287 480, /* yres */
288 16, /* bpp */
290 "PrimeView_640x480_16",
292 /* mode_control */
293 0x0004886a | LCD_DEFAULT_PIX_FORMAT,
295 /* mode_horztiming */
296 0x0e4bfe7f,
298 /* mode_verttiming */
299 0x210805df,
301 /* mode_clkcontrol */
302 0x00038001,
304 /* mode_pwmdiv */
307 /* mode_pwmhi */
310 /* mode_toyclksrc */
311 ((1<<7) | (1<<6) | (0<<5)),
313 /* mode_backlight */
317 { /* 3: Pb1100 800x600x16bpp NEON CRT */
318 800, /* xres */
319 600, /* yres */
320 16, /* bpp */
322 "NEON_800x600_16",
324 /* mode_control */
325 0x0004886A | LCD_DEFAULT_PIX_FORMAT,
327 /* mode_horztiming */
328 0x005AFF1F,
330 /* mode_verttiming */
331 0x16000E57,
333 /* mode_clkcontrol */
334 0x00020000,
336 /* mode_pwmdiv */
339 /* mode_pwmhi */
342 /* mode_toyclksrc */
343 ((1<<7) | (1<<6) | (0<<5)),
345 /* mode_backlight */
349 { /* 4: Pb1100 640x480x16bpp NEON CRT */
350 640, /* xres */
351 480, /* yres */
352 16, /* bpp */
354 "NEON_640x480_16",
356 /* mode_control */
357 0x0004886A | LCD_DEFAULT_PIX_FORMAT,
359 /* mode_horztiming */
360 0x0052E27F,
362 /* mode_verttiming */
363 0x18000DDF,
365 /* mode_clkcontrol */
366 0x00020000,
368 /* mode_pwmdiv */
371 /* mode_pwmhi */
374 /* mode_toyclksrc */
375 ((1<<7) | (1<<6) | (0<<5)),
377 /* mode_backlight */
381 #endif /* _AU1100LCD_H */