/*
 * File Name       : /include/asm-arm/arch-mp200/fbcommon.h
 * Function        : Common parameters for Frame Buffer Driver
 * Release Version : 
 * Release Date    : 
 *
 * Copyright (C) NEC Electronics Corporation 2005
 *
 *
 * 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.
 *
 */

/*
 * Copyright 2006,2007 Sony Corporation. 
 */


#ifndef _FBCOMMON_H_
#define _FBCOMMON_H_


/********************************************************
 *                                                      *
 * Include Files                                        *
 *                                                      *
 *******************************************************/

#include <asm/ioctl.h>
#include <asm/types.h>

/*from here, added by ita */
#define QFB_BACKLIGHT_MIN 0
#define QFB_BACKLIGHT_MAX 5 /*max value of brightness in QFB_SET_BACKLIGHT*/

#define QFB_PROG_MIN 1
#define QFB_PROG_MAX 200  /*max value of progress bar*/
/*to here, added by ita */

/********************************************************
 *                                                      *
 * 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 QFB_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(1) / auto update on(1) */
	int   timeout;		/* timeout timer value */
} update_timer;

/* 2006.08.18 */
typedef struct _backlihgt_setting{
    int brightness;  /*brightness...0-100. 0=off, 100...full*/
    //int flag;      /*0...immediately change. else...gradually change*/
    int step;        /*numbers of setting to H/W. [1-100] */
    int period;      /*period of setting to H/W. It must be more than 10*/
}backlight_setting;

typedef struct _bl_brightness{
    int bright;  /*bright...0-5. 0=off, 5...full*/
    int flag;      /*0...immediately change. else...gradually change*/
}bl_brightness;


/********************************************************
 *                                                      *
 *  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

/*
 * IOCTLs to D77601 fb driver. 0x4E is 'N' for NEC.
 */

#define IOC_QFB_MAGIC		('N')

#define QFB_CHKSCRN		_IOR(IOC_QFB_MAGIC, 0, sizeof(scrn_mode))
#define QFB_UPDATE_SCRN		_IOW(IOC_QFB_MAGIC, 1, sizeof(scrn_modes))
#define QFB_SET_MODES		_IOW(IOC_QFB_MAGIC, 2, sizeof(scrn_modes))
#define QFB_GET_MODES		_IOR(IOC_QFB_MAGIC, 3, sizeof(scrn_modes))
#define QFB_UPDATE_TIMER	_IOR(IOC_QFB_MAGIC, 4, sizeof(update_timer))
/*20060531 SONY Corporation: Set backlight brightness */
//#define QFB_SET_BL_BRIGHTNESS _IOW(IOC_QFB_MAGIC, 8, sizeof(unsigned int))

#define QFB_SET_BL_BRIGHTNESS _IOW(IOC_QFB_MAGIC, 8, sizeof(backlight_setting))
#define QFB_GET_BL_BRIGHTNESS _IOR(IOC_QFB_MAGIC, 9, sizeof(backlight_setting))
#define QFB_SET_USB_SUSPEND_MODE _IOW(IOC_QFB_MAGIC, 10, sizeof(int))
#define QFB_GET_USB_SUSPEND_MODE  _IOR(IOC_QFB_MAGIC, 11, sizeof(int))
#define QFB_SET_BACKLIGHT  _IOW(IOC_QFB_MAGIC,12, sizeof(bl_brightness))
#define QFB_GET_BACKLIGHT  _IOR(IOC_QFB_MAGIC, 13, sizeof(bl_brightness))

#define QFB_GET_BL_CHANGE _IOR(IOC_QFB_MAGIC, 14, sizeof(int))

/*for test*/
#define QFB_INIT_PROG_BAR _IOW(IOC_QFB_MAGIC, 50, sizeof(int))
#define QFB_SET_PROG_BAR  _IOW(IOC_QFB_MAGIC, 51, sizeof(int))
#define QFB_GET_PROG_BAR  _IOR(IOC_QFB_MAGIC, 52, sizeof(int))

#define QFB_SET_LCD_DISABLE  _IOW(IOC_QFB_MAGIC, 53, sizeof(int))
#define QFB_GET_LCD_DISABLE  _IOR(IOC_QFB_MAGIC, 54, sizeof(int))

/**/

#endif /* _FBCOMMON_H_ */
