blob: f47f139fc5ed1265a7a75c4847aa588042686e9b [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __PXAFB_H__
2#define __PXAFB_H__
3
4/*
5 * linux/drivers/video/pxafb.h
6 * -- Intel PXA250/210 LCD Controller Frame Buffer Device
7 *
8 * Copyright (C) 1999 Eric A. Thomas.
9 * Copyright (C) 2004 Jean-Frederic Clere.
10 * Copyright (C) 2004 Ian Campbell.
11 * Copyright (C) 2004 Jeff Lackey.
12 * Based on sa1100fb.c Copyright (C) 1999 Eric A. Thomas
13 * which in turn is
14 * Based on acornfb.c Copyright (C) Russell King.
15 *
16 * 2001-08-03: Cliff Brake <cbrake@acclent.com>
17 * - ported SA1100 code to PXA
18 *
19 * This file is subject to the terms and conditions of the GNU General Public
20 * License. See the file COPYING in the main directory of this archive
21 * for more details.
22 */
23
24/* Shadows for LCD controller registers */
25struct pxafb_lcd_reg {
26 unsigned int lccr0;
27 unsigned int lccr1;
28 unsigned int lccr2;
29 unsigned int lccr3;
30};
31
32/* PXA LCD DMA descriptor */
33struct pxafb_dma_descriptor {
34 unsigned int fdadr;
35 unsigned int fsadr;
36 unsigned int fidr;
37 unsigned int ldcmd;
38};
39
eric miao2c42dd82008-04-30 00:52:21 -070040enum {
41 PAL_NONE = -1,
42 PAL_BASE = 0,
43 PAL_OV1 = 1,
44 PAL_OV2 = 2,
45 PAL_MAX,
46};
47
48enum {
49 DMA_BASE = 0,
50 DMA_UPPER = 0,
51 DMA_LOWER = 1,
52 DMA_OV1 = 1,
53 DMA_OV2_Y = 2,
54 DMA_OV2_Cb = 3,
55 DMA_OV2_Cr = 4,
56 DMA_CURSOR = 5,
57 DMA_CMD = 6,
58 DMA_MAX,
59};
60
61/* maximum palette size - 256 entries, each 4 bytes long */
62#define PALETTE_SIZE (256 * 4)
63
64struct pxafb_dma_buff {
65 unsigned char palette[PAL_MAX * PALETTE_SIZE];
66 struct pxafb_dma_descriptor pal_desc[PAL_MAX];
67 struct pxafb_dma_descriptor dma_desc[DMA_MAX];
68};
69
Linus Torvalds1da177e2005-04-16 15:20:36 -070070struct pxafb_info {
71 struct fb_info fb;
72 struct device *dev;
Russell King72e35242007-08-20 10:18:42 +010073 struct clk *clk;
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
eric miaoce4fb7b2008-04-30 00:52:21 -070075 void __iomem *mmio_base;
76
eric miao2c42dd82008-04-30 00:52:21 -070077 struct pxafb_dma_buff *dma_buff;
78 dma_addr_t dma_buff_phys;
79 dma_addr_t fdadr[DMA_MAX];
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 /*
82 * These are the addresses we mapped
83 * the framebuffer memory region to.
84 */
85 /* raw memory addresses */
86 dma_addr_t map_dma; /* physical */
87 u_char * map_cpu; /* virtual */
88 u_int map_size;
89
90 /* addresses of pieces placed in raw buffer */
91 u_char * screen_cpu; /* virtual address of frame buffer */
92 dma_addr_t screen_dma; /* physical address of frame buffer */
93 u16 * palette_cpu; /* virtual address of palette memory */
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 u_int palette_size;
95
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 u_int lccr0;
97 u_int lccr3;
Hans J. Koch9ffa7392007-10-16 01:28:41 -070098 u_int lccr4;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 u_int cmap_inverse:1,
100 cmap_static:1,
101 unused:30;
102
103 u_int reg_lccr0;
104 u_int reg_lccr1;
105 u_int reg_lccr2;
106 u_int reg_lccr3;
Hans J. Koch9ffa7392007-10-16 01:28:41 -0700107 u_int reg_lccr4;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108
Richard Purdieba44cd22005-09-09 13:10:03 -0700109 unsigned long hsync_time;
110
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111 volatile u_char state;
112 volatile u_char task_state;
113 struct semaphore ctrlr_sem;
114 wait_queue_head_t ctrlr_wait;
115 struct work_struct task;
116
Eric Miao2ba162b2008-04-30 00:52:24 -0700117 struct completion disable_done;
118
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119#ifdef CONFIG_CPU_FREQ
120 struct notifier_block freq_transition;
121 struct notifier_block freq_policy;
122#endif
123};
124
125#define TO_INF(ptr,member) container_of(ptr,struct pxafb_info,member)
126
127/*
128 * These are the actions for set_ctrlr_state
129 */
130#define C_DISABLE (0)
131#define C_ENABLE (1)
132#define C_DISABLE_CLKCHANGE (2)
133#define C_ENABLE_CLKCHANGE (3)
134#define C_REENABLE (4)
135#define C_DISABLE_PM (5)
136#define C_ENABLE_PM (6)
137#define C_STARTUP (7)
138
139#define PXA_NAME "PXA"
140
141/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 * Minimum X and Y resolutions
143 */
144#define MIN_XRES 64
145#define MIN_YRES 64
146
147#endif /* __PXAFB_H__ */