Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: au1100fb: Fold au1100fb.h into its only user

This gets rid of a header that is only used once. The copyrights and
license specifications are all already covered in the au1100fb.c file.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Uwe Kleine-König and committed by
Helge Deller
cd849d26 bcf4373e

+338 -373
+338 -1
drivers/video/fbdev/au1100fb.c
··· 60 60 #include <linux/platform_device.h> 61 61 #include <linux/slab.h> 62 62 63 - #include "au1100fb.h" 63 + #if defined(__BIG_ENDIAN) 64 + #define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11 65 + #else 66 + #define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00 67 + #endif 68 + #define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565 69 + 70 + /********************************************************************/ 71 + 72 + /* LCD controller restrictions */ 73 + #define AU1100_LCD_MAX_XRES 800 74 + #define AU1100_LCD_MAX_YRES 600 75 + #define AU1100_LCD_MAX_BPP 16 76 + #define AU1100_LCD_MAX_CLK 48000000 77 + #define AU1100_LCD_NBR_PALETTE_ENTRIES 256 78 + 79 + /* Default number of visible screen buffer to allocate */ 80 + #define AU1100FB_NBR_VIDEO_BUFFERS 4 81 + 82 + /********************************************************************/ 83 + 84 + struct au1100fb_panel 85 + { 86 + const char name[25]; /* Full name <vendor>_<model> */ 87 + 88 + u32 control_base; /* Mode-independent control values */ 89 + u32 clkcontrol_base; /* Panel pixclock preferences */ 90 + 91 + u32 horztiming; 92 + u32 verttiming; 93 + 94 + u32 xres; /* Maximum horizontal resolution */ 95 + u32 yres; /* Maximum vertical resolution */ 96 + u32 bpp; /* Maximum depth supported */ 97 + }; 98 + 99 + struct au1100fb_regs 100 + { 101 + u32 lcd_control; 102 + u32 lcd_intstatus; 103 + u32 lcd_intenable; 104 + u32 lcd_horztiming; 105 + u32 lcd_verttiming; 106 + u32 lcd_clkcontrol; 107 + u32 lcd_dmaaddr0; 108 + u32 lcd_dmaaddr1; 109 + u32 lcd_words; 110 + u32 lcd_pwmdiv; 111 + u32 lcd_pwmhi; 112 + u32 reserved[(0x0400-0x002C)/4]; 113 + u32 lcd_palettebase[256]; 114 + }; 115 + 116 + struct au1100fb_device { 117 + 118 + struct fb_info info; /* FB driver info record */ 119 + 120 + struct au1100fb_panel *panel; /* Panel connected to this device */ 121 + 122 + struct au1100fb_regs* regs; /* Registers memory map */ 123 + size_t regs_len; 124 + unsigned int regs_phys; 125 + 126 + #ifdef CONFIG_PM 127 + /* stores the register values during suspend */ 128 + struct au1100fb_regs pm_regs; 129 + #endif 130 + 131 + unsigned char* fb_mem; /* FrameBuffer memory map */ 132 + size_t fb_len; 133 + dma_addr_t fb_phys; 134 + int panel_idx; 135 + struct clk *lcdclk; 136 + struct device *dev; 137 + }; 138 + 139 + /********************************************************************/ 140 + 141 + #define LCD_CONTROL (AU1100_LCD_BASE + 0x0) 142 + #define LCD_CONTROL_SBB_BIT 21 143 + #define LCD_CONTROL_SBB_MASK (0x3 << LCD_CONTROL_SBB_BIT) 144 + #define LCD_CONTROL_SBB_1 (0 << LCD_CONTROL_SBB_BIT) 145 + #define LCD_CONTROL_SBB_2 (1 << LCD_CONTROL_SBB_BIT) 146 + #define LCD_CONTROL_SBB_3 (2 << LCD_CONTROL_SBB_BIT) 147 + #define LCD_CONTROL_SBB_4 (3 << LCD_CONTROL_SBB_BIT) 148 + #define LCD_CONTROL_SBPPF_BIT 18 149 + #define LCD_CONTROL_SBPPF_MASK (0x7 << LCD_CONTROL_SBPPF_BIT) 150 + #define LCD_CONTROL_SBPPF_655 (0 << LCD_CONTROL_SBPPF_BIT) 151 + #define LCD_CONTROL_SBPPF_565 (1 << LCD_CONTROL_SBPPF_BIT) 152 + #define LCD_CONTROL_SBPPF_556 (2 << LCD_CONTROL_SBPPF_BIT) 153 + #define LCD_CONTROL_SBPPF_1555 (3 << LCD_CONTROL_SBPPF_BIT) 154 + #define LCD_CONTROL_SBPPF_5551 (4 << LCD_CONTROL_SBPPF_BIT) 155 + #define LCD_CONTROL_WP (1<<17) 156 + #define LCD_CONTROL_WD (1<<16) 157 + #define LCD_CONTROL_C (1<<15) 158 + #define LCD_CONTROL_SM_BIT 13 159 + #define LCD_CONTROL_SM_MASK (0x3 << LCD_CONTROL_SM_BIT) 160 + #define LCD_CONTROL_SM_0 (0 << LCD_CONTROL_SM_BIT) 161 + #define LCD_CONTROL_SM_90 (1 << LCD_CONTROL_SM_BIT) 162 + #define LCD_CONTROL_SM_180 (2 << LCD_CONTROL_SM_BIT) 163 + #define LCD_CONTROL_SM_270 (3 << LCD_CONTROL_SM_BIT) 164 + #define LCD_CONTROL_DB (1<<12) 165 + #define LCD_CONTROL_CCO (1<<11) 166 + #define LCD_CONTROL_DP (1<<10) 167 + #define LCD_CONTROL_PO_BIT 8 168 + #define LCD_CONTROL_PO_MASK (0x3 << LCD_CONTROL_PO_BIT) 169 + #define LCD_CONTROL_PO_00 (0 << LCD_CONTROL_PO_BIT) 170 + #define LCD_CONTROL_PO_01 (1 << LCD_CONTROL_PO_BIT) 171 + #define LCD_CONTROL_PO_10 (2 << LCD_CONTROL_PO_BIT) 172 + #define LCD_CONTROL_PO_11 (3 << LCD_CONTROL_PO_BIT) 173 + #define LCD_CONTROL_MPI (1<<7) 174 + #define LCD_CONTROL_PT (1<<6) 175 + #define LCD_CONTROL_PC (1<<5) 176 + #define LCD_CONTROL_BPP_BIT 1 177 + #define LCD_CONTROL_BPP_MASK (0x7 << LCD_CONTROL_BPP_BIT) 178 + #define LCD_CONTROL_BPP_1 (0 << LCD_CONTROL_BPP_BIT) 179 + #define LCD_CONTROL_BPP_2 (1 << LCD_CONTROL_BPP_BIT) 180 + #define LCD_CONTROL_BPP_4 (2 << LCD_CONTROL_BPP_BIT) 181 + #define LCD_CONTROL_BPP_8 (3 << LCD_CONTROL_BPP_BIT) 182 + #define LCD_CONTROL_BPP_12 (4 << LCD_CONTROL_BPP_BIT) 183 + #define LCD_CONTROL_BPP_16 (5 << LCD_CONTROL_BPP_BIT) 184 + #define LCD_CONTROL_GO (1<<0) 185 + 186 + #define LCD_INTSTATUS (AU1100_LCD_BASE + 0x4) 187 + #define LCD_INTENABLE (AU1100_LCD_BASE + 0x8) 188 + #define LCD_INT_SD (1<<7) 189 + #define LCD_INT_OF (1<<6) 190 + #define LCD_INT_UF (1<<5) 191 + #define LCD_INT_SA (1<<3) 192 + #define LCD_INT_SS (1<<2) 193 + #define LCD_INT_S1 (1<<1) 194 + #define LCD_INT_S0 (1<<0) 195 + 196 + #define LCD_HORZTIMING (AU1100_LCD_BASE + 0xC) 197 + #define LCD_HORZTIMING_HN2_BIT 24 198 + #define LCD_HORZTIMING_HN2_MASK (0xFF << LCD_HORZTIMING_HN2_BIT) 199 + #define LCD_HORZTIMING_HN2_N(N) ((((N)-1) << LCD_HORZTIMING_HN2_BIT) & LCD_HORZTIMING_HN2_MASK) 200 + #define LCD_HORZTIMING_HN1_BIT 16 201 + #define LCD_HORZTIMING_HN1_MASK (0xFF << LCD_HORZTIMING_HN1_BIT) 202 + #define LCD_HORZTIMING_HN1_N(N) ((((N)-1) << LCD_HORZTIMING_HN1_BIT) & LCD_HORZTIMING_HN1_MASK) 203 + #define LCD_HORZTIMING_HPW_BIT 10 204 + #define LCD_HORZTIMING_HPW_MASK (0x3F << LCD_HORZTIMING_HPW_BIT) 205 + #define LCD_HORZTIMING_HPW_N(N) ((((N)-1) << LCD_HORZTIMING_HPW_BIT) & LCD_HORZTIMING_HPW_MASK) 206 + #define LCD_HORZTIMING_PPL_BIT 0 207 + #define LCD_HORZTIMING_PPL_MASK (0x3FF << LCD_HORZTIMING_PPL_BIT) 208 + #define LCD_HORZTIMING_PPL_N(N) ((((N)-1) << LCD_HORZTIMING_PPL_BIT) & LCD_HORZTIMING_PPL_MASK) 209 + 210 + #define LCD_VERTTIMING (AU1100_LCD_BASE + 0x10) 211 + #define LCD_VERTTIMING_VN2_BIT 24 212 + #define LCD_VERTTIMING_VN2_MASK (0xFF << LCD_VERTTIMING_VN2_BIT) 213 + #define LCD_VERTTIMING_VN2_N(N) ((((N)-1) << LCD_VERTTIMING_VN2_BIT) & LCD_VERTTIMING_VN2_MASK) 214 + #define LCD_VERTTIMING_VN1_BIT 16 215 + #define LCD_VERTTIMING_VN1_MASK (0xFF << LCD_VERTTIMING_VN1_BIT) 216 + #define LCD_VERTTIMING_VN1_N(N) ((((N)-1) << LCD_VERTTIMING_VN1_BIT) & LCD_VERTTIMING_VN1_MASK) 217 + #define LCD_VERTTIMING_VPW_BIT 10 218 + #define LCD_VERTTIMING_VPW_MASK (0x3F << LCD_VERTTIMING_VPW_BIT) 219 + #define LCD_VERTTIMING_VPW_N(N) ((((N)-1) << LCD_VERTTIMING_VPW_BIT) & LCD_VERTTIMING_VPW_MASK) 220 + #define LCD_VERTTIMING_LPP_BIT 0 221 + #define LCD_VERTTIMING_LPP_MASK (0x3FF << LCD_VERTTIMING_LPP_BIT) 222 + #define LCD_VERTTIMING_LPP_N(N) ((((N)-1) << LCD_VERTTIMING_LPP_BIT) & LCD_VERTTIMING_LPP_MASK) 223 + 224 + #define LCD_CLKCONTROL (AU1100_LCD_BASE + 0x14) 225 + #define LCD_CLKCONTROL_IB (1<<18) 226 + #define LCD_CLKCONTROL_IC (1<<17) 227 + #define LCD_CLKCONTROL_IH (1<<16) 228 + #define LCD_CLKCONTROL_IV (1<<15) 229 + #define LCD_CLKCONTROL_BF_BIT 10 230 + #define LCD_CLKCONTROL_BF_MASK (0x1F << LCD_CLKCONTROL_BF_BIT) 231 + #define LCD_CLKCONTROL_BF_N(N) ((((N)-1) << LCD_CLKCONTROL_BF_BIT) & LCD_CLKCONTROL_BF_MASK) 232 + #define LCD_CLKCONTROL_PCD_BIT 0 233 + #define LCD_CLKCONTROL_PCD_MASK (0x3FF << LCD_CLKCONTROL_PCD_BIT) 234 + #define LCD_CLKCONTROL_PCD_N(N) (((N) << LCD_CLKCONTROL_PCD_BIT) & LCD_CLKCONTROL_PCD_MASK) 235 + 236 + #define LCD_DMAADDR0 (AU1100_LCD_BASE + 0x18) 237 + #define LCD_DMAADDR1 (AU1100_LCD_BASE + 0x1C) 238 + #define LCD_DMA_SA_BIT 5 239 + #define LCD_DMA_SA_MASK (0x7FFFFFF << LCD_DMA_SA_BIT) 240 + #define LCD_DMA_SA_N(N) ((N) & LCD_DMA_SA_MASK) 241 + 242 + #define LCD_WORDS (AU1100_LCD_BASE + 0x20) 243 + #define LCD_WRD_WRDS_BIT 0 244 + #define LCD_WRD_WRDS_MASK (0xFFFFFFFF << LCD_WRD_WRDS_BIT) 245 + #define LCD_WRD_WRDS_N(N) ((((N)-1) << LCD_WRD_WRDS_BIT) & LCD_WRD_WRDS_MASK) 246 + 247 + #define LCD_PWMDIV (AU1100_LCD_BASE + 0x24) 248 + #define LCD_PWMDIV_EN (1<<12) 249 + #define LCD_PWMDIV_PWMDIV_BIT 0 250 + #define LCD_PWMDIV_PWMDIV_MASK (0xFFF << LCD_PWMDIV_PWMDIV_BIT) 251 + #define LCD_PWMDIV_PWMDIV_N(N) ((((N)-1) << LCD_PWMDIV_PWMDIV_BIT) & LCD_PWMDIV_PWMDIV_MASK) 252 + 253 + #define LCD_PWMHI (AU1100_LCD_BASE + 0x28) 254 + #define LCD_PWMHI_PWMHI1_BIT 12 255 + #define LCD_PWMHI_PWMHI1_MASK (0xFFF << LCD_PWMHI_PWMHI1_BIT) 256 + #define LCD_PWMHI_PWMHI1_N(N) (((N) << LCD_PWMHI_PWMHI1_BIT) & LCD_PWMHI_PWMHI1_MASK) 257 + #define LCD_PWMHI_PWMHI0_BIT 0 258 + #define LCD_PWMHI_PWMHI0_MASK (0xFFF << LCD_PWMHI_PWMHI0_BIT) 259 + #define LCD_PWMHI_PWMHI0_N(N) (((N) << LCD_PWMHI_PWMHI0_BIT) & LCD_PWMHI_PWMHI0_MASK) 260 + 261 + #define LCD_PALLETTEBASE (AU1100_LCD_BASE + 0x400) 262 + #define LCD_PALLETTE_MONO_MI_BIT 0 263 + #define LCD_PALLETTE_MONO_MI_MASK (0xF << LCD_PALLETTE_MONO_MI_BIT) 264 + #define LCD_PALLETTE_MONO_MI_N(N) (((N)<< LCD_PALLETTE_MONO_MI_BIT) & LCD_PALLETTE_MONO_MI_MASK) 265 + 266 + #define LCD_PALLETTE_COLOR_RI_BIT 8 267 + #define LCD_PALLETTE_COLOR_RI_MASK (0xF << LCD_PALLETTE_COLOR_RI_BIT) 268 + #define LCD_PALLETTE_COLOR_RI_N(N) (((N)<< LCD_PALLETTE_COLOR_RI_BIT) & LCD_PALLETTE_COLOR_RI_MASK) 269 + #define LCD_PALLETTE_COLOR_GI_BIT 4 270 + #define LCD_PALLETTE_COLOR_GI_MASK (0xF << LCD_PALLETTE_COLOR_GI_BIT) 271 + #define LCD_PALLETTE_COLOR_GI_N(N) (((N)<< LCD_PALLETTE_COLOR_GI_BIT) & LCD_PALLETTE_COLOR_GI_MASK) 272 + #define LCD_PALLETTE_COLOR_BI_BIT 0 273 + #define LCD_PALLETTE_COLOR_BI_MASK (0xF << LCD_PALLETTE_COLOR_BI_BIT) 274 + #define LCD_PALLETTE_COLOR_BI_N(N) (((N)<< LCD_PALLETTE_COLOR_BI_BIT) & LCD_PALLETTE_COLOR_BI_MASK) 275 + 276 + #define LCD_PALLETTE_TFT_DC_BIT 0 277 + #define LCD_PALLETTE_TFT_DC_MASK (0xFFFF << LCD_PALLETTE_TFT_DC_BIT) 278 + #define LCD_PALLETTE_TFT_DC_N(N) (((N)<< LCD_PALLETTE_TFT_DC_BIT) & LCD_PALLETTE_TFT_DC_MASK) 279 + 280 + /********************************************************************/ 281 + 282 + /* List of panels known to work with the AU1100 LCD controller. 283 + * To add a new panel, enter the same specifications as the 284 + * Generic_TFT one, and MAKE SURE that it doesn't conflicts 285 + * with the controller restrictions. Restrictions are: 286 + * 287 + * STN color panels: max_bpp <= 12 288 + * STN mono panels: max_bpp <= 4 289 + * TFT panels: max_bpp <= 16 290 + * max_xres <= 800 291 + * max_yres <= 600 292 + */ 293 + static struct au1100fb_panel known_lcd_panels[] = 294 + { 295 + /* 800x600x16bpp CRT */ 296 + [0] = { 297 + .name = "CRT_800x600_16", 298 + .xres = 800, 299 + .yres = 600, 300 + .bpp = 16, 301 + .control_base = 0x0004886A | 302 + LCD_CONTROL_DEFAULT_PO | LCD_CONTROL_DEFAULT_SBPPF | 303 + LCD_CONTROL_BPP_16 | LCD_CONTROL_SBB_4, 304 + .clkcontrol_base = 0x00020000, 305 + .horztiming = 0x005aff1f, 306 + .verttiming = 0x16000e57, 307 + }, 308 + /* just the standard LCD */ 309 + [1] = { 310 + .name = "WWPC LCD", 311 + .xres = 240, 312 + .yres = 320, 313 + .bpp = 16, 314 + .control_base = 0x0006806A, 315 + .horztiming = 0x0A1010EF, 316 + .verttiming = 0x0301013F, 317 + .clkcontrol_base = 0x00018001, 318 + }, 319 + /* Sharp 320x240 TFT panel */ 320 + [2] = { 321 + .name = "Sharp_LQ038Q5DR01", 322 + .xres = 320, 323 + .yres = 240, 324 + .bpp = 16, 325 + .control_base = 326 + ( LCD_CONTROL_SBPPF_565 327 + | LCD_CONTROL_C 328 + | LCD_CONTROL_SM_0 329 + | LCD_CONTROL_DEFAULT_PO 330 + | LCD_CONTROL_PT 331 + | LCD_CONTROL_PC 332 + | LCD_CONTROL_BPP_16 ), 333 + .horztiming = 334 + ( LCD_HORZTIMING_HN2_N(8) 335 + | LCD_HORZTIMING_HN1_N(60) 336 + | LCD_HORZTIMING_HPW_N(12) 337 + | LCD_HORZTIMING_PPL_N(320) ), 338 + .verttiming = 339 + ( LCD_VERTTIMING_VN2_N(5) 340 + | LCD_VERTTIMING_VN1_N(17) 341 + | LCD_VERTTIMING_VPW_N(1) 342 + | LCD_VERTTIMING_LPP_N(240) ), 343 + .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 344 + }, 345 + 346 + /* Hitachi SP14Q005 and possibly others */ 347 + [3] = { 348 + .name = "Hitachi_SP14Qxxx", 349 + .xres = 320, 350 + .yres = 240, 351 + .bpp = 4, 352 + .control_base = 353 + ( LCD_CONTROL_C 354 + | LCD_CONTROL_BPP_4 ), 355 + .horztiming = 356 + ( LCD_HORZTIMING_HN2_N(1) 357 + | LCD_HORZTIMING_HN1_N(1) 358 + | LCD_HORZTIMING_HPW_N(1) 359 + | LCD_HORZTIMING_PPL_N(320) ), 360 + .verttiming = 361 + ( LCD_VERTTIMING_VN2_N(1) 362 + | LCD_VERTTIMING_VN1_N(1) 363 + | LCD_VERTTIMING_VPW_N(1) 364 + | LCD_VERTTIMING_LPP_N(240) ), 365 + .clkcontrol_base = LCD_CLKCONTROL_PCD_N(4), 366 + }, 367 + 368 + /* Generic 640x480 TFT panel */ 369 + [4] = { 370 + .name = "TFT_640x480_16", 371 + .xres = 640, 372 + .yres = 480, 373 + .bpp = 16, 374 + .control_base = 0x004806a | LCD_CONTROL_DEFAULT_PO, 375 + .horztiming = 0x3434d67f, 376 + .verttiming = 0x0e0e39df, 377 + .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 378 + }, 379 + 380 + /* Pb1100 LCDB 640x480 PrimeView TFT panel */ 381 + [5] = { 382 + .name = "PrimeView_640x480_16", 383 + .xres = 640, 384 + .yres = 480, 385 + .bpp = 16, 386 + .control_base = 0x0004886a | LCD_CONTROL_DEFAULT_PO, 387 + .horztiming = 0x0e4bfe7f, 388 + .verttiming = 0x210805df, 389 + .clkcontrol_base = 0x00038001, 390 + }, 391 + }; 392 + 393 + /********************************************************************/ 394 + 395 + /* Inline helpers */ 396 + 397 + #define panel_is_dual(panel) (panel->control_base & LCD_CONTROL_DP) 398 + #define panel_is_active(panel)(panel->control_base & LCD_CONTROL_PT) 399 + #define panel_is_color(panel) (panel->control_base & LCD_CONTROL_PC) 400 + #define panel_swap_rgb(panel) (panel->control_base & LCD_CONTROL_CCO) 64 401 65 402 #if defined(CONFIG_COMPILE_TEST) && !defined(CONFIG_MIPS) 66 403 /* This is only defined to be able to compile this driver on non-mips platforms */
-372
drivers/video/fbdev/au1100fb.h
··· 1 - /* 2 - * BRIEF MODULE DESCRIPTION 3 - * Hardware definitions for the Au1100 LCD controller 4 - * 5 - * Copyright 2002 MontaVista Software 6 - * Copyright 2002 Alchemy Semiconductor 7 - * Author: Alchemy Semiconductor, MontaVista Software 8 - * 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. 13 - * 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. 24 - * 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. 28 - */ 29 - 30 - #ifndef _AU1100LCD_H 31 - #define _AU1100LCD_H 32 - 33 - #if defined(__BIG_ENDIAN) 34 - #define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11 35 - #else 36 - #define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00 37 - #endif 38 - #define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565 39 - 40 - /********************************************************************/ 41 - 42 - /* LCD controller restrictions */ 43 - #define AU1100_LCD_MAX_XRES 800 44 - #define AU1100_LCD_MAX_YRES 600 45 - #define AU1100_LCD_MAX_BPP 16 46 - #define AU1100_LCD_MAX_CLK 48000000 47 - #define AU1100_LCD_NBR_PALETTE_ENTRIES 256 48 - 49 - /* Default number of visible screen buffer to allocate */ 50 - #define AU1100FB_NBR_VIDEO_BUFFERS 4 51 - 52 - /********************************************************************/ 53 - 54 - struct au1100fb_panel 55 - { 56 - const char name[25]; /* Full name <vendor>_<model> */ 57 - 58 - u32 control_base; /* Mode-independent control values */ 59 - u32 clkcontrol_base; /* Panel pixclock preferences */ 60 - 61 - u32 horztiming; 62 - u32 verttiming; 63 - 64 - u32 xres; /* Maximum horizontal resolution */ 65 - u32 yres; /* Maximum vertical resolution */ 66 - u32 bpp; /* Maximum depth supported */ 67 - }; 68 - 69 - struct au1100fb_regs 70 - { 71 - u32 lcd_control; 72 - u32 lcd_intstatus; 73 - u32 lcd_intenable; 74 - u32 lcd_horztiming; 75 - u32 lcd_verttiming; 76 - u32 lcd_clkcontrol; 77 - u32 lcd_dmaaddr0; 78 - u32 lcd_dmaaddr1; 79 - u32 lcd_words; 80 - u32 lcd_pwmdiv; 81 - u32 lcd_pwmhi; 82 - u32 reserved[(0x0400-0x002C)/4]; 83 - u32 lcd_palettebase[256]; 84 - }; 85 - 86 - struct au1100fb_device { 87 - 88 - struct fb_info info; /* FB driver info record */ 89 - 90 - struct au1100fb_panel *panel; /* Panel connected to this device */ 91 - 92 - struct au1100fb_regs* regs; /* Registers memory map */ 93 - size_t regs_len; 94 - unsigned int regs_phys; 95 - 96 - #ifdef CONFIG_PM 97 - /* stores the register values during suspend */ 98 - struct au1100fb_regs pm_regs; 99 - #endif 100 - 101 - unsigned char* fb_mem; /* FrameBuffer memory map */ 102 - size_t fb_len; 103 - dma_addr_t fb_phys; 104 - int panel_idx; 105 - struct clk *lcdclk; 106 - struct device *dev; 107 - }; 108 - 109 - /********************************************************************/ 110 - 111 - #define LCD_CONTROL (AU1100_LCD_BASE + 0x0) 112 - #define LCD_CONTROL_SBB_BIT 21 113 - #define LCD_CONTROL_SBB_MASK (0x3 << LCD_CONTROL_SBB_BIT) 114 - #define LCD_CONTROL_SBB_1 (0 << LCD_CONTROL_SBB_BIT) 115 - #define LCD_CONTROL_SBB_2 (1 << LCD_CONTROL_SBB_BIT) 116 - #define LCD_CONTROL_SBB_3 (2 << LCD_CONTROL_SBB_BIT) 117 - #define LCD_CONTROL_SBB_4 (3 << LCD_CONTROL_SBB_BIT) 118 - #define LCD_CONTROL_SBPPF_BIT 18 119 - #define LCD_CONTROL_SBPPF_MASK (0x7 << LCD_CONTROL_SBPPF_BIT) 120 - #define LCD_CONTROL_SBPPF_655 (0 << LCD_CONTROL_SBPPF_BIT) 121 - #define LCD_CONTROL_SBPPF_565 (1 << LCD_CONTROL_SBPPF_BIT) 122 - #define LCD_CONTROL_SBPPF_556 (2 << LCD_CONTROL_SBPPF_BIT) 123 - #define LCD_CONTROL_SBPPF_1555 (3 << LCD_CONTROL_SBPPF_BIT) 124 - #define LCD_CONTROL_SBPPF_5551 (4 << LCD_CONTROL_SBPPF_BIT) 125 - #define LCD_CONTROL_WP (1<<17) 126 - #define LCD_CONTROL_WD (1<<16) 127 - #define LCD_CONTROL_C (1<<15) 128 - #define LCD_CONTROL_SM_BIT 13 129 - #define LCD_CONTROL_SM_MASK (0x3 << LCD_CONTROL_SM_BIT) 130 - #define LCD_CONTROL_SM_0 (0 << LCD_CONTROL_SM_BIT) 131 - #define LCD_CONTROL_SM_90 (1 << LCD_CONTROL_SM_BIT) 132 - #define LCD_CONTROL_SM_180 (2 << LCD_CONTROL_SM_BIT) 133 - #define LCD_CONTROL_SM_270 (3 << LCD_CONTROL_SM_BIT) 134 - #define LCD_CONTROL_DB (1<<12) 135 - #define LCD_CONTROL_CCO (1<<11) 136 - #define LCD_CONTROL_DP (1<<10) 137 - #define LCD_CONTROL_PO_BIT 8 138 - #define LCD_CONTROL_PO_MASK (0x3 << LCD_CONTROL_PO_BIT) 139 - #define LCD_CONTROL_PO_00 (0 << LCD_CONTROL_PO_BIT) 140 - #define LCD_CONTROL_PO_01 (1 << LCD_CONTROL_PO_BIT) 141 - #define LCD_CONTROL_PO_10 (2 << LCD_CONTROL_PO_BIT) 142 - #define LCD_CONTROL_PO_11 (3 << LCD_CONTROL_PO_BIT) 143 - #define LCD_CONTROL_MPI (1<<7) 144 - #define LCD_CONTROL_PT (1<<6) 145 - #define LCD_CONTROL_PC (1<<5) 146 - #define LCD_CONTROL_BPP_BIT 1 147 - #define LCD_CONTROL_BPP_MASK (0x7 << LCD_CONTROL_BPP_BIT) 148 - #define LCD_CONTROL_BPP_1 (0 << LCD_CONTROL_BPP_BIT) 149 - #define LCD_CONTROL_BPP_2 (1 << LCD_CONTROL_BPP_BIT) 150 - #define LCD_CONTROL_BPP_4 (2 << LCD_CONTROL_BPP_BIT) 151 - #define LCD_CONTROL_BPP_8 (3 << LCD_CONTROL_BPP_BIT) 152 - #define LCD_CONTROL_BPP_12 (4 << LCD_CONTROL_BPP_BIT) 153 - #define LCD_CONTROL_BPP_16 (5 << LCD_CONTROL_BPP_BIT) 154 - #define LCD_CONTROL_GO (1<<0) 155 - 156 - #define LCD_INTSTATUS (AU1100_LCD_BASE + 0x4) 157 - #define LCD_INTENABLE (AU1100_LCD_BASE + 0x8) 158 - #define LCD_INT_SD (1<<7) 159 - #define LCD_INT_OF (1<<6) 160 - #define LCD_INT_UF (1<<5) 161 - #define LCD_INT_SA (1<<3) 162 - #define LCD_INT_SS (1<<2) 163 - #define LCD_INT_S1 (1<<1) 164 - #define LCD_INT_S0 (1<<0) 165 - 166 - #define LCD_HORZTIMING (AU1100_LCD_BASE + 0xC) 167 - #define LCD_HORZTIMING_HN2_BIT 24 168 - #define LCD_HORZTIMING_HN2_MASK (0xFF << LCD_HORZTIMING_HN2_BIT) 169 - #define LCD_HORZTIMING_HN2_N(N) ((((N)-1) << LCD_HORZTIMING_HN2_BIT) & LCD_HORZTIMING_HN2_MASK) 170 - #define LCD_HORZTIMING_HN1_BIT 16 171 - #define LCD_HORZTIMING_HN1_MASK (0xFF << LCD_HORZTIMING_HN1_BIT) 172 - #define LCD_HORZTIMING_HN1_N(N) ((((N)-1) << LCD_HORZTIMING_HN1_BIT) & LCD_HORZTIMING_HN1_MASK) 173 - #define LCD_HORZTIMING_HPW_BIT 10 174 - #define LCD_HORZTIMING_HPW_MASK (0x3F << LCD_HORZTIMING_HPW_BIT) 175 - #define LCD_HORZTIMING_HPW_N(N) ((((N)-1) << LCD_HORZTIMING_HPW_BIT) & LCD_HORZTIMING_HPW_MASK) 176 - #define LCD_HORZTIMING_PPL_BIT 0 177 - #define LCD_HORZTIMING_PPL_MASK (0x3FF << LCD_HORZTIMING_PPL_BIT) 178 - #define LCD_HORZTIMING_PPL_N(N) ((((N)-1) << LCD_HORZTIMING_PPL_BIT) & LCD_HORZTIMING_PPL_MASK) 179 - 180 - #define LCD_VERTTIMING (AU1100_LCD_BASE + 0x10) 181 - #define LCD_VERTTIMING_VN2_BIT 24 182 - #define LCD_VERTTIMING_VN2_MASK (0xFF << LCD_VERTTIMING_VN2_BIT) 183 - #define LCD_VERTTIMING_VN2_N(N) ((((N)-1) << LCD_VERTTIMING_VN2_BIT) & LCD_VERTTIMING_VN2_MASK) 184 - #define LCD_VERTTIMING_VN1_BIT 16 185 - #define LCD_VERTTIMING_VN1_MASK (0xFF << LCD_VERTTIMING_VN1_BIT) 186 - #define LCD_VERTTIMING_VN1_N(N) ((((N)-1) << LCD_VERTTIMING_VN1_BIT) & LCD_VERTTIMING_VN1_MASK) 187 - #define LCD_VERTTIMING_VPW_BIT 10 188 - #define LCD_VERTTIMING_VPW_MASK (0x3F << LCD_VERTTIMING_VPW_BIT) 189 - #define LCD_VERTTIMING_VPW_N(N) ((((N)-1) << LCD_VERTTIMING_VPW_BIT) & LCD_VERTTIMING_VPW_MASK) 190 - #define LCD_VERTTIMING_LPP_BIT 0 191 - #define LCD_VERTTIMING_LPP_MASK (0x3FF << LCD_VERTTIMING_LPP_BIT) 192 - #define LCD_VERTTIMING_LPP_N(N) ((((N)-1) << LCD_VERTTIMING_LPP_BIT) & LCD_VERTTIMING_LPP_MASK) 193 - 194 - #define LCD_CLKCONTROL (AU1100_LCD_BASE + 0x14) 195 - #define LCD_CLKCONTROL_IB (1<<18) 196 - #define LCD_CLKCONTROL_IC (1<<17) 197 - #define LCD_CLKCONTROL_IH (1<<16) 198 - #define LCD_CLKCONTROL_IV (1<<15) 199 - #define LCD_CLKCONTROL_BF_BIT 10 200 - #define LCD_CLKCONTROL_BF_MASK (0x1F << LCD_CLKCONTROL_BF_BIT) 201 - #define LCD_CLKCONTROL_BF_N(N) ((((N)-1) << LCD_CLKCONTROL_BF_BIT) & LCD_CLKCONTROL_BF_MASK) 202 - #define LCD_CLKCONTROL_PCD_BIT 0 203 - #define LCD_CLKCONTROL_PCD_MASK (0x3FF << LCD_CLKCONTROL_PCD_BIT) 204 - #define LCD_CLKCONTROL_PCD_N(N) (((N) << LCD_CLKCONTROL_PCD_BIT) & LCD_CLKCONTROL_PCD_MASK) 205 - 206 - #define LCD_DMAADDR0 (AU1100_LCD_BASE + 0x18) 207 - #define LCD_DMAADDR1 (AU1100_LCD_BASE + 0x1C) 208 - #define LCD_DMA_SA_BIT 5 209 - #define LCD_DMA_SA_MASK (0x7FFFFFF << LCD_DMA_SA_BIT) 210 - #define LCD_DMA_SA_N(N) ((N) & LCD_DMA_SA_MASK) 211 - 212 - #define LCD_WORDS (AU1100_LCD_BASE + 0x20) 213 - #define LCD_WRD_WRDS_BIT 0 214 - #define LCD_WRD_WRDS_MASK (0xFFFFFFFF << LCD_WRD_WRDS_BIT) 215 - #define LCD_WRD_WRDS_N(N) ((((N)-1) << LCD_WRD_WRDS_BIT) & LCD_WRD_WRDS_MASK) 216 - 217 - #define LCD_PWMDIV (AU1100_LCD_BASE + 0x24) 218 - #define LCD_PWMDIV_EN (1<<12) 219 - #define LCD_PWMDIV_PWMDIV_BIT 0 220 - #define LCD_PWMDIV_PWMDIV_MASK (0xFFF << LCD_PWMDIV_PWMDIV_BIT) 221 - #define LCD_PWMDIV_PWMDIV_N(N) ((((N)-1) << LCD_PWMDIV_PWMDIV_BIT) & LCD_PWMDIV_PWMDIV_MASK) 222 - 223 - #define LCD_PWMHI (AU1100_LCD_BASE + 0x28) 224 - #define LCD_PWMHI_PWMHI1_BIT 12 225 - #define LCD_PWMHI_PWMHI1_MASK (0xFFF << LCD_PWMHI_PWMHI1_BIT) 226 - #define LCD_PWMHI_PWMHI1_N(N) (((N) << LCD_PWMHI_PWMHI1_BIT) & LCD_PWMHI_PWMHI1_MASK) 227 - #define LCD_PWMHI_PWMHI0_BIT 0 228 - #define LCD_PWMHI_PWMHI0_MASK (0xFFF << LCD_PWMHI_PWMHI0_BIT) 229 - #define LCD_PWMHI_PWMHI0_N(N) (((N) << LCD_PWMHI_PWMHI0_BIT) & LCD_PWMHI_PWMHI0_MASK) 230 - 231 - #define LCD_PALLETTEBASE (AU1100_LCD_BASE + 0x400) 232 - #define LCD_PALLETTE_MONO_MI_BIT 0 233 - #define LCD_PALLETTE_MONO_MI_MASK (0xF << LCD_PALLETTE_MONO_MI_BIT) 234 - #define LCD_PALLETTE_MONO_MI_N(N) (((N)<< LCD_PALLETTE_MONO_MI_BIT) & LCD_PALLETTE_MONO_MI_MASK) 235 - 236 - #define LCD_PALLETTE_COLOR_RI_BIT 8 237 - #define LCD_PALLETTE_COLOR_RI_MASK (0xF << LCD_PALLETTE_COLOR_RI_BIT) 238 - #define LCD_PALLETTE_COLOR_RI_N(N) (((N)<< LCD_PALLETTE_COLOR_RI_BIT) & LCD_PALLETTE_COLOR_RI_MASK) 239 - #define LCD_PALLETTE_COLOR_GI_BIT 4 240 - #define LCD_PALLETTE_COLOR_GI_MASK (0xF << LCD_PALLETTE_COLOR_GI_BIT) 241 - #define LCD_PALLETTE_COLOR_GI_N(N) (((N)<< LCD_PALLETTE_COLOR_GI_BIT) & LCD_PALLETTE_COLOR_GI_MASK) 242 - #define LCD_PALLETTE_COLOR_BI_BIT 0 243 - #define LCD_PALLETTE_COLOR_BI_MASK (0xF << LCD_PALLETTE_COLOR_BI_BIT) 244 - #define LCD_PALLETTE_COLOR_BI_N(N) (((N)<< LCD_PALLETTE_COLOR_BI_BIT) & LCD_PALLETTE_COLOR_BI_MASK) 245 - 246 - #define LCD_PALLETTE_TFT_DC_BIT 0 247 - #define LCD_PALLETTE_TFT_DC_MASK (0xFFFF << LCD_PALLETTE_TFT_DC_BIT) 248 - #define LCD_PALLETTE_TFT_DC_N(N) (((N)<< LCD_PALLETTE_TFT_DC_BIT) & LCD_PALLETTE_TFT_DC_MASK) 249 - 250 - /********************************************************************/ 251 - 252 - /* List of panels known to work with the AU1100 LCD controller. 253 - * To add a new panel, enter the same specifications as the 254 - * Generic_TFT one, and MAKE SURE that it doesn't conflicts 255 - * with the controller restrictions. Restrictions are: 256 - * 257 - * STN color panels: max_bpp <= 12 258 - * STN mono panels: max_bpp <= 4 259 - * TFT panels: max_bpp <= 16 260 - * max_xres <= 800 261 - * max_yres <= 600 262 - */ 263 - static struct au1100fb_panel known_lcd_panels[] = 264 - { 265 - /* 800x600x16bpp CRT */ 266 - [0] = { 267 - .name = "CRT_800x600_16", 268 - .xres = 800, 269 - .yres = 600, 270 - .bpp = 16, 271 - .control_base = 0x0004886A | 272 - LCD_CONTROL_DEFAULT_PO | LCD_CONTROL_DEFAULT_SBPPF | 273 - LCD_CONTROL_BPP_16 | LCD_CONTROL_SBB_4, 274 - .clkcontrol_base = 0x00020000, 275 - .horztiming = 0x005aff1f, 276 - .verttiming = 0x16000e57, 277 - }, 278 - /* just the standard LCD */ 279 - [1] = { 280 - .name = "WWPC LCD", 281 - .xres = 240, 282 - .yres = 320, 283 - .bpp = 16, 284 - .control_base = 0x0006806A, 285 - .horztiming = 0x0A1010EF, 286 - .verttiming = 0x0301013F, 287 - .clkcontrol_base = 0x00018001, 288 - }, 289 - /* Sharp 320x240 TFT panel */ 290 - [2] = { 291 - .name = "Sharp_LQ038Q5DR01", 292 - .xres = 320, 293 - .yres = 240, 294 - .bpp = 16, 295 - .control_base = 296 - ( LCD_CONTROL_SBPPF_565 297 - | LCD_CONTROL_C 298 - | LCD_CONTROL_SM_0 299 - | LCD_CONTROL_DEFAULT_PO 300 - | LCD_CONTROL_PT 301 - | LCD_CONTROL_PC 302 - | LCD_CONTROL_BPP_16 ), 303 - .horztiming = 304 - ( LCD_HORZTIMING_HN2_N(8) 305 - | LCD_HORZTIMING_HN1_N(60) 306 - | LCD_HORZTIMING_HPW_N(12) 307 - | LCD_HORZTIMING_PPL_N(320) ), 308 - .verttiming = 309 - ( LCD_VERTTIMING_VN2_N(5) 310 - | LCD_VERTTIMING_VN1_N(17) 311 - | LCD_VERTTIMING_VPW_N(1) 312 - | LCD_VERTTIMING_LPP_N(240) ), 313 - .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 314 - }, 315 - 316 - /* Hitachi SP14Q005 and possibly others */ 317 - [3] = { 318 - .name = "Hitachi_SP14Qxxx", 319 - .xres = 320, 320 - .yres = 240, 321 - .bpp = 4, 322 - .control_base = 323 - ( LCD_CONTROL_C 324 - | LCD_CONTROL_BPP_4 ), 325 - .horztiming = 326 - ( LCD_HORZTIMING_HN2_N(1) 327 - | LCD_HORZTIMING_HN1_N(1) 328 - | LCD_HORZTIMING_HPW_N(1) 329 - | LCD_HORZTIMING_PPL_N(320) ), 330 - .verttiming = 331 - ( LCD_VERTTIMING_VN2_N(1) 332 - | LCD_VERTTIMING_VN1_N(1) 333 - | LCD_VERTTIMING_VPW_N(1) 334 - | LCD_VERTTIMING_LPP_N(240) ), 335 - .clkcontrol_base = LCD_CLKCONTROL_PCD_N(4), 336 - }, 337 - 338 - /* Generic 640x480 TFT panel */ 339 - [4] = { 340 - .name = "TFT_640x480_16", 341 - .xres = 640, 342 - .yres = 480, 343 - .bpp = 16, 344 - .control_base = 0x004806a | LCD_CONTROL_DEFAULT_PO, 345 - .horztiming = 0x3434d67f, 346 - .verttiming = 0x0e0e39df, 347 - .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1), 348 - }, 349 - 350 - /* Pb1100 LCDB 640x480 PrimeView TFT panel */ 351 - [5] = { 352 - .name = "PrimeView_640x480_16", 353 - .xres = 640, 354 - .yres = 480, 355 - .bpp = 16, 356 - .control_base = 0x0004886a | LCD_CONTROL_DEFAULT_PO, 357 - .horztiming = 0x0e4bfe7f, 358 - .verttiming = 0x210805df, 359 - .clkcontrol_base = 0x00038001, 360 - }, 361 - }; 362 - 363 - /********************************************************************/ 364 - 365 - /* Inline helpers */ 366 - 367 - #define panel_is_dual(panel) (panel->control_base & LCD_CONTROL_DP) 368 - #define panel_is_active(panel)(panel->control_base & LCD_CONTROL_PT) 369 - #define panel_is_color(panel) (panel->control_base & LCD_CONTROL_PC) 370 - #define panel_swap_rgb(panel) (panel->control_base & LCD_CONTROL_CCO) 371 - 372 - #endif /* _AU1100LCD_H */