/* 2009-08-20: File added by Sony Corporation */
/*
 * File Name       : /include/asm-arm/arch-mp200/fbcommon.h
 * Function        : Common parameters for Frame Buffer Driver
 * Release Version : 
 * Release Date    : 2008.11.26
 *
 * Copyright (C) NEC Electronics Corporation 2005-2008
 *
 *
 * This program is free software;you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by Free Softwere
 * Foundation; either version 2 of License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warrnty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; If not, write to the Free Software Foundation, Inc., 59 Temple
 * Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */

#ifndef _FBCOMMON_H_
#define _FBCOMMON_H_


/********************************************************
 * Include Files                                        *
 *******************************************************/
#include <asm/ioctl.h>
#include <asm/types.h>


/********************************************************
 * Structures                                           *
 *******************************************************/
/* Image infomation (use I/F fb <-> 2D API) */
typedef struct _scrn_modes {
	int   tc_enable;	/* enable(1)/disable(0) transparent color            */
	int   t_color;		/* transparent color (16bpp RGB565)                  */
	int   alpha;		/* alpha ratio (0 - 255)                             */
	int   page;		/* 2D framebuffer page(0/1)                          */
	int   rot;		/* LCD image rotation(0/1=180deg.)                   */
	int   update;		/* absolutely update(1) / update only 2D mix mode(0) */
				/* when MP200_FB_SET_MODES ,this value is no effect  */
} scrn_modes;


/* frame buffer page infomation (use I/F fb <-> 2D API) */
typedef struct _scrn_mode{
	int   timeout; 		/* waiting time for any frame ready(0) (10mS)            */
	int   page0;		/* page 0 is out of display(0)/waiting for on display(1) */
	int   page1;		/* page 1 is out of display(0)/waiting for on display(1) */
} scrn_mode;


/* frame buffer update timer infomation (use I/F fb <-> 2D API) */
typedef struct _update_timer{
	int   timerflag;	/* auto update off(0) / auto update on(1) */
	int   timeout;		/* timeout timer value */
} update_timer;


/* frame buffer tv infomation (use I/F fb <-> 2D API) */
typedef enum{
    EM1_TV_MODE_OFF,
    EM1_TV_MODE_NTS,
    EM1_TV_MODE_PAL
} EM1_TV_MODE;


/********************************************************
 *  Definitions                                         *
 *******************************************************/
/*
 * scrn modes
 */
/* enable/disable transparent color */
#define TC_COLOR_DISABLE	1
#define TC_COLOR_ENABLE		0

/* frame buffer page No. */
#define DISP_BUFA		0
#define DISP_BUFB		1
#define NOT_DISP_ON_YET		2

/* inverse mode */
#define NO_INVERSE		0
#define UDRL_INVERSE		1

/* absolutely update flag status */
#define UPDATE_FLAG_OFF		0
#define UPDATE_FLAG_ON		1


/*
 * scrn mode
 */
/* frame buffer page status */
#define OUT_OF_DISPLAY		0
#define WAITING_FOR_ON_DISPLAY	1

/* timeout */
#define CHKSCRN_TIMEOUT		-1


/* FB device number */
#define EM1_FB_DEVICE_LCD	0
#define EM1_FB_DEVICE_NTS	1

/*
 * IOCTLs to D77601 fb driver. 0x4E is 'N' for NEC.
 */
#define IOC_MP200_FB_MAGIC	('N')

#define MP200_FB_CHKSCRN	_IOR(IOC_MP200_FB_MAGIC, 0x00, scrn_mode)
#define MP200_FB_UPDATE_SCRN	_IOW(IOC_MP200_FB_MAGIC, 0x01, scrn_modes)
#define MP200_FB_SET_MODES	_IOW(IOC_MP200_FB_MAGIC, 0x02, scrn_modes)
#define MP200_FB_GET_MODES	_IOR(IOC_MP200_FB_MAGIC, 0x03, scrn_modes)
#define MP200_FB_UPDATE_TIMER	_IOR(IOC_MP200_FB_MAGIC, 0x04, update_timer)
#ifdef CONFIG_FB_MP200_NTS
#define MP200_FB_SET_OUTPUT	_IOW(IOC_MP200_FB_MAGIC, 0x05, EM1_TV_MODE)
#define MP200_FB_GET_OUTPUT	_IOR(IOC_MP200_FB_MAGIC, 0x06, EM1_TV_MODE)
#endif /* CONFIG_FB_MP200_NTS */


#endif /* _FBCOMMON_H_ */
