1/* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved. 2 * 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 13 * permission. 14 * 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. 26 * 27 */ 28 29#ifndef MSM_FB_DEF_H 30#define MSM_FB_DEF_H 31 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> 37#include <linux/mm.h> 38#include <linux/fb.h> 39#include "msm_mdp.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> 52 53#include <linux/sched.h> 54#include <linux/time.h> 55#include <linux/interrupt.h> 56#include <mach/hardware.h> 57#include <linux/io.h> 58#include <asm/system.h> 59#include <asm/mach-types.h> 60#include <linux/platform_device.h> 61 62typedef s64 int64; 63typedef s32 int32; 64typedef s16 int16; 65typedef s8 int8; 66 67typedef u64 uint64; 68typedef u32 uint32; 69typedef u16 uint16; 70typedef u8 uint8; 71 72typedef s32 int4; 73typedef s16 int2; 74typedef s8 int1; 75 76typedef u32 uint4; 77typedef u16 uint2; 78typedef u8 uint1; 79 80typedef u32 dword; 81typedef u16 word; 82typedef u8 byte; 83 84typedef unsigned int boolean; 85 86#ifndef TRUE 87#define TRUE 1 88#endif 89 90#ifndef FALSE 91#define FALSE 0 92#endif 93 94#define MSM_FB_ENABLE_DBGFS 95#define FEATURE_MDDI 96 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) 101 102#ifndef MAX 103#define MAX( x, y ) (((x) > (y)) ? (x) : (y)) 104#endif 105 106#ifndef MIN 107#define MIN( x, y ) (((x) < (y)) ? (x) : (y)) 108#endif 109 110/*--------------------------------------------------------------------------*/ 111 112#define inp32(addr) readl(addr) 113#define inp16(addr) readw(addr) 114#define inp8(addr) readb(addr) 115#define inp(addr) inp32(addr) 116 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) 121 122 123#define clk_busy_wait(x) msleep_interruptible((x)/1000) 124 125#define memory_barrier() 126 127#define assert(expr) \ 128 if(!(expr)) { \ 129 printk(KERN_ERR "msm_fb: assertion failed! %s,%s,%s,line=%d\n",\ 130 #expr, __FILE__, __func__, __LINE__); \ 131 } 132 133#define ASSERT(x) assert(x) 134 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 141 142#define EBI2_PRIM_LCD_CLR 0xC0 143#define EBI2_PRIM_LCD_SEL 0x40 144 145#define EBI2_SECD_LCD_CLR 0x300 146#define EBI2_SECD_LCD_SEL 0x100 147#endif 148 149extern u32 msm_fb_msg_level; 150 151/* 152 * Message printing priorities: 153 * LEVEL 0 KERN_EMERG (highest priority) 154 * LEVEL 1 KERN_ALERT 155 * LEVEL 2 KERN_CRIT 156 * LEVEL 3 KERN_ERR 157 * LEVEL 4 KERN_WARNING 158 * LEVEL 5 KERN_NOTICE 159 * LEVEL 6 KERN_INFO 160 * LEVEL 7 KERN_DEBUG (Lowest priority) 161 */ 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__); 186 187#ifdef MSM_FB_C 188unsigned char *msm_mdp_base; 189unsigned char *msm_pmdh_base; 190unsigned char *msm_emdh_base; 191#else 192extern unsigned char *msm_mdp_base; 193extern unsigned char *msm_pmdh_base; 194extern unsigned char *msm_emdh_base; 195#endif 196 197#endif /* MSM_FB_DEF_H */ 198