1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of Code Aurora nor
11 * the names of its contributors may be used to endorse or promote
12 * products derived from this software without specific prior written
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #include <linux/module.h>
33 #include <linux/moduleparam.h>
34 #include <linux/kernel.h>
35 #include <linux/slab.h>
36 #include <linux/delay.h>
40 #include <linux/init.h>
41 #include <linux/ioport.h>
42 #include <linux/device.h>
43 #include <linux/dma-mapping.h>
44 #include <linux/uaccess.h>
45 #include <linux/workqueue.h>
46 #include <linux/string.h>
47 #include <linux/version.h>
48 #include <linux/proc_fs.h>
49 #include <linux/vmalloc.h>
50 #include <linux/debugfs.h>
51 #include <linux/console.h>
53 #include <linux/sched.h>
54 #include <linux/time.h>
55 #include <linux/interrupt.h>
56 #include <mach/hardware.h>
58 #include <asm/system.h>
59 #include <asm/mach-types.h>
60 #include <linux/platform_device.h>
84 typedef unsigned int boolean;
94 #define MSM_FB_ENABLE_DBGFS
97 #define outp32(addr, val) writel(val, addr)
98 #define outp16(addr, val) writew(val, addr)
99 #define outp8(addr, val) writeb(val, addr)
100 #define outp(addr, val) outp32(addr, val)
103 #define MAX( x, y ) (((x) > (y)) ? (x) : (y))
107 #define MIN( x, y ) (((x) < (y)) ? (x) : (y))
110 /*--------------------------------------------------------------------------*/
112 #define inp32(addr) readl(addr)
113 #define inp16(addr) readw(addr)
114 #define inp8(addr) readb(addr)
115 #define inp(addr) inp32(addr)
117 #define inpw(port) readw(port)
118 #define outpw(port, val) writew(val, port)
119 #define inpdw(port) readl(port)
120 #define outpdw(port, val) writel(val, port)
123 #define clk_busy_wait(x) msleep_interruptible((x)/1000)
125 #define memory_barrier()
127 #define assert(expr) \
129 printk(KERN_ERR "msm_fb: assertion failed! %s,%s,%s,line=%d\n",\
130 #expr, __FILE__, __func__, __LINE__); \
133 #define ASSERT(x) assert(x)
135 #define DISP_EBI2_LOCAL_DEFINE
136 #ifdef DISP_EBI2_LOCAL_DEFINE
137 #define LCD_PRIM_BASE_PHYS 0x98000000
138 #define LCD_SECD_BASE_PHYS 0x9c000000
139 #define EBI2_PRIM_LCD_RS_PIN 0x20000
140 #define EBI2_SECD_LCD_RS_PIN 0x20000
142 #define EBI2_PRIM_LCD_CLR 0xC0
143 #define EBI2_PRIM_LCD_SEL 0x40
145 #define EBI2_SECD_LCD_CLR 0x300
146 #define EBI2_SECD_LCD_SEL 0x100
149 extern u32 msm_fb_msg_level;
152 * Message printing priorities:
153 * LEVEL 0 KERN_EMERG (highest priority)
157 * LEVEL 4 KERN_WARNING
158 * LEVEL 5 KERN_NOTICE
160 * LEVEL 7 KERN_DEBUG (Lowest priority)
162 #define MSM_FB_EMERG(msg, ...) \
163 if (msm_fb_msg_level > 0) \
164 printk(KERN_EMERG msg, ## __VA_ARGS__);
165 #define MSM_FB_ALERT(msg, ...) \
166 if (msm_fb_msg_level > 1) \
167 printk(KERN_ALERT msg, ## __VA_ARGS__);
168 #define MSM_FB_CRIT(msg, ...) \
169 if (msm_fb_msg_level > 2) \
170 printk(KERN_CRIT msg, ## __VA_ARGS__);
171 #define MSM_FB_ERR(msg, ...) \
172 if (msm_fb_msg_level > 3) \
173 printk(KERN_ERR msg, ## __VA_ARGS__);
174 #define MSM_FB_WARNING(msg, ...) \
175 if (msm_fb_msg_level > 4) \
176 printk(KERN_WARNING msg, ## __VA_ARGS__);
177 #define MSM_FB_NOTICE(msg, ...) \
178 if (msm_fb_msg_level > 5) \
179 printk(KERN_NOTICE msg, ## __VA_ARGS__);
180 #define MSM_FB_INFO(msg, ...) \
181 if (msm_fb_msg_level > 6) \
182 printk(KERN_INFO msg, ## __VA_ARGS__);
183 #define MSM_FB_DEBUG(msg, ...) \
184 if (msm_fb_msg_level > 7) \
185 printk(KERN_DEBUG msg, ## __VA_ARGS__);
188 unsigned char *msm_mdp_base;
189 unsigned char *msm_pmdh_base;
190 unsigned char *msm_emdh_base;
192 extern unsigned char *msm_mdp_base;
193 extern unsigned char *msm_pmdh_base;
194 extern unsigned char *msm_emdh_base;
197 #endif /* MSM_FB_DEF_H */