Update video driver to support the Bookeen way to use screen.

This commit is contained in:
mlt 2009-12-22 18:44:36 +00:00 committed by Godzil
parent 6a09ec6d7a
commit 2c907884d1
10 changed files with 83255 additions and 2883 deletions

View File

@ -31,4 +31,11 @@ config MACH_SMDK2416
select MACH_SMDK
help
Say Y here if you are using an SMDK2416
config MACH_CYBOOK2416
bool "CYBOOK 2416"
select MACH_SMDK2416
help
Say Y here is you are using a Cybook 2416
endmenu

View File

@ -20,3 +20,4 @@ obj-$(CONFIG_S3C2416_PM) += pm.o
obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
obj-$(CONFIG_MACH_SMDK2416) += qisda-utils.o
obj-$(CONFIGçMACH_CYBOOK2416) += cybook.o

View File

@ -0,0 +1,78 @@
/*
* cybook.c
*
* Copyright 2009 Bookeen <yep@confucius>
*
* 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
* the Free Software Foundation; either version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty 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., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
struct proc_dir_entry *platform_type_Proc_File;
#define procfs_name "device"
int procfile_read(char *buffer,
char **buffer_location,
off_t offset, int buffer_length, int *eof, void *data)
{
int ret;
if (offset > 0) {
/* we have finished to read, return 0 */
ret = 0;
} else {
/* fill the buffer, return the buffer size */
/* Currently, this kernel branch will only support the Cybook Gen4 TwistEffect */
ret = sprintf(buffer, "CYBOOK_GEN4\n");
}
return ret;
}
// ---------------------------------------------------------------------------
// ===========================================================================
static int __init cybooInit(void)
{
/* cybook proc file */
platform_type_Proc_File = create_proc_entry(procfs_name, 0644, NULL);
if (platform_type_Proc_File == NULL) {
remove_proc_entry(procfs_name, &proc_root);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
procfs_name);
}
platform_type_Proc_File->read_proc = procfile_read;
platform_type_Proc_File->owner = THIS_MODULE;
platform_type_Proc_File->mode = S_IFREG | S_IRUGO;
platform_type_Proc_File->uid = 0;
platform_type_Proc_File->gid = 0;
platform_type_Proc_File->size = 37;
return 0;
}
// ---------------------------------------------------------------------------
static void __exit cybookExit(void)
{
return;
}
// ---------------------------------------------------------------------------
module_init(cybookInit);
module_exit(cybookExit);
// ---------------------------------------------------------------------------
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Bookeen <developers@bookeen.com>");
MODULE_DESCRIPTION("Cybook Specialized functions");
MODULE_VERSION("2.0");
// ===================================================================

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.21.5-cfs-v19
# Thu Dec 17 11:52:21 2009
# Tue Dec 22 17:57:18 2009
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@ -204,6 +204,7 @@ CONFIG_S3C2416_PM=y
# S3C2416 Machines
#
CONFIG_MACH_SMDK2416=y
CONFIG_MACH_CYBOOK2416=y
#
# S3C6400 Machines

View File

@ -1,5 +1,5 @@
/*
* linux/drivers/video/auofb.c -- for AUO epaper frame buffer device
* linux/drivers/video/auofb.c -- for AUO epaper frame buffer device
*
* Modified by Ivan.Ruan
*
@ -40,6 +40,8 @@
#include "epaper.h"
#include "auofb.h"
#include <linux/auofb_ioctl.h>
#ifdef CONFIG_PM
#include <linux/pm.h>
#include <asm/plat-s3c24xx/pm.h>
@ -108,10 +110,11 @@
#if defined(AUO_EPAPER_6_INCH)
#define BOOT_PROGRESS_BAR_X 203
#define BOOT_PROGRESS_BAR_Y 95
#define BOOT_PROGRESS_BAR_W 8
#define BOOT_PROGRESS_BAR_H 413
/* Bookeen's Value */
#define BOOT_PROGRESS_BAR_X 32
#define BOOT_PROGRESS_BAR_Y 767
#define BOOT_PROGRESS_BAR_W (567 - 32)
#define BOOT_PROGRESS_BAR_H (784 - 767)
#define BOOT_PROGRESS_BAR_DELAY_TIME 250 //2 sec = 420
#else
#define BOOT_PROGRESS_BAR_X 259
@ -559,6 +562,7 @@ static int update_display_thread(void *unused)
daemonize("AUOEINK_udt");
allow_signal(SIGKILL);
#ifdef CONFIG_AUO_FB_AUTOUPDATE
while ( thread_active )
{
try_to_freeze(); //for freeze kernel_thread
@ -872,6 +876,7 @@ static int update_display_thread(void *unused)
thread_active = 0;
}
#endif
complete_and_exit(&update_display_thread_exited, 0);
}
@ -1922,6 +1927,7 @@ int auo_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
struct auo_fb_info *fbi = container_of(info, struct auo_fb_info, fb);
struct fb_var_screeninfo *var= &fbi->fb.var;
void __user *argp = (void __user *)arg;
struct vm_area_struct *tvma;
struct page *tpage;
@ -1940,7 +1946,57 @@ int auo_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
0xFFA0 ~ 0xFFDF : Read info from TCON
0xFFE0 ~ 0xFFFF : Utility or test
*/
switch(cmd){
switch(cmd)
{
/* [MTR] */
case IOCTL_AUO_SENDCOMMAND:
{
sAUOCommand cmd;
unsigned char buffer[2048];
unsigned char *user_buffer;
unsigned long user_buflen, copysize, copysize16;
unsigned short *ptr16;
if (copy_from_user (&cmd, argp, sizeof(cmd)))
return -EFAULT;
/* Now execute the command */
Epaper_sendCommandStart(&cmd);
//INFOL(INFO_VERBOSE, ("/* Seventh: Send data if needed */"));
if (GET_COMMAND_HAVE_DATA(cmd.cmd) != 0)
{
//INFOL(INFO_VERBOSE, ("Yes, we have data to send!"));
user_buflen = cmd.datalen;
user_buffer = (unsigned char *)cmd.data;
while (user_buflen != 0)
{
copysize = user_buflen;
if (user_buflen > sizeof(buffer))
copysize = sizeof(buffer);
if ( copy_from_user(buffer, user_buffer, copysize) )
return -EFAULT;
copysize16 = (copysize + 1) / 2;
//printk(KERN_ERR "cp16=%ld cp=%ld\n", copysize16, copysize);
ptr16 = (unsigned short *) buffer;
Epaper_sendData(buffer, copysize16);
user_buflen -= copysize;
user_buffer += copysize;
}
}
Epaper_sendCommandEnd(&cmd);
}
break;
/* [/MTR] */
//*********************************************************************************
case AUOFB_IOCTL_TCON_GET_BUSY_STATUS: //busy pin

View File

@ -411,6 +411,5 @@ extern int auo_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
extern void auofb_activate_var(struct auo_fb_info *fbi, struct fb_var_screeninfo *var);
#endif

View File

@ -122,10 +122,11 @@
#define BUSY_WAIT_TIMEOUT (40*5) //panel time out = 1s
//#ifdef EPAPER_BOOT_CODE
#define PROGRESS_BAR_X (301)
#define PROGRESS_BAR_Y (100)
#define PROGRESS_BAR_W 60
#define PROGRESS_BAR_H 400
/* Bookeen's Position */
#define PROGRESS_BAR_X (32)
#define PROGRESS_BAR_Y (767)
#define PROGRESS_BAR_W (567 - 32)
#define PROGRESS_BAR_H (784 - 767)
#define PROGRESS_BAR_FRAME_LINE_W 8
//#endif
@ -133,7 +134,7 @@
//Global var
/* BAN 20090408 update for WE freq*/
static int delayLoopCount =150;//2M
static int delayLoopCount = 150;//2M
/* BAN 20090408 update for WE freq*/
//Ivan start
static int partial_update_mode = PARTIAL_DSP_MODE_0;
@ -160,10 +161,7 @@ EXPORT_SYMBOL(Epaper_Draw_Point);
static inline void nDelay(unsigned long loops) //in ns
{
int i;
__asm__ volatile ("1:\n" "subs %0, %1, #1\n" "bne 1b":"=r" (loops):"0"(loops));
}
static void __mDelay(unsigned long mTime)
@ -432,7 +430,7 @@ void Epaper_Set_Resolution(int h_res, int v_res)
int is_Epaper_Write_Ready_No_Wait(void)
{
unsigned long tmp;
int iBusyCnt=0;
//int iBusyCnt=0;
#if defined(CONFIG_QISDA_E600_EVT0)
tmp = __raw_readl(rGPGDAT);
if((tmp & (1<<5))==0)
@ -581,7 +579,6 @@ int is_Epaper_Write_Ready_Wait(unsigned long waitTime) //ms
return 1;
}
static inline void s3c2416_i80_write(int data)
{
int tmp;
@ -591,12 +588,11 @@ static inline void s3c2416_i80_write(int data)
__raw_writel(tmp, rSIFCCON0);
__raw_writel(data, rSIFCCON1); //rSIFCCON1 = CMD;
nDelay(25);
tmp = __raw_readl(rSIFCCON0); // nWE disable
tmp &= ~SYS_WR_CON;
__raw_writel(tmp, rSIFCCON0);
}
static inline void s3c2416_i80_write_Rotate(int data)
@ -636,7 +632,6 @@ static inline void s3c2416_i80_write_HandWriting(int data)
tmp &= ~SYS_WR_CON;
__raw_writel(tmp, rSIFCCON0);
}
static inline void s3c2416_i80_write_Rotate_HandWriting(int data)
@ -656,8 +651,6 @@ static inline void s3c2416_i80_write_Rotate_HandWriting(int data)
tmp = __raw_readl(rSIFCCON0); // nWE disable
tmp &= ~SYS_WR_CON;
__raw_writel(tmp, rSIFCCON0);
}
static inline void s3c2416_i80_write_LUT(int data)
@ -678,8 +671,6 @@ static inline void s3c2416_i80_write_LUT(int data)
tmp = __raw_readl(rSIFCCON0); // nWE disable
tmp &= ~SYS_WR_CON;
__raw_writel(tmp, rSIFCCON0);
}
@ -703,12 +694,10 @@ static inline void s3c2416_i80_read(unsigned short* data)
tmp = __raw_readl(rSIFCCON0); // nRD disable
tmp &= ~SYS_OE_CON;
__raw_writel(tmp, rSIFCCON0);
}
static int DISP_CMD_OUT(unsigned short CMD, unsigned short* pdata, int data_length)
static void DISP_CMD_OUT(unsigned short CMD, unsigned short* pdata, int data_length)
{
unsigned long tmp;
unsigned long cnt;
@ -828,7 +817,6 @@ DISP_CMD_OUT_ERROR:
tmp &= ~(1<<0);
__raw_writel(tmp, rSIFCCON0);
}
@ -1265,7 +1253,7 @@ void Epaper_SetLcdPort(void)
void EPaper_CloseLcdPort(void)
{
unsigned long tmp;
//unsigned long tmp;
//gpc0 input
s3c2410_gpio_pullup(S3C2410_GPC0,1);
@ -1427,8 +1415,8 @@ void EPaper_CloseLcdPort(void)
DispErrorCode_t Epaper_Disp(T_DISPLAY_FRAME tFrame)
{
unsigned long tmp;
int iBusyCnt=0;
//unsigned long tmp;
//int iBusyCnt=0;
DPRINTK("<= BAN =>I80 Write\n");
@ -1450,7 +1438,7 @@ int Epaper_Get_Partial_Update_Mode(void)
void Epaper_Enter_Standby_Mode(int isEnter)
{
unsigned long tmp;
//unsigned long tmp;
if(isEnter)
{
@ -1520,7 +1508,7 @@ void Epaper_Power(int isEnable)
void Epaper_Read_R_TEMP(unsigned short* val0, unsigned short* val1, unsigned short* val2, unsigned short* val3)
{
unsigned long tmp;
//unsigned long tmp;
unsigned short val[4];
memset(val, 0x0, 8);
@ -1647,19 +1635,20 @@ int Epaper_Init(int h_Res, int v_Res, int rotation, int data_inverse, int inputd
//u32LUTLength: length in (unsigned short)
int Epaper_Update_LUT(unsigned short* u16LUT, unsigned long u32LUTLength)
{
unsigned long cnt=0;
//unsigned long cnt=0;
if(is_Epaper_Write_Ready_Wait(10000))
{
return DISP_CMD_OUT(AUO_EPAPER_CMD_LUT_START, u16LUT, u32LUTLength);
DISP_CMD_OUT(AUO_EPAPER_CMD_LUT_START, u16LUT, u32LUTLength);
return 0;
}
else
return -1;
}
//u32LUTLength: length in (unsigned short)
int Epaper_Read_LUT(unsigned short* u16LUT, unsigned long u32LUTLength)
void Epaper_Read_LUT(unsigned short* u16LUT, unsigned long u32LUTLength)
{
DISP_DATA_IN(AUO_EPAPER_CMD_LUT_READ, u16LUT, u32LUTLength);
}
@ -1671,3 +1660,240 @@ void Epaper_Reset(void)
#include <linux/auofb_ioctl.h>
/* [MTR] Add generic command function */
enum InfoLevel
{
INFO_ERROR = 0,
INFO_WARNING,
INFO_NORMAL,
INFO_DEBUG,
INFO_VERBOSE,
};
//#define EPAPER_DEBUG
//#define VERBOSE_LEVEL INFO_VERBOSE
#ifndef VERBOSE_LEVEL
#define VERBOSE_LEVEL INFO_WARNING
#endif
#ifdef EPAPER_DEBUG
static int _dbgFL = 0;
#define FUNC_IN() do { int i; _dbgFL++; printk(KERN_ERR "+"); for (i = 0; i < _dbgFL; i++) printk("-"); printk(">> %s() >>\n", __func__); } while(0)
#define FUNC_OUT() do { int i; printk(KERN_ERR "+"); for (i = 0; i < _dbgFL; i++) printk("-"); printk("<< %s() <<\n", __func__); _dbgFL--; } while(0)
#define FUNC_OUTR(val) do { int i; printk(KERN_ERR "+"); for (i = 0; i < _dbgFL; i++) printk("-"); printk("<< %s() = %d <<\n", __func__, val); _dbgFL--; } while(0)
#define INFOL(level, s) do { if (level <= VERBOSE_LEVEL) { int i; printk(KERN_ERR "+"); for (i = 0; i < _dbgFL; i++) printk("-"); printk("||%s:%s(): ", __FILE__, __func__); printk s; printk("\n"); } } while(0)
#define INFO(s) do { int i; printk(KERN_ERR "+"); for (i = 0; i < _dbgFL; i++) printk("-"); printk("||%s:%s(): ", __FILE__, __func__); printk s; printk("\n"); } while(0)
#else
#define FUNC_IN() do {} while(0)
#define FUNC_OUT() do {} while(0)
#define FUNC_OUTR(val) do {} while(0)
#define INFOL(level, s) do { if (level <= VERBOSE_LEVEL) { printk("<%d>%s:%s(): ", level, __FILE__, __func__); printk s; printk("\n"); } } while(0)
#define INFO(s) do { printk("%s:%s(): ", __FILE__, __func__); printk s; printk("\n"); } while(0)
#endif
//#define GET_COMMAND_PARAM_NUM(command) ((command >> 20) & 0x0F)
//#define GET_COMMAND_HAVE_DATA(command) ((command >> 28) & 0x01)
//#define GET_COMMAND_NEED_WAIT(command) ((command >> 29) & 0x01)
/* On the i80 port,
* i80 TCON
* -----------
* RS -> D/C
* CS0 -> CSEL
* nWE -> HWE
* OE -> HRD
*/
static inline void _InitI80Interface(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSYSIFCON0); //polarity of RS, set 1 for normal access
tmp |= (1<<2);
__raw_writel(tmp, rSYSIFCON0);
tmp = __raw_readl(rSIFCCON0); // command mode enable
tmp |= (1<<0);
__raw_writel(tmp, rSIFCCON0);
FUNC_OUT();
}
static inline void _DeinitI80Interface(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0); // command mode disable
tmp &= ~(1<<0);
__raw_writel(tmp, rSIFCCON0);
FUNC_OUT();
}
static inline void _SetWriteToData(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0);
// RS high -> D/nC set Data mode
tmp |= (1<<1);
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _SetWriteToCommand(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0);
// RS low -> D/nC set Command mode
tmp &= ~(1<<1);
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _EnableWrite(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0);
// nWE -> HWE enable
tmp |= (1<<6);
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _DisableWrite(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0);
// nWE -> HWE disable
tmp &= ~(1<<6);
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _EnableRead(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0); // nRD enable
tmp |= SYS_OE_CON;
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _DisableRead(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0); // nRD disable
tmp &= ~SYS_OE_CON;
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _SelectChip(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0); // Chip Select
tmp |= (1<<8);
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
static inline void _UnselectChip(void)
{
unsigned long tmp;
FUNC_IN();
tmp = __raw_readl(rSIFCCON0); // nCS0(Main) enable
tmp &= ~(1<<8);
__raw_writel(tmp, rSIFCCON0);
__uDelay(1);
FUNC_OUT();
}
int Epaper_sendCommandStart(sAUOCommand *cmd)
{
FUNC_IN();
INFOL(INFO_VERBOSE,("cmd #%08lX", cmd->cmd));
/* First: verify that the K1900 is ready */
INFOL(INFO_VERBOSE, ("/* First: verify that the K1900 is ready */"));
if (GET_COMMAND_NEED_WAIT(cmd->cmd) != 0x00)
{
INFOL(INFO_VERBOSE, ("Wait for non BUSY..."));
is_Epaper_Write_Ready();
}
/* Second: init the i80 interface */
INFOL(INFO_VERBOSE, ("/* Second: init the i80 interface */"));
_InitI80Interface();
/* Third: Select the chip and set to Command mode */
INFOL(INFO_VERBOSE, ("/* Third: Select the chip and set to Command mode */"));
_SelectChip();
_SetWriteToCommand();
/* Fourth: Send command */
INFOL(INFO_VERBOSE, ("/* Fourth: Send command */"));
s3c2416_i80_write(cmd->cmd); /* This function already manage HWE,
* no need to do it here. */
/* Sixth: If parameters is needed, send them */
INFOL(INFO_VERBOSE, ("/* Sixth: If parameters is needed, send them */"));
if (GET_COMMAND_PARAM_NUM(cmd->cmd) > 0)
{
int i, paramNumbers = GET_COMMAND_PARAM_NUM(cmd->cmd);
INFOL(INFO_VERBOSE, ("YES! We have %d parameters", paramNumbers));
_SetWriteToData();
for (i = 0; i < paramNumbers; i++)
{
s3c2416_i80_write(cmd->params[i]);
}
}
FUNC_OUT();
return 0;
}
int Epaper_sendData(unsigned short *buffer, unsigned long bufferLen)
{
/* Seventh: Send data if needed */
unsigned long i;
FUNC_IN();
INFOL(INFO_VERBOSE, ("Bufferlen: %ld", bufferLen));
_SetWriteToData();
for (i = 0; i < bufferLen; i++)
{
s3c2416_i80_write(buffer[i]);
}
FUNC_OUT();
return 0;
}
int Epaper_sendCommandEnd(sAUOCommand *cmd)
{
FUNC_IN();
/* Eighth: Close all */
_UnselectChip();
_DeinitI80Interface();
FUNC_OUT();
return 0;
}
/* [/MTR] */

View File

@ -89,6 +89,7 @@ typedef struct T_DISPLAY_FRAME_TAG
unsigned short* pFrameData;
} T_DISPLAY_FRAME, *T_DISPLAY_FRAME_P;
//functions
void Epaper_SetLcdPort(void);
DispErrorCode_t Epaper_Disp(T_DISPLAY_FRAME tFrame);
@ -106,7 +107,7 @@ void EPaper_CloseLcdPort(void);
void Epaper_Read_R_TEMP(unsigned short* val0, unsigned short* val1, unsigned short* val2, unsigned short* val3);
void Epaper_Display_Refresh(void);
int Epaper_Update_LUT(unsigned short* u16LUT, unsigned long u32LUTLength);
int Epaper_Read_LUT(unsigned short* u16LUT, unsigned long u32LUTLength);
void Epaper_Read_LUT(unsigned short* u16LUT, unsigned long u32LUTLength);
void Epaper_Reset(void);
void Epaper_Clean_Panel(void);
void Epaper_Show_Progress(int percent);

80003
drivers/video/logo/logo.ppm Normal file

File diff suppressed because it is too large Load Diff