blob: 41a6c2297f9fa59ac9a51cf673c877e2e080dd84 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * linux/include/asm-arm/arch-pxa/pxafb.h
3 *
4 * Support for the xscale frame buffer.
5 *
6 * Author: Jean-Frederic Clere
7 * Created: Sep 22, 2003
8 * Copyright: jfclere@sinix.net
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
Richard Purdied14b2722006-09-20 22:54:21 +010015#include <linux/fb.h>
eric miaoce4fb7b2008-04-30 00:52:21 -070016#include <asm/arch/regs-lcd.h>
Richard Purdied14b2722006-09-20 22:54:21 +010017
Linus Torvalds1da177e2005-04-16 15:20:36 -070018/*
eric miao84f43c32008-04-30 00:52:22 -070019 * Supported LCD connections
20 *
21 * bits 0 - 3: for LCD panel type:
22 *
23 * STN - for passive matrix
24 * DSTN - for dual scan passive matrix
25 * TFT - for active matrix
26 *
27 * bits 4 - 9 : for bus width
28 * bits 10-17 : for AC Bias Pin Frequency
29 * bit 18 : for output enable polarity
30 * bit 19 : for pixel clock edge
31 */
32#define LCD_CONN_TYPE(_x) ((_x) & 0x0f)
33#define LCD_CONN_WIDTH(_x) (((_x) >> 4) & 0x1f)
34
35#define LCD_TYPE_UNKNOWN 0
36#define LCD_TYPE_MONO_STN 1
37#define LCD_TYPE_MONO_DSTN 2
38#define LCD_TYPE_COLOR_STN 3
39#define LCD_TYPE_COLOR_DSTN 4
40#define LCD_TYPE_COLOR_TFT 5
41#define LCD_TYPE_SMART_PANEL 6
42#define LCD_TYPE_MAX 7
43
44#define LCD_MONO_STN_4BPP ((4 << 4) | LCD_TYPE_MONO_STN)
45#define LCD_MONO_STN_8BPP ((8 << 4) | LCD_TYPE_MONO_STN)
46#define LCD_MONO_DSTN_8BPP ((8 << 4) | LCD_TYPE_MONO_DSTN)
47#define LCD_COLOR_STN_8BPP ((8 << 4) | LCD_TYPE_COLOR_STN)
48#define LCD_COLOR_DSTN_16BPP ((16 << 4) | LCD_TYPE_COLOR_DSTN)
49#define LCD_COLOR_TFT_16BPP ((16 << 4) | LCD_TYPE_COLOR_TFT)
50#define LCD_COLOR_TFT_18BPP ((18 << 4) | LCD_TYPE_COLOR_TFT)
51#define LCD_SMART_PANEL_16BPP ((16 << 4) | LCD_TYPE_SMART_PANEL)
52#define LCD_SMART_PANEL_18BPP ((18 << 4) | LCD_TYPE_SMART_PANEL)
53
54#define LCD_AC_BIAS_FREQ(x) (((x) & 0xff) << 10)
55#define LCD_BIAS_ACTIVE_HIGH (0 << 17)
56#define LCD_BIAS_ACTIVE_LOW (1 << 17)
57#define LCD_PCLK_EDGE_RISE (0 << 18)
58#define LCD_PCLK_EDGE_FALL (1 << 18)
59
60/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 * This structure describes the machine which we are running on.
62 * It is set in linux/arch/arm/mach-pxa/machine_name.c and used in the probe routine
63 * of linux/drivers/video/pxafb.c
64 */
Richard Purdied14b2722006-09-20 22:54:21 +010065struct pxafb_mode_info {
Linus Torvalds1da177e2005-04-16 15:20:36 -070066 u_long pixclock;
67
68 u_short xres;
69 u_short yres;
70
71 u_char bpp;
72 u_char hsync_len;
73 u_char left_margin;
74 u_char right_margin;
75
76 u_char vsync_len;
77 u_char upper_margin;
78 u_char lower_margin;
79 u_char sync;
80
81 u_int cmap_greyscale:1,
Richard Purdied14b2722006-09-20 22:54:21 +010082 unused:31;
83};
84
85struct pxafb_mach_info {
86 struct pxafb_mode_info *modes;
87 unsigned int num_modes;
88
eric miao84f43c32008-04-30 00:52:22 -070089 unsigned int lcd_conn;
90
Richard Purdied14b2722006-09-20 22:54:21 +010091 u_int fixed_modes:1,
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 cmap_inverse:1,
93 cmap_static:1,
94 unused:29;
95
96 /* The following should be defined in LCCR0
97 * LCCR0_Act or LCCR0_Pas Active or Passive
98 * LCCR0_Sngl or LCCR0_Dual Single/Dual panel
99 * LCCR0_Mono or LCCR0_Color Mono/Color
100 * LCCR0_4PixMono or LCCR0_8PixMono (in mono single mode)
101 * LCCR0_DMADel(Tcpu) (optional) DMA request delay
102 *
103 * The following should not be defined in LCCR0:
104 * LCCR0_OUM, LCCR0_BM, LCCR0_QDM, LCCR0_DIS, LCCR0_EFM
105 * LCCR0_IUM, LCCR0_SFM, LCCR0_LDM, LCCR0_ENB
106 */
107 u_int lccr0;
108 /* The following should be defined in LCCR3
109 * LCCR3_OutEnH or LCCR3_OutEnL Output enable polarity
110 * LCCR3_PixRsEdg or LCCR3_PixFlEdg Pixel clock edge type
111 * LCCR3_Acb(X) AB Bias pin frequency
112 * LCCR3_DPC (optional) Double Pixel Clock mode (untested)
113 *
114 * The following should not be defined in LCCR3
115 * LCCR3_HSP, LCCR3_VSP, LCCR0_Pcd(x), LCCR3_Bpp
116 */
117 u_int lccr3;
Hans J. Koch9ffa7392007-10-16 01:28:41 -0700118 /* The following should be defined in LCCR4
119 * LCCR4_PAL_FOR_0 or LCCR4_PAL_FOR_1 or LCCR4_PAL_FOR_2
120 *
121 * All other bits in LCCR4 should be left alone.
122 */
123 u_int lccr4;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124 void (*pxafb_backlight_power)(int);
Richard Purdied14b2722006-09-20 22:54:21 +0100125 void (*pxafb_lcd_power)(int, struct fb_var_screeninfo *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126
127};
128void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
Richard Purdiecb38c562005-10-14 16:07:25 +0100129void set_pxa_fb_parent(struct device *parent_dev);
Richard Purdieba44cd22005-09-09 13:10:03 -0700130unsigned long pxafb_get_hsync_time(struct device *dev);