Skip to content

Commit cd849d2

Browse files
ukleinekhdeller
authored andcommitted
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>
1 parent bcf4373 commit cd849d2

2 files changed

Lines changed: 338 additions & 373 deletions

File tree

drivers/video/fbdev/au1100fb.c

Lines changed: 338 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,344 @@
6060
#include <linux/platform_device.h>
6161
#include <linux/slab.h>
6262

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)
64401

65402
#if defined(CONFIG_COMPILE_TEST) && !defined(CONFIG_MIPS)
66403
/* This is only defined to be able to compile this driver on non-mips platforms */

0 commit comments

Comments
 (0)