Linux-libre 3.0.60-gnu1
[librecmc/linux-libre.git] / drivers / staging / msm / msm_fb_def.h
1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 and
5  * only version 2 as published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  */
12
13 #ifndef MSM_FB_DEF_H
14 #define MSM_FB_DEF_H
15
16 #include <linux/module.h>
17 #include <linux/moduleparam.h>
18 #include <linux/kernel.h>
19 #include <linux/slab.h>
20 #include <linux/delay.h>
21 #include <linux/mm.h>
22 #include <linux/fb.h>
23 #include "msm_mdp.h"
24 #include <linux/init.h>
25 #include <linux/ioport.h>
26 #include <linux/device.h>
27 #include <linux/dma-mapping.h>
28 #include <linux/uaccess.h>
29 #include <linux/workqueue.h>
30 #include <linux/string.h>
31 #include <linux/version.h>
32 #include <linux/proc_fs.h>
33 #include <linux/vmalloc.h>
34 #include <linux/debugfs.h>
35 #include <linux/console.h>
36
37 #include <linux/sched.h>
38 #include <linux/time.h>
39 #include <linux/interrupt.h>
40 #include <mach/hardware.h>
41 #include <linux/io.h>
42 #include <asm/system.h>
43 #include <asm/mach-types.h>
44 #include <linux/platform_device.h>
45
46 typedef s64 int64;
47 typedef s32 int32;
48 typedef s16 int16;
49 typedef s8 int8;
50
51 typedef u64 uint64;
52 typedef u32 uint32;
53 typedef u16 uint16;
54 typedef u8 uint8;
55
56 typedef s32 int4;
57 typedef s16 int2;
58 typedef s8 int1;
59
60 typedef u32 uint4;
61 typedef u16 uint2;
62 typedef u8 uint1;
63
64 typedef u32 dword;
65 typedef u16 word;
66 typedef u8 byte;
67
68 typedef unsigned int boolean;
69
70 #ifndef TRUE
71 #define TRUE 1
72 #endif
73
74 #ifndef FALSE
75 #define FALSE 0
76 #endif
77
78 #define MSM_FB_ENABLE_DBGFS
79 #define FEATURE_MDDI
80
81 #define outp32(addr, val) writel(val, addr)
82 #define outp16(addr, val) writew(val, addr)
83 #define outp8(addr, val) writeb(val, addr)
84 #define outp(addr, val) outp32(addr, val)
85
86 #ifndef MAX
87 #define  MAX( x, y ) (((x) > (y)) ? (x) : (y))
88 #endif
89
90 #ifndef MIN
91 #define  MIN( x, y ) (((x) < (y)) ? (x) : (y))
92 #endif
93
94 /*--------------------------------------------------------------------------*/
95
96 #define inp32(addr) readl(addr)
97 #define inp16(addr) readw(addr)
98 #define inp8(addr) readb(addr)
99 #define inp(addr) inp32(addr)
100
101 #define inpw(port)             readw(port)
102 #define outpw(port, val)       writew(val, port)
103 #define inpdw(port)            readl(port)
104 #define outpdw(port, val)      writel(val, port)
105
106
107 #define clk_busy_wait(x) msleep_interruptible((x)/1000)
108
109 #define memory_barrier()
110
111 #define assert(expr) \
112         if(!(expr)) { \
113                 printk(KERN_ERR "msm_fb: assertion failed! %s,%s,%s,line=%d\n",\
114                         #expr, __FILE__, __func__, __LINE__); \
115         }
116
117 #define ASSERT(x)   assert(x)
118
119 #define DISP_EBI2_LOCAL_DEFINE
120 #ifdef DISP_EBI2_LOCAL_DEFINE
121 #define LCD_PRIM_BASE_PHYS 0x98000000
122 #define LCD_SECD_BASE_PHYS 0x9c000000
123 #define EBI2_PRIM_LCD_RS_PIN 0x20000
124 #define EBI2_SECD_LCD_RS_PIN 0x20000
125
126 #define EBI2_PRIM_LCD_CLR 0xC0
127 #define EBI2_PRIM_LCD_SEL 0x40
128
129 #define EBI2_SECD_LCD_CLR 0x300
130 #define EBI2_SECD_LCD_SEL 0x100
131 #endif
132
133 extern u32 msm_fb_msg_level;
134
135 /*
136  * Message printing priorities:
137  * LEVEL 0 KERN_EMERG (highest priority)
138  * LEVEL 1 KERN_ALERT
139  * LEVEL 2 KERN_CRIT
140  * LEVEL 3 KERN_ERR
141  * LEVEL 4 KERN_WARNING
142  * LEVEL 5 KERN_NOTICE
143  * LEVEL 6 KERN_INFO
144  * LEVEL 7 KERN_DEBUG (Lowest priority)
145  */
146 #define MSM_FB_EMERG(msg, ...)    \
147         if (msm_fb_msg_level > 0)  \
148                 printk(KERN_EMERG msg, ## __VA_ARGS__);
149 #define MSM_FB_ALERT(msg, ...)    \
150         if (msm_fb_msg_level > 1)  \
151                 printk(KERN_ALERT msg, ## __VA_ARGS__);
152 #define MSM_FB_CRIT(msg, ...)    \
153         if (msm_fb_msg_level > 2)  \
154                 printk(KERN_CRIT msg, ## __VA_ARGS__);
155 #define MSM_FB_ERR(msg, ...)    \
156         if (msm_fb_msg_level > 3)  \
157                 printk(KERN_ERR msg, ## __VA_ARGS__);
158 #define MSM_FB_WARNING(msg, ...)    \
159         if (msm_fb_msg_level > 4)  \
160                 printk(KERN_WARNING msg, ## __VA_ARGS__);
161 #define MSM_FB_NOTICE(msg, ...)    \
162         if (msm_fb_msg_level > 5)  \
163                 printk(KERN_NOTICE msg, ## __VA_ARGS__);
164 #define MSM_FB_INFO(msg, ...)    \
165         if (msm_fb_msg_level > 6)  \
166                 printk(KERN_INFO msg, ## __VA_ARGS__);
167 #define MSM_FB_DEBUG(msg, ...)    \
168         if (msm_fb_msg_level > 7)  \
169                 printk(KERN_DEBUG msg, ## __VA_ARGS__);
170
171 #ifdef MSM_FB_C
172 unsigned char *msm_mdp_base;
173 unsigned char *msm_pmdh_base;
174 unsigned char *msm_emdh_base;
175 #else
176 extern unsigned char *msm_mdp_base;
177 extern unsigned char *msm_pmdh_base;
178 extern unsigned char *msm_emdh_base;
179 #endif
180
181 #endif /* MSM_FB_DEF_H */