Blame view

drivers/video/pxafb.h 4.25 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
  #ifndef __PXAFB_H__
  #define __PXAFB_H__
  
  /*
   * linux/drivers/video/pxafb.h
   *    -- Intel PXA250/210 LCD Controller Frame Buffer Device
   *
   *  Copyright (C) 1999 Eric A. Thomas.
   *  Copyright (C) 2004 Jean-Frederic Clere.
   *  Copyright (C) 2004 Ian Campbell.
   *  Copyright (C) 2004 Jeff Lackey.
   *   Based on sa1100fb.c Copyright (C) 1999 Eric A. Thomas
   *  which in turn is
   *   Based on acornfb.c Copyright (C) Russell King.
   *
   *  2001-08-03: Cliff Brake <cbrake@acclent.com>
   *	 - ported SA1100 code to PXA
   *
   * This file is subject to the terms and conditions of the GNU General Public
   * License.  See the file COPYING in the main directory of this archive
   * for more details.
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
23
24
25
26
27
28
29
  /* PXA LCD DMA descriptor */
  struct pxafb_dma_descriptor {
  	unsigned int fdadr;
  	unsigned int fsadr;
  	unsigned int fidr;
  	unsigned int ldcmd;
  };
2c42dd8eb   eric miao   pxafb: introduce ...
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  enum {
  	PAL_NONE	= -1,
  	PAL_BASE	= 0,
  	PAL_OV1		= 1,
  	PAL_OV2		= 2,
  	PAL_MAX,
  };
  
  enum {
  	DMA_BASE	= 0,
  	DMA_UPPER	= 0,
  	DMA_LOWER	= 1,
  	DMA_OV1		= 1,
  	DMA_OV2_Y	= 2,
  	DMA_OV2_Cb	= 3,
  	DMA_OV2_Cr	= 4,
  	DMA_CURSOR	= 5,
  	DMA_CMD		= 6,
  	DMA_MAX,
  };
  
  /* maximum palette size - 256 entries, each 4 bytes long */
  #define PALETTE_SIZE	(256 * 4)
3c42a4491   Eric Miao   pxafb: preliminar...
53
  #define CMD_BUFF_SIZE	(1024 * 50)
2c42dd8eb   eric miao   pxafb: introduce ...
54

6e354846e   Eric Miao   [ARM] pxafb: add ...
55
56
57
  /* NOTE: the palette and frame dma descriptors are doubled to allow
   * the 2nd set for branch settings (FBRx)
   */
2c42dd8eb   eric miao   pxafb: introduce ...
58
59
  struct pxafb_dma_buff {
  	unsigned char palette[PAL_MAX * PALETTE_SIZE];
3c42a4491   Eric Miao   pxafb: preliminar...
60
  	uint16_t cmd_buff[CMD_BUFF_SIZE];
6e354846e   Eric Miao   [ARM] pxafb: add ...
61
62
  	struct pxafb_dma_descriptor pal_desc[PAL_MAX * 2];
  	struct pxafb_dma_descriptor dma_desc[DMA_MAX * 2];
2c42dd8eb   eric miao   pxafb: introduce ...
63
  };
198fc108e   Eric Miao   [ARM] pxafb: add ...
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  enum {
  	OVERLAY1,
  	OVERLAY2,
  };
  
  enum {
  	OVERLAY_FORMAT_RGB = 0,
  	OVERLAY_FORMAT_YUV444_PACKED,
  	OVERLAY_FORMAT_YUV444_PLANAR,
  	OVERLAY_FORMAT_YUV422_PLANAR,
  	OVERLAY_FORMAT_YUV420_PLANAR,
  };
  
  #define NONSTD_TO_XPOS(x)	(((x) >> 0)  & 0x3ff)
  #define NONSTD_TO_YPOS(x)	(((x) >> 10) & 0x3ff)
  #define NONSTD_TO_PFOR(x)	(((x) >> 20) & 0x7)
  
  struct pxafb_layer;
  
  struct pxafb_layer_ops {
  	void (*enable)(struct pxafb_layer *);
  	void (*disable)(struct pxafb_layer *);
  	void (*setup)(struct pxafb_layer *);
  };
  
  struct pxafb_layer {
  	struct fb_info		fb;
  	int			id;
1b98d7c44   Vasily Khoruzhick   ARM: pxafb: rewor...
92
93
  	int			registered;
  	uint32_t		usage;
198fc108e   Eric Miao   [ARM] pxafb: add ...
94
95
96
97
98
99
100
101
102
103
104
  	uint32_t		control[2];
  
  	struct pxafb_layer_ops	*ops;
  
  	void __iomem		*video_mem;
  	unsigned long		video_mem_phys;
  	size_t			video_mem_size;
  	struct completion	branch_done;
  
  	struct pxafb_info	*fbi;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
105
106
107
  struct pxafb_info {
  	struct fb_info		fb;
  	struct device		*dev;
72e3524c0   Russell King   [ARM] pxa: update...
108
  	struct clk		*clk;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
109

ce4fb7b89   eric miao   pxafb: convert fb...
110
  	void __iomem		*mmio_base;
2c42dd8eb   eric miao   pxafb: introduce ...
111
  	struct pxafb_dma_buff	*dma_buff;
77e196752   Eric Miao   [ARM] pxafb: allo...
112
  	size_t			dma_buff_size;
2c42dd8eb   eric miao   pxafb: introduce ...
113
  	dma_addr_t		dma_buff_phys;
6e354846e   Eric Miao   [ARM] pxafb: add ...
114
  	dma_addr_t		fdadr[DMA_MAX * 2];
2c42dd8eb   eric miao   pxafb: introduce ...
115

77e196752   Eric Miao   [ARM] pxafb: allo...
116
117
118
  	void __iomem		*video_mem;	/* virtual address of frame buffer */
  	unsigned long		video_mem_phys;	/* physical address of frame buffer */
  	size_t			video_mem_size;	/* size of the frame buffer */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
119
  	u16 *			palette_cpu;	/* virtual address of palette memory */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
120
  	u_int			palette_size;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
121
122
  	u_int			lccr0;
  	u_int			lccr3;
9ffa73960   Hans J. Koch   pxafb: Add suppor...
123
  	u_int			lccr4;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
124
125
126
127
128
129
130
131
  	u_int			cmap_inverse:1,
  				cmap_static:1,
  				unused:30;
  
  	u_int			reg_lccr0;
  	u_int			reg_lccr1;
  	u_int			reg_lccr2;
  	u_int			reg_lccr3;
9ffa73960   Hans J. Koch   pxafb: Add suppor...
132
  	u_int			reg_lccr4;
3c42a4491   Eric Miao   pxafb: preliminar...
133
  	u_int			reg_cmdcr;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
134

ba44cd2d8   Richard Purdie   [PATCH] pxafb: Ad...
135
  	unsigned long	hsync_time;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
136
137
  	volatile u_char		state;
  	volatile u_char		task_state;
b91dbce56   Matthias Kaehlcke   pxafb: convert ct...
138
  	struct mutex		ctrlr_lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
139
140
  	wait_queue_head_t	ctrlr_wait;
  	struct work_struct	task;
2ba162b93   Eric Miao   pxafb: use comple...
141
  	struct completion	disable_done;
3c42a4491   Eric Miao   pxafb: preliminar...
142
143
144
145
146
147
148
  #ifdef CONFIG_FB_PXA_SMARTPANEL
  	uint16_t		*smart_cmds;
  	size_t			n_smart_cmds;
  	struct completion	command_done;
  	struct completion	refresh_done;
  	struct task_struct	*smart_thread;
  #endif
198fc108e   Eric Miao   [ARM] pxafb: add ...
149
150
151
  #ifdef CONFIG_FB_PXA_OVERLAY
  	struct pxafb_layer	overlay[2];
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
152
153
154
155
  #ifdef CONFIG_CPU_FREQ
  	struct notifier_block	freq_transition;
  	struct notifier_block	freq_policy;
  #endif
a5718a14a   Eric Miao   [ARM] pxafb: make...
156
157
158
  
  	void (*lcd_power)(int, struct fb_var_screeninfo *);
  	void (*backlight_power)(int);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
  };
  
  #define TO_INF(ptr,member) container_of(ptr,struct pxafb_info,member)
  
  /*
   * These are the actions for set_ctrlr_state
   */
  #define C_DISABLE		(0)
  #define C_ENABLE		(1)
  #define C_DISABLE_CLKCHANGE	(2)
  #define C_ENABLE_CLKCHANGE	(3)
  #define C_REENABLE		(4)
  #define C_DISABLE_PM		(5)
  #define C_ENABLE_PM		(6)
  #define C_STARTUP		(7)
  
  #define PXA_NAME	"PXA"
  
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
178
179
180
181
   * Minimum X and Y resolutions
   */
  #define MIN_XRES	64
  #define MIN_YRES	64
3f16ff608   Eric Miao   [ARM] pxafb: clea...
182
183
184
185
186
  /* maximum X and Y resolutions - note these are limits from the register
   * bits length instead of the real ones
   */
  #define MAX_XRES	1024
  #define MAX_YRES	1024
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
187
  #endif /* __PXAFB_H__ */