Add preliminary driver for touchscreen. And start of major changes in CyIO
This commit is contained in:
parent
a55a73c5d1
commit
73a653c3d6
@ -734,17 +734,6 @@ static void __init parse_tags(const struct tag *t)
|
||||
{
|
||||
for (; t->hdr.size; t = tag_next(t)){
|
||||
|
||||
//Qisda, Asaku Chen, 2009/08/17, uboot and kernel version {
|
||||
if (t->hdr.tag == ATAG_QU_VERSION){
|
||||
//printk(" qu_version: %s\n", t->u.qu_version.ver);
|
||||
strcpy(qisda_uboot_proc_banner, t->u.qu_version.ver);
|
||||
}
|
||||
if (t->hdr.tag == ATAG_U_VERSION){
|
||||
//printk(" u_version: %s\n", t->u.u_version.ver);
|
||||
strcpy(uboot_proc_banner, t->u.u_version.ver);
|
||||
}
|
||||
//Qisda, Asaku Chen, 2009/08/17, uboot and kernel version }
|
||||
|
||||
if (!parse_tag(t))
|
||||
printk(KERN_WARNING
|
||||
"Ignoring unrecognised tag 0x%08x\n",
|
||||
|
||||
@ -90,10 +90,10 @@ static void s3c2416_idle(void)
|
||||
/* ensure our idle mode is to go to idle */
|
||||
/*if you want to reduce CPU clock with idle */
|
||||
#ifdef DVS_IDLE
|
||||
tmp = __raw_readl(S3C2443_CLKDIV0);
|
||||
/*tmp = __raw_readl(S3C2443_CLKDIV0);
|
||||
tmp &= ~(0x1<<13);
|
||||
tmp |= (0x1<<13);
|
||||
__raw_writel(tmp, S3C2443_CLKDIV0);
|
||||
__raw_writel(tmp, S3C2443_CLKDIV0);*/
|
||||
#else
|
||||
/* Qisda, ShiYong Lin, 2009/10/27, Modify for exception in s3c_idle function {*/
|
||||
// tmp = __raw_readl(S3C2443_PWRMODE);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ===========================================================================
|
||||
// cyio.c
|
||||
// Copyright (C) 2008-2009 Bookeen - All rights reserved
|
||||
// Copyright (C) 2008-2010 Bookeen - All rights reserved
|
||||
// ===========================================================================
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
@ -14,7 +14,6 @@
|
||||
#include <linux/pm.h>
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
|
||||
#include <cybook.h>
|
||||
|
||||
#include <linux/cyio.h>
|
||||
|
||||
@ -176,6 +176,14 @@ config TOUCHSCREEN_UCB1400
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called ucb1400_ts.
|
||||
|
||||
config TOUCHSCREEN_ORIZON
|
||||
tristate "Touch Screen driver of Cybook Orizon"
|
||||
default y
|
||||
depends on MACH_CYBOOK_ORIZON
|
||||
help
|
||||
Select this driver if you want support for Cybook Orizon Touchscreen
|
||||
|
||||
#Qisda Tony 090406, add Auo touch i2c driver [
|
||||
config TOUCHSCREEN_IIC_QISDA
|
||||
tristate "Touch Screen for IIC Qisda"
|
||||
|
||||
@ -17,6 +17,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
|
||||
obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
|
||||
obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
|
||||
obj-$(CONFIG_TOUCHSCREEN_S3C) += s3c-ts.o
|
||||
obj-$(CONFIG_TOUCHSCREEN_ORIZON) += orizon_ts.o
|
||||
#Qisda Tony 090406, add Auo touch i2c driver [
|
||||
obj-$(CONFIG_TOUCHSCREEN_IIC_QISDA) += s3c_ts_iic.o
|
||||
#Qisda Tony 090406, add Auo touch i2c driver ]
|
||||
|
||||
578
drivers/input/touchscreen/orizon_ts.c
Normal file
578
drivers/input/touchscreen/orizon_ts.c
Normal file
@ -0,0 +1,578 @@
|
||||
// ===========================================================================
|
||||
// orizon_ts.c
|
||||
// Copyright (C) 2003-2010 Bookeen - All rights reserved
|
||||
// ===========================================================================
|
||||
|
||||
/* TODO: Verify if all this includes are necessary */
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm/atomic.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/arch/irqs.h>
|
||||
#include <asm/arch/gpio.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/jiffies.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/ctype.h>
|
||||
|
||||
#include <cybook.h>
|
||||
#include <linux/cyio.h>
|
||||
|
||||
#define DEBUG_MESSAGES
|
||||
//#define DEBUG_TRACEFUNC
|
||||
|
||||
#define MODULE_NAME "ORIZON-TS"
|
||||
|
||||
#define FINGER_NUM 0x00
|
||||
#define INT_DELAY 0x64 /* Default 0x64 */
|
||||
#define INT_MODE 0x01
|
||||
#define X_SENS 0x22 /* Default 0x14 */
|
||||
#define Y_SENS 0x22 /* Default 0x14 */
|
||||
|
||||
#ifdef DEBUG_MESSAGES
|
||||
|
||||
enum InfoLevel
|
||||
{
|
||||
INFO_ERROR = 0,
|
||||
INFO_WARNING,
|
||||
INFO_NORMAL,
|
||||
INFO_DEBUG,
|
||||
INFO_VERBOSE,
|
||||
};
|
||||
|
||||
# ifndef VERBOSE_LEVEL
|
||||
# define VERBOSE_LEVEL INFO_VERBOSE
|
||||
# endif
|
||||
|
||||
# ifdef DEBUG_TRACEFUNC
|
||||
|
||||
static int _dbg_FunctionLevel = 0;
|
||||
|
||||
# define MSG(str) {\
|
||||
int __i;\
|
||||
printk(KERN_ALERT "+");\
|
||||
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||
printk("-");\
|
||||
printk("||" str "\n");\
|
||||
}
|
||||
|
||||
# define DBG(str, ...) {\
|
||||
int __i;\
|
||||
printk(KERN_ALERT "+");\
|
||||
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||
printk("-");\
|
||||
printk("||" str "\n", __VA_ARGS__);\
|
||||
}
|
||||
|
||||
# define INFOL(level, s) do {\
|
||||
if (level <= VERBOSE_LEVEL) {\
|
||||
int __i;\
|
||||
printk(KERN_ALERT "+");\
|
||||
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||
printk("-");\
|
||||
printk("<%d>%s:%s(): ", level, __FILE__, __func__); printk s; printk("\n");\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
# define FUNC_IN() {\
|
||||
int __i;\
|
||||
_dbg_FunctionLevel++;\
|
||||
printk(KERN_ALERT "+");\
|
||||
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||
printk("-");\
|
||||
printk(">> %s() >>\n", __func__);\
|
||||
}
|
||||
|
||||
# define FUNC_OUT() {\
|
||||
int __i;\
|
||||
printk(KERN_ALERT "+");\
|
||||
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||
printk("-");\
|
||||
printk("<< %s() <<\n", __func__);\
|
||||
_dbg_FunctionLevel--;\
|
||||
}
|
||||
|
||||
# define FUNC_OUTR(val) {\
|
||||
int __i;\
|
||||
printk(KERN_ALERT "+");\
|
||||
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||
printk("-");\
|
||||
printk("<< %s() = %d <<\n", __func__, val);\
|
||||
_dbg_FunctionLevel--;\
|
||||
}
|
||||
# else /* DEBUG_TRACEFUNC */
|
||||
|
||||
# define MSG(str) do {\
|
||||
printk(KERN_ALERT MODULE_NAME ": " str "\n");\
|
||||
} while(0)
|
||||
|
||||
# define DBG(str, ...) do {\
|
||||
printk(KERN_ALERT MODULE_NAME ": " str "\n", __VA_ARGS__);\
|
||||
} while(0)
|
||||
# define FUNC_IN() do {\
|
||||
} while(0)
|
||||
|
||||
# define FUNC_OUT() do {\
|
||||
} while(0)
|
||||
|
||||
# define FUNC_OUTR(val) do {\
|
||||
printk(KERN_ALERT MODULE_NAME ": %s() return %d\n", __func__, val);\
|
||||
} while(0)
|
||||
|
||||
# define INFOL(level, s) do {\
|
||||
if (level <= VERBOSE_LEVEL) {\
|
||||
printk("<%d>%s:%s(): ", level, __FILE__, __func__); printk s; printk("\n");\
|
||||
}\
|
||||
} while(0)
|
||||
|
||||
# endif /* DEBUG_TRACEFUNC */
|
||||
#else /* DEBUG_MESSAGES */
|
||||
# define MSG(str)
|
||||
# define DBG(str, ...)
|
||||
# define FUNC_IN()
|
||||
# define FUNC_OUT()
|
||||
# define FUNC_OUTR(val)
|
||||
# define INFOL(level, s)
|
||||
# define INFO(s)
|
||||
#endif /* DEBUG_MESSAGES */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
POWER_UNDEFINED = -1,
|
||||
POWER_OFF = 0,
|
||||
POWER_ON,
|
||||
POWER_ONAUTOSTANDBY,
|
||||
POWER_DEEPSLEEP,
|
||||
} Ots_PowerModes;
|
||||
|
||||
/*============================================================================*/
|
||||
/*============================= Prototypes ===================================*/
|
||||
/*============================================================================*/
|
||||
|
||||
/**************************** i2c functions ***********************************/
|
||||
static int ots_attachAdapter (struct i2c_adapter *adapter);
|
||||
static int ots_detect (struct i2c_adapter *adapter, int address, int kind);
|
||||
static int ots_detachClient (struct i2c_client *client);
|
||||
|
||||
static int ots_suspend (struct device *dev, pm_message_t state);
|
||||
static int ots_resume (struct device *dev);
|
||||
|
||||
//static void ots_dumpI2C(void);
|
||||
/**************************** irq functions ***********************************/
|
||||
static void ots_checkWorkFunction (struct work_struct *work);
|
||||
static irqreturn_t ots_interrupt (int irq, void *dev_id);
|
||||
/******************************* Chip functions *******************************/
|
||||
static void ots_setPowerMode (Ots_PowerModes power);
|
||||
static void ots_setDeviceParameters (unsigned char int_mode,
|
||||
unsigned char x_sensitivity,
|
||||
unsigned char y_sensitivity);
|
||||
static void ots_ackInterrupt (void);
|
||||
/****************************** Module functions ******************************/
|
||||
static int __init ots_init (void);
|
||||
static void __exit ots_exit (void);
|
||||
/*============================= End of prototypes ============================*/
|
||||
|
||||
/*============================================================================*/
|
||||
/*============================= Variables ====================================*/
|
||||
/*============================================================================*/
|
||||
struct workqueue_struct *ots_check_workqueue;
|
||||
struct work_struct ots_check_work;
|
||||
|
||||
static Ots_PowerModes ots_currentPowerMode = POWER_UNDEFINED;
|
||||
|
||||
/****************************** i2c configuration *****************************/
|
||||
#define OTS_ADDR_I2C 0x5C
|
||||
|
||||
static unsigned short normal_i2c[] = { OTS_ADDR_I2C,
|
||||
I2C_CLIENT_END };
|
||||
|
||||
/* Insmod parameters */
|
||||
I2C_CLIENT_INSMOD_1 (ots);
|
||||
struct i2c_client *ots_client;
|
||||
|
||||
/* Each client has this additional data */
|
||||
struct ots_data
|
||||
{
|
||||
struct i2c_client client;
|
||||
};
|
||||
|
||||
/* This is the I2C driver that will be inserted */
|
||||
static struct i2c_driver ots_driver ={
|
||||
.driver =
|
||||
{
|
||||
.name = "orizon_ts",
|
||||
.suspend = ots_suspend,
|
||||
.resume = ots_resume,
|
||||
},
|
||||
.id = I2C_DRIVERID_EEPROM,
|
||||
.attach_adapter = ots_attachAdapter,
|
||||
.detach_client = ots_detachClient,
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
/**************************** i2c functions ***********************************/
|
||||
/******************************************************************************/
|
||||
#if 0
|
||||
static void ots_dumpI2C(void)
|
||||
{
|
||||
int Addr = 0;
|
||||
unsigned char value;
|
||||
int I,J;
|
||||
printk("-------------------------------------------------------------------------------\n");
|
||||
printk("-------------------------------------I²C TS------------------------------------\n");
|
||||
for ( J = 0; J < 16; J++ )
|
||||
{
|
||||
printk("%04X: ", Addr);
|
||||
for ( I = 0; I < 16; I++, Addr++ )
|
||||
{
|
||||
value = i2c_smbus_read_byte_data(ots_client, Addr);
|
||||
mdelay(4);
|
||||
printk("%02X ", value);
|
||||
}
|
||||
|
||||
printk(" | ");
|
||||
Addr -= 16;
|
||||
|
||||
for ( I = 0; I < 16; I++, Addr++ )
|
||||
{
|
||||
value = i2c_smbus_read_byte_data(ots_client, Addr);
|
||||
mdelay(4);
|
||||
printk("%c", isprint(value) ? value : '.');
|
||||
}
|
||||
printk("\n");
|
||||
|
||||
}
|
||||
printk("-------------------------------------------------------------------------------\n");
|
||||
printk("-------------------------------------------------------------------------------\n");
|
||||
}
|
||||
#endif
|
||||
static int ots_attachAdapter (struct i2c_adapter *adapter)
|
||||
{
|
||||
return i2c_probe(adapter, &addr_data, ots_detect);
|
||||
}
|
||||
|
||||
/* This function is called by i2c_probe */
|
||||
static int ots_detect (struct i2c_adapter *adapter, int address, int kind)
|
||||
{
|
||||
struct ots_data *data = NULL;
|
||||
|
||||
int err = 0;
|
||||
FUNC_IN();
|
||||
//DBG(">>%s(%p, 0x%X, 0x%X)", __func__, adapter, address, kind);
|
||||
|
||||
|
||||
if ( !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
|
||||
| I2C_FUNC_SMBUS_BYTE) )
|
||||
goto exit;
|
||||
|
||||
if ( address == OTS_ADDR_I2C )
|
||||
{
|
||||
if ( !(data = kzalloc(sizeof (struct ots_data), GFP_KERNEL)) )
|
||||
{
|
||||
err = -ENOMEM;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ots_client = &data->client;
|
||||
i2c_set_clientdata(ots_client, data);
|
||||
ots_client->addr = address;
|
||||
ots_client->adapter = adapter;
|
||||
ots_client->driver = &ots_driver;
|
||||
ots_client->flags = 0;
|
||||
|
||||
/* Fill in the remaining client fields */
|
||||
strlcpy(ots_client->name, "orizon_ts", I2C_NAME_SIZE);
|
||||
|
||||
/* Tell the I2C layer a new client has arrived */
|
||||
if ( (err = i2c_attach_client(ots_client)) )
|
||||
{
|
||||
goto exit_kfree;
|
||||
}
|
||||
|
||||
ots_setPowerMode(POWER_ONAUTOSTANDBY);
|
||||
ots_setDeviceParameters(INT_MODE, X_SENS, Y_SENS);
|
||||
/* Now we are sure that the driver init successfully, then aquire the IRQ */
|
||||
set_irq_type(IRQ_EINT2, IRQT_FALLING);
|
||||
|
||||
if ( request_irq(IRQ_EINT2, ots_interrupt, SA_SHIRQ, "orizon_ts", &ots_client) )
|
||||
{
|
||||
printk(KERN_ERR "failed to get interrupt resouce at IRQ_EINT2.\n");
|
||||
goto exit_kfree;
|
||||
}
|
||||
}
|
||||
|
||||
goto exit;
|
||||
|
||||
exit_kfree:
|
||||
kfree(data);
|
||||
exit:
|
||||
FUNC_OUTR(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ots_detachClient (struct i2c_client *client)
|
||||
{
|
||||
int err = 0;
|
||||
FUNC_IN();
|
||||
|
||||
err = i2c_detach_client(client);
|
||||
if ( err )
|
||||
goto exit;
|
||||
|
||||
kfree(i2c_get_clientdata(client));
|
||||
|
||||
exit:
|
||||
FUNC_OUTR(err);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int ots_suspend (struct device *dev, pm_message_t state)
|
||||
{
|
||||
int ret = 0;
|
||||
FUNC_IN();
|
||||
|
||||
FUNC_OUTR(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int ots_resume (struct device *dev)
|
||||
{
|
||||
FUNC_IN();
|
||||
|
||||
FUNC_OUT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
/********************** Interrupt Related functions ***************************/
|
||||
/******************************************************************************/
|
||||
static void ots_checkWorkFunction (struct work_struct *work)
|
||||
{
|
||||
unsigned long x1, y1, x2, y2;
|
||||
FUNC_IN();
|
||||
|
||||
/* Here do what the interrupt should... (ie read touch values) */
|
||||
x1 = i2c_smbus_read_byte_data(ots_client, 0);
|
||||
x1 |= i2c_smbus_read_byte_data(ots_client, 1) << 8;
|
||||
|
||||
y1 = i2c_smbus_read_byte_data(ots_client, 2);
|
||||
y1 |= i2c_smbus_read_byte_data(ots_client, 3) << 8;
|
||||
|
||||
x2 = i2c_smbus_read_byte_data(ots_client, 4);
|
||||
x2 |= i2c_smbus_read_byte_data(ots_client, 5) << 8;
|
||||
|
||||
y2 = i2c_smbus_read_byte_data(ots_client, 6);
|
||||
y2 |= i2c_smbus_read_byte_data(ots_client, 7) << 8;
|
||||
|
||||
DBG("x1: %lu\ty1: %lu\ty1: %lu\ty2: %lu", x1, y1, x2, y2);
|
||||
|
||||
/* Say I get the data */
|
||||
ots_ackInterrupt();
|
||||
|
||||
FUNC_OUT();
|
||||
}
|
||||
|
||||
static irqreturn_t ots_interrupt (int irq, void *dev_id)
|
||||
{
|
||||
irqreturn_t ret = IRQ_HANDLED;
|
||||
static int initialised = 0;
|
||||
FUNC_IN();
|
||||
|
||||
if (initialised == 0)
|
||||
{
|
||||
INIT_WORK(&ots_check_work, ots_checkWorkFunction);
|
||||
initialised = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
PREPARE_WORK(&ots_check_work, ots_checkWorkFunction);
|
||||
}
|
||||
schedule_work(&ots_check_work);
|
||||
|
||||
//FUNC_OUTR((int)ret);
|
||||
return ret;
|
||||
}
|
||||
/******************************************************************************/
|
||||
/******************************* Chip functions *******************************/
|
||||
/******************************************************************************/
|
||||
static void ots_setPowerMode (Ots_PowerModes power)
|
||||
{
|
||||
unsigned char tmpReg;
|
||||
|
||||
FUNC_IN();
|
||||
|
||||
if (power == ots_currentPowerMode)
|
||||
return; /* No need to do anything, we are in the same power mode... */
|
||||
|
||||
switch(power)
|
||||
{
|
||||
default:
|
||||
case POWER_UNDEFINED:
|
||||
/* Error */
|
||||
DBG("Error: invalid power mode #%d", power);
|
||||
break;
|
||||
|
||||
case POWER_ON:
|
||||
/* Set the power to on */
|
||||
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
|
||||
msleep(100);
|
||||
/* TODO: Does we need to set chip settings? */
|
||||
tmpReg = 0x0; /* Set in "Active Mode" */
|
||||
i2c_smbus_write_byte_data(ots_client, 0x73, tmpReg);
|
||||
msleep(400);
|
||||
break;
|
||||
|
||||
case POWER_OFF:
|
||||
/* Set the power to off */
|
||||
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
|
||||
msleep(10);
|
||||
break;
|
||||
|
||||
case POWER_ONAUTOSTANDBY:
|
||||
if ( (ots_currentPowerMode != POWER_ON) &&
|
||||
(ots_currentPowerMode != POWER_DEEPSLEEP) )
|
||||
ots_setPowerMode(POWER_ON); /* Set myself as Power ON before anything */
|
||||
|
||||
//tmpReg = i2c_smbus_read_byte_data(ots_client, 0x24);
|
||||
tmpReg = (((50) /* timeout in ms for auto sleep */ ) & 0x0F) << 4;
|
||||
tmpReg |= (1<< 2); /* Activate auto sleep mode */
|
||||
tmpReg |= 0x1; /* Set in "Sleep Mode" */
|
||||
|
||||
i2c_smbus_write_byte_data(ots_client, 0x73, tmpReg);
|
||||
msleep(4);
|
||||
break;
|
||||
|
||||
case POWER_DEEPSLEEP:
|
||||
if ( (ots_currentPowerMode != POWER_ON) &&
|
||||
(ots_currentPowerMode != POWER_ONAUTOSTANDBY) )
|
||||
ots_setPowerMode(POWER_ON); /* Set myself as Power ON before anything */
|
||||
|
||||
tmpReg = 0x02;
|
||||
i2c_smbus_write_byte_data(ots_client, 0x73, tmpReg);
|
||||
msleep(4);
|
||||
break;
|
||||
}
|
||||
|
||||
ots_currentPowerMode = power;
|
||||
FUNC_OUT();
|
||||
}
|
||||
|
||||
static void ots_setDeviceParameters (unsigned char int_mode,
|
||||
unsigned char x_sensitivity,
|
||||
unsigned char y_sensitivity)
|
||||
{
|
||||
unsigned char tmpReg;
|
||||
|
||||
FUNC_IN();
|
||||
/* Then set INT_WIDTH */
|
||||
|
||||
/*
|
||||
* Interrupt width register @114 [0x72]
|
||||
* b7-b0: int width
|
||||
* Default: 0x64
|
||||
*/
|
||||
i2c_smbus_write_byte_data(ots_client, 0x72, INT_DELAY);
|
||||
mdelay(4);
|
||||
/* Now set sensitivity */
|
||||
i2c_smbus_write_byte_data(ots_client, 0x6F, x_sensitivity);
|
||||
mdelay(4);
|
||||
i2c_smbus_write_byte_data(ots_client, 0x70, y_sensitivity);
|
||||
mdelay(4);
|
||||
|
||||
i2c_smbus_write_byte_data(ots_client, 0xBE, 0x01); // TEST
|
||||
tmpReg = i2c_smbus_read_byte_data(ots_client, 0xBE); // TEST
|
||||
DBG("0xBE = %02X", tmpReg);
|
||||
|
||||
DBG("Firmware Version =0x%x\n", i2c_smbus_read_byte_data(ots_client, 0x77));
|
||||
|
||||
/* Activate the device ! */
|
||||
|
||||
/*
|
||||
* Interrupt mode Setting register @113 [0x71]
|
||||
* b7-b6-b5: TP_NUM : How many finger, 000: none, 001: One, 010: Two
|
||||
* b4: INT_RELEASE: used to ack (1) IRQ in periodical mode
|
||||
* b3: EN_INT: Enable int (1: enabled, 0: disable)
|
||||
* b2: INT_POL: 0: active low, 1: active high
|
||||
* b1-b0: INT_MODE: 00: INT periodicaly, 01: INT assert when coord changes
|
||||
* 10: TOuch indicate, 11: INT assert when INT_RELEASE modified
|
||||
*
|
||||
* Default 0x0C [000 0 1 1 00]
|
||||
* Qisda: 0x0A [000 0 1 0 10]
|
||||
* Int periodicaly, Active High, and INT enabled
|
||||
*/
|
||||
/* 2 Finger Active High Mode */
|
||||
tmpReg = (FINGER_NUM << 5) | (1 << 3) | (0 << 2) | ((int_mode & 0x03) << 0);
|
||||
DBG("Settings: 0x%02X", tmpReg);
|
||||
i2c_smbus_write_byte_data(ots_client, 0x71, tmpReg);
|
||||
mdelay(4);
|
||||
tmpReg = i2c_smbus_read_byte_data(ots_client, 0x71); // TEST
|
||||
DBG("[0x71] Settings = %02X", tmpReg);
|
||||
FUNC_OUT();
|
||||
}
|
||||
|
||||
|
||||
static void ots_ackInterrupt (void)
|
||||
{
|
||||
unsigned char tmpReg;
|
||||
FUNC_IN();
|
||||
|
||||
tmpReg = i2c_smbus_read_byte_data(ots_client, 0x71);
|
||||
tmpReg |= (1<<4);
|
||||
i2c_smbus_write_byte_data(ots_client, 0x71, tmpReg);
|
||||
|
||||
FUNC_OUT();
|
||||
}
|
||||
/******************************************************************************/
|
||||
/****************************** Module functions ******************************/
|
||||
/******************************************************************************/
|
||||
static int __init ots_init (void)
|
||||
{
|
||||
FUNC_IN();
|
||||
|
||||
/* if (GET_CAPABILITY(PLAT_CAP_GSENSOR) == PLAT_CAP_GMMA7660)
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
/* Init GPIOs */
|
||||
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
|
||||
s3c2410_gpio_pullup(S3C2410_GPD10, 2);
|
||||
|
||||
i2c_add_driver(&ots_driver);
|
||||
|
||||
FUNC_OUT();
|
||||
return 0;
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
static void __exit ots_exit (void)
|
||||
{
|
||||
FUNC_IN();
|
||||
/*if (GET_CAPABILITY(PLAT_CAP_GSENSOR) == PLAT_CAP_GMMA7660)
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
/* Deinit GPIOs */
|
||||
/* Nothing to do, leave it as output is good enought, just set the
|
||||
* device as power off */
|
||||
ots_setPowerMode(POWER_OFF);
|
||||
|
||||
i2c_del_driver(&ots_driver);
|
||||
FUNC_OUT();
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
module_init (ots_init);
|
||||
module_exit (ots_exit);
|
||||
// ---------------------------------------------------------------------------
|
||||
MODULE_LICENSE ("GPL");
|
||||
MODULE_AUTHOR ("Bookeen <developers@bookeen.com>");
|
||||
MODULE_VERSION ("1.0");
|
||||
MODULE_DESCRIPTION ("Cybook Orizon Touchpanel driver");
|
||||
// ===========================================================================
|
||||
@ -82,7 +82,9 @@ extern unsigned int g_wakeup_event_occurs;
|
||||
//#endif
|
||||
|
||||
#define KEY_BUF_SIZE 1
|
||||
struct s3c_ts_iic {
|
||||
|
||||
struct s3c_ts_iic
|
||||
{
|
||||
struct input_dev *dev;
|
||||
struct i2c_client *client;
|
||||
struct platform_device *pdev;
|
||||
@ -91,7 +93,8 @@ struct s3c_ts_iic {
|
||||
unsigned int polling_time;
|
||||
};
|
||||
|
||||
struct t_point {
|
||||
struct t_point
|
||||
{
|
||||
short x;
|
||||
short y;
|
||||
};
|
||||
@ -123,7 +126,11 @@ static struct task_struct *kmain_task=NULL;
|
||||
//static void touch_iic_enable_interrupt(void) { printk("touch_iic_enable_interrupt\n"); writel(readl(S3C24XX_EINTMASK) & ~(0x1<<GPIO_NUM), S3C24XX_EINTMASK); }
|
||||
//static void touch_iic_clear_interrupt_pending(void) { printk("touch_iic_clear_interrupt_pending\n"); writel(0x1<<GPIO_NUM, S3C24XX_EINTPEND); }
|
||||
//static void touch_iic_set_interrupt_method(int eSM) {writel(readl(S3C24XX_EXTINT0) & ~(0x7<<(GPIO_NUM<<2)) | (eSM<<(GPIO_NUM<<2)),S3C24XX_EXTINT0);}
|
||||
static void touhc_iic_timer_handler_qisda(unsigned long data) { schedule_work(&workq_readdata); }
|
||||
|
||||
static void touhc_iic_timer_handler_qisda (unsigned long data)
|
||||
{
|
||||
schedule_work(&workq_readdata);
|
||||
}
|
||||
|
||||
/*kit.mod 2009/11/17*/
|
||||
#define TOUCH_IIC_CALIBRATION 1
|
||||
@ -209,6 +216,7 @@ static void touch_iic_init(void)
|
||||
/* <=CHECK_LEN_EACH_TIME shall NOT be larger than 8, sync with qisda_iic.c */
|
||||
# define CHECK_LEN_EACH_TIME 8
|
||||
static int IsPanelPressed = 0;
|
||||
|
||||
static void bufferd_touch_point_handler (int WithRelease)
|
||||
{
|
||||
/* [0] is the index of check count */
|
||||
@ -219,28 +227,34 @@ static void bufferd_touch_point_handler(int WithRelease)
|
||||
|
||||
//printk("bufferd_touch_point_handler: start\n");
|
||||
buffered_data[1] = CHECK_LEN_EACH_TIME;
|
||||
for (i = 0; i < (BUFFERED_DATA_LEN/CHECK_LEN_EACH_TIME); i++) {
|
||||
for ( i = 0; i < (BUFFERED_DATA_LEN / CHECK_LEN_EACH_TIME); i++ )
|
||||
{
|
||||
buffered_data[0] = i;
|
||||
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_READ_BUFFERED_POSITION, buffered_data);
|
||||
}
|
||||
|
||||
//Aaron: send input event.
|
||||
if ((buffered_data[2] == 0) && (buffered_data[3] == 0)) {
|
||||
if ( (buffered_data[2] == 0) && (buffered_data[3] == 0) )
|
||||
{
|
||||
/* If buffered data is empty, do nothing before return*/
|
||||
return;
|
||||
}
|
||||
for (i = 1; i < (BUFFERED_DATA_LEN+1); i++) {
|
||||
for ( i = 1; i < (BUFFERED_DATA_LEN + 1); i++ )
|
||||
{
|
||||
IndexOffset = 2 * i;
|
||||
/* check if next point data is zero, which means no more data. */
|
||||
if ( (i == BUFFERED_DATA_LEN) ||
|
||||
(!buffered_data[IndexOffset + 2] && !buffered_data[IndexOffset + 2 + 1])) {
|
||||
(!buffered_data[IndexOffset + 2] && !buffered_data[IndexOffset + 2 + 1]) )
|
||||
{
|
||||
//TODO: send release event.
|
||||
input_report_abs(ts_iic->dev, ABS_X, buffered_data[IndexOffset]);
|
||||
input_report_abs(ts_iic->dev, ABS_Y, buffered_data[IndexOffset + 1]);
|
||||
// //for debug
|
||||
// //printk("\n bufferd_touch_point_handler: panel is touching(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i);
|
||||
if (WithRelease) {
|
||||
if (!IsPanelPressed) {
|
||||
if ( WithRelease )
|
||||
{
|
||||
if ( !IsPanelPressed )
|
||||
{
|
||||
/* in case that only one buffered data with release */
|
||||
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
|
||||
input_report_abs(ts_iic->dev, ABS_PRESSURE, 1);
|
||||
@ -259,7 +273,8 @@ static void bufferd_touch_point_handler(int WithRelease)
|
||||
//TODO: send press event
|
||||
input_report_abs(ts_iic->dev, ABS_X, buffered_data[IndexOffset]);
|
||||
input_report_abs(ts_iic->dev, ABS_Y, buffered_data[IndexOffset + 1]);
|
||||
if (!IsPanelPressed) {
|
||||
if ( !IsPanelPressed )
|
||||
{
|
||||
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
|
||||
input_report_abs(ts_iic->dev, ABS_PRESSURE, 1);
|
||||
IsPanelPressed = 1;
|
||||
@ -289,7 +304,8 @@ static void ts_iic_workqueue(struct work_struct *work)
|
||||
//Qisda Tony 090415 [
|
||||
#ifdef POLLING_MODE
|
||||
# ifdef KTHREAD_USE
|
||||
for(;;){
|
||||
for (;; )
|
||||
{
|
||||
//This only get the interrupt periodically. No while loop in workqueue, use polling....
|
||||
//Tony test
|
||||
//Tony test
|
||||
@ -466,7 +482,8 @@ release:
|
||||
# endif
|
||||
|
||||
finished:
|
||||
if(need_calibration){
|
||||
if ( need_calibration )
|
||||
{
|
||||
printk("TOUCH_IIC_CALIBRATION...");
|
||||
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_CALIBRATION, NULL);
|
||||
need_calibration = FALSE;
|
||||
@ -486,7 +503,8 @@ finished:
|
||||
if ( (curpoint[0] == 0) || (curpoint[1] == 0) )
|
||||
{
|
||||
//printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer);
|
||||
if(emptyKeyBuffer==TRUE){
|
||||
if ( emptyKeyBuffer == TRUE )
|
||||
{
|
||||
emptyKeyBuffer = FALSE;
|
||||
# ifdef USE_BUFFERED_TOUCH_DATA
|
||||
bufferd_touch_point_handler(1); /* with release */
|
||||
@ -494,13 +512,15 @@ finished:
|
||||
# endif
|
||||
goto finished;
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
//printk("goto release \n");
|
||||
goto release;
|
||||
}
|
||||
}
|
||||
# ifdef USE_BUFFERED_TOUCH_DATA
|
||||
if (go_in_suspend) {
|
||||
if ( go_in_suspend )
|
||||
{
|
||||
bufferd_touch_point_handler(0); /* without release */
|
||||
go_in_suspend = 0;
|
||||
}
|
||||
@ -511,7 +531,8 @@ finished:
|
||||
input_report_abs(ts_iic->dev, ABS_X, ts_iic->xp);
|
||||
input_report_abs(ts_iic->dev, ABS_Y, ts_iic->yp);
|
||||
# ifdef USE_BUFFERED_TOUCH_DATA
|
||||
if (!IsPanelPressed) {
|
||||
if ( !IsPanelPressed )
|
||||
{
|
||||
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
|
||||
input_report_abs(ts_iic->dev, ABS_PRESSURE, 1);
|
||||
IsPanelPressed = 1;
|
||||
@ -601,6 +622,7 @@ finished:
|
||||
|
||||
//Qisda Tony 090415 [
|
||||
#ifndef POLLING_MODE
|
||||
|
||||
static irqreturn_t touch_iic_isr (int irq, void *dev_id)
|
||||
{
|
||||
//static int count=0;
|
||||
@ -637,7 +659,8 @@ static int s3c_ts_iic_open(struct inode *inode, struct file *file)
|
||||
#define OPCODE_EEPROM 3
|
||||
#define OPCODE_QUERY 8
|
||||
|
||||
typedef struct BLModeInfo {
|
||||
typedef struct BLModeInfo
|
||||
{
|
||||
char Status;
|
||||
char FlashLock;
|
||||
char Version;
|
||||
@ -678,8 +701,6 @@ int normalmode_read_eeprom(unsigned int eepr_addr, unsigned char *buff)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int normalmode_read_op (unsigned int mem_addr, unsigned char *buff)
|
||||
{
|
||||
unsigned char tmp[2];
|
||||
@ -756,10 +777,12 @@ int blmode_read_op(int opcode)
|
||||
else
|
||||
{
|
||||
printk("[blmode_read_op] ok:[%x][%x][%x][%x]\n", bl_info->Status, bl_info->FlashLock, bl_info->Version, bl_info->Key);
|
||||
if ( (bl_info->Status&0x80) != 0) {
|
||||
if ( (bl_info->Status & 0x80) != 0 )
|
||||
{
|
||||
ret = -8;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if ( opcode == OPCODE_AES )
|
||||
{
|
||||
if ( bl_info->FlashLock == 0x00 )
|
||||
@ -809,7 +832,8 @@ int blmode_wait_ready()
|
||||
unsigned int pin_state;
|
||||
int count = 0;
|
||||
int ret = 0;
|
||||
do {
|
||||
do
|
||||
{
|
||||
pin_state = (__raw_readl(S3C2410_GPFDAT)&(1 << 2));
|
||||
count++;
|
||||
msleep(20);
|
||||
@ -824,6 +848,7 @@ int get_touch_firmware_info(char *buff)
|
||||
/* read version */
|
||||
normalmode_read_op(119, buff);
|
||||
}
|
||||
|
||||
int enter_blmode (int method)
|
||||
{
|
||||
disable_irq(IRQ_EINT2);
|
||||
@ -867,6 +892,7 @@ int enter_blmode (int method)
|
||||
blmode_read_op(OPCODE_QUERY);
|
||||
}
|
||||
}
|
||||
|
||||
int reset_touch ()
|
||||
{
|
||||
#ifdef CONFIG_QISDA_BK060B00
|
||||
@ -930,7 +956,8 @@ int update_touch_firmware(unsigned long size, char* frame_data)
|
||||
char *p_tail;
|
||||
|
||||
count = 0;
|
||||
do {
|
||||
do
|
||||
{
|
||||
p_head = strchr(data_ptr, '$');
|
||||
if ( (p_head != NULL) && (p_tail < limit) )
|
||||
{
|
||||
@ -954,7 +981,8 @@ int update_touch_firmware(unsigned long size, char* frame_data)
|
||||
|
||||
opcode = blmode_write_op(cmd_buff);
|
||||
printk("[blmode_write_op][%d]=%d\n", count, opcode);
|
||||
if ( opcode < 0) {
|
||||
if ( opcode < 0 )
|
||||
{
|
||||
goto FAIL;
|
||||
}
|
||||
if ( opcode != OPCODE_USER )
|
||||
@ -1000,10 +1028,12 @@ FAIL:
|
||||
/****** GPF2 => TP_INT ******/
|
||||
/****** GPF5 => TOUCH_EN ******/
|
||||
/*** GPC3 => T-Sensor Power ***/
|
||||
|
||||
/*******************************/
|
||||
static int s3c_ts_iic_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
switch(cmd){
|
||||
switch ( cmd )
|
||||
{
|
||||
case TOUCH_IIC_CALIBRATION:
|
||||
#ifdef POLLING_MODE
|
||||
need_calibration = TRUE;
|
||||
@ -1017,10 +1047,12 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
|
||||
break;
|
||||
|
||||
case TOUCH_IIC_SET_POLLING_TIME:
|
||||
if((arg<1) || (arg>80)){
|
||||
if ( (arg < 1) || (arg > 80) )
|
||||
{
|
||||
printk("polling time should be 1-80\n");
|
||||
}
|
||||
else{
|
||||
else
|
||||
{
|
||||
ts_iic->polling_time = arg;
|
||||
touchPollingTime = arg;
|
||||
}
|
||||
@ -1235,8 +1267,6 @@ static const struct file_operations s3c_ts_iic_fops = {
|
||||
.release = NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
int s3c_ts_iic_port_init (struct i2c_client *c)
|
||||
{
|
||||
|
||||
@ -1244,7 +1274,8 @@ int s3c_ts_iic_port_init(struct i2c_client *c)
|
||||
|
||||
ts_iic->client = c;
|
||||
err = c->driver->command(c, QISDA_IIC_INIT, NULL);
|
||||
if(err<0){
|
||||
if ( err < 0 )
|
||||
{
|
||||
printk("Touch init faied\n");
|
||||
goto fail;
|
||||
}
|
||||
@ -1280,7 +1311,8 @@ int s3c_ts_iic_port_init(struct i2c_client *c)
|
||||
set_irq_type(IRQ_EINT2, S3C2410_EXTINT_FALLEDGE);
|
||||
err = request_irq(IRQ_EINT2, touch_iic_isr, SA_INTERRUPT, DEVICE_NAME, (void *)ts_iic->pdev);
|
||||
|
||||
if (err) {
|
||||
if ( err )
|
||||
{
|
||||
printk("request_irq failed (IRQ_EINT2) !!!\n");
|
||||
free_irq(IRQ_EINT2, ts_iic->dev);
|
||||
//ts_iic_port_deinit();
|
||||
@ -1293,7 +1325,8 @@ int s3c_ts_iic_port_init(struct i2c_client *c)
|
||||
|
||||
memset(keybuffer, 0x0, sizeof (keybuffer));
|
||||
//Qisda Tony 090415 ]
|
||||
if (register_chrdev (TOUCH_MAJOR, "touch_cmd", &s3c_ts_iic_fops)) {
|
||||
if ( register_chrdev(TOUCH_MAJOR, "touch_cmd", &s3c_ts_iic_fops) )
|
||||
{
|
||||
printk("unable to get major %d\n", TOUCH_MAJOR);
|
||||
|
||||
}
|
||||
@ -1345,7 +1378,8 @@ writel(readl(g_pGPIOReg_GPFCON+0x08) | (0x2<<0), g_pGPIOReg_GPFCON+0x08);
|
||||
ts_iic = kzalloc(sizeof (struct s3c_ts_iic), GFP_KERNEL);
|
||||
input_dev = input_allocate_device();
|
||||
|
||||
if (!input_dev) {
|
||||
if ( !input_dev )
|
||||
{
|
||||
err = -ENOMEM;
|
||||
goto fail;
|
||||
}
|
||||
@ -1368,7 +1402,8 @@ writel(readl(g_pGPIOReg_GPFCON+0x08) | (0x2<<0), g_pGPIOReg_GPFCON+0x08);
|
||||
|
||||
/* All went ok, so register to the input system */
|
||||
err = input_register_device(ts_iic->dev);
|
||||
if(err) {
|
||||
if ( err )
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -1398,6 +1433,7 @@ static int s3c_ts_iic_remove(struct platform_device *dev)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
static int s3c_ts_iic_suspend (struct platform_device *dev, pm_message_t state)
|
||||
{
|
||||
/*kit.add 2010/01/06, turn off Tilt-Sensor power*/
|
||||
@ -1541,15 +1577,24 @@ static struct platform_driver s3c_ts_iic_driver = {
|
||||
.remove = s3c_ts_iic_remove,
|
||||
.suspend = s3c_ts_iic_suspend,
|
||||
.resume = s3c_ts_iic_resume,
|
||||
.driver = {
|
||||
.driver =
|
||||
{
|
||||
.owner = THIS_MODULE,
|
||||
.name = DEVICE_NAME,
|
||||
},
|
||||
};
|
||||
|
||||
//static char banner[] __initdata = KERN_INFO "Touchscreen driver Of IIC type for Qisda\n";
|
||||
static int __init s3c_ts_iic_init(void) { return platform_driver_register(&s3c_ts_iic_driver); }
|
||||
static void __exit s3c_ts_iic_exit(void){ platform_driver_unregister(&s3c_ts_iic_driver); }
|
||||
|
||||
static int __init s3c_ts_iic_init (void)
|
||||
{
|
||||
return platform_driver_register(&s3c_ts_iic_driver);
|
||||
}
|
||||
|
||||
static void __exit s3c_ts_iic_exit (void)
|
||||
{
|
||||
platform_driver_unregister(&s3c_ts_iic_driver);
|
||||
}
|
||||
module_init (s3c_ts_iic_init);
|
||||
module_exit (s3c_ts_iic_exit);
|
||||
MODULE_AUTHOR ("Tony.YC.Huang@qisda.com");
|
||||
|
||||
@ -667,20 +667,6 @@ static unsigned int s3c24xx_serial_getclk(struct uart_port *port,
|
||||
struct baud_calc *resptr, *best, *sptr;
|
||||
int i;
|
||||
|
||||
/* Ralph added compile flag to disable it for BK060B00 */
|
||||
#ifndef CONFIG_QISDA_BK060B00
|
||||
/*Qisda Qube for smart card*/
|
||||
if(port->irq==73&&port->uartclk==1)
|
||||
{
|
||||
//force uart 1 clock= pclk
|
||||
cfg->clocks_size=1;
|
||||
}
|
||||
/*Qisda Qube for smart card*/
|
||||
#endif
|
||||
|
||||
//printk("\n\n\s3c24xx_serial_getclk\n\n\n");
|
||||
//printk("\n\n\n\n hwport= %ld \n\n\n\\n",cfg->hwport);
|
||||
//printk("\n\n\n\n hwport= %ld \n\n\n\\n",baud);
|
||||
clkp = cfg->clocks;
|
||||
best = NULL;
|
||||
|
||||
@ -784,18 +770,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
|
||||
|
||||
baud = uart_get_baud_rate(port, termios, old, 0, 115200*8);
|
||||
|
||||
/* Ralph added compile flag to disable it for BK060B00 */
|
||||
#ifndef CONFIG_QISDA_BK060B00
|
||||
/*Qisda Qube for smart card*/
|
||||
|
||||
if(port->irq==73&&port->uartclk==1)
|
||||
{
|
||||
//force uart1 to 38400
|
||||
baud=38400;
|
||||
}
|
||||
/*Qisda Qube for smart card*/
|
||||
#endif
|
||||
|
||||
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
|
||||
quot = port->custom_divisor;
|
||||
else
|
||||
|
||||
@ -37,8 +37,8 @@
|
||||
|
||||
#include <cybook.h>
|
||||
|
||||
//#define DEBUG_MESSAGES
|
||||
//#define DEBUG_TRACEFUNC
|
||||
#define DEBUG_MESSAGES
|
||||
#define DEBUG_TRACEFUNC
|
||||
|
||||
#define MODULE_NAME "AUO-TCON"
|
||||
|
||||
@ -717,7 +717,7 @@ static int tcon_probe (struct platform_device *dev)
|
||||
tmp = (tmp & ~(3 << 2)) | (1 << 2);
|
||||
__raw_writel(tmp, S3C2410_GPBCON);
|
||||
|
||||
mdelay(1);
|
||||
msleep(1);
|
||||
|
||||
// Panel power on
|
||||
tmp = __raw_readl(S3C2410_GPBDAT);
|
||||
|
||||
@ -2,6 +2,42 @@
|
||||
// cyio.h
|
||||
// Copyright (C) 2008-2010 Bookeen - All rights reserved
|
||||
// ===========================================================================
|
||||
|
||||
#define CYIO_EVENT_VERSION 1
|
||||
|
||||
typedef struct sCyEvent_t
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned char flags;
|
||||
unsigned char version; /*** Use for later compatibility */
|
||||
union
|
||||
{
|
||||
unsigned char raw[13];
|
||||
struct
|
||||
{
|
||||
unsigned short x1;
|
||||
unsigned short y1;
|
||||
unsigned short x2;
|
||||
unsigned short y2;
|
||||
} touch;
|
||||
struct
|
||||
{
|
||||
unsigned char key_ascii;
|
||||
} key;
|
||||
} data;
|
||||
} CyEvent_t;
|
||||
|
||||
enum
|
||||
{
|
||||
CYIO_EVENT_KEY = 'k',
|
||||
CYIO_EVENT_TOUCH = 't',
|
||||
CYIO_EVENT_SD = 's',
|
||||
CYIO_EVENT_ACCEL = 'a',
|
||||
CYIO_EVENT_TIMER = 'z',
|
||||
CYIO_EVENT_SYSTEM = 'u',
|
||||
//CYIO_EVENT_ = '',
|
||||
};
|
||||
|
||||
// Key events
|
||||
#define CYEVENT_KEY_ENTER 'e'
|
||||
#define CYEVENT_KEY_RIGHT 'r'
|
||||
@ -13,40 +49,44 @@
|
||||
#define CYEVENT_KEY_F3 '3'
|
||||
#define CYEVENT_KEY_F4 '4'
|
||||
#define CYEVENT_KEY_OFF 'o'
|
||||
#define CYEVENT_KEY_DSLP 'S'
|
||||
#define CYEVENT_KEY_DSLP 's'
|
||||
#define CYEVENT_KEY_VOLP '+'
|
||||
#define CYEVENT_KEY_VOLN '-'
|
||||
#define CYEVENT_KEY_REPEAT_FLAG 0x80
|
||||
#define CYEVENT_KEY_REPEAT_END '0'
|
||||
// Physical events
|
||||
#define CYEVENT_USB_IN 'p'
|
||||
#define CYEVENT_USB_OUT 'q'
|
||||
#define CYEVENT_AC_IN 'a'
|
||||
#define CYEVENT_AC_OUT 'b'
|
||||
#define CYEVENT_ACN_IN 'j'
|
||||
#define CYEVENT_ACN_OUT 'k'
|
||||
#define CYEVENT_SD_IN 's'
|
||||
#define CYEVENT_SD_OUT 't'
|
||||
#define CYEVENT_SDN_IN 'u'
|
||||
#define CYEVENT_SDN_OUT 'v'
|
||||
#define CYEVENT_KEY_TOGGLE_ACCEL 'a'
|
||||
#define CYEVENT_KEY_FACTORY_RESET 'f'
|
||||
|
||||
// G-Sensor events
|
||||
#define CYEVENT_ORIENTATIONCHANGED 'O'
|
||||
#define CYEVENT_G_ROT000 'A'
|
||||
#define CYEVENT_G_ROT090 'B'
|
||||
#define CYEVENT_G_ROT180 'C'
|
||||
#define CYEVENT_G_ROT270 'D'
|
||||
#define CYEVENT_TOGGLE_GSENSOR 'G'
|
||||
/* Flags definitions */
|
||||
/* Bit 7 to Bit 4 are event type dependent. If the event need more than 4 flags,
|
||||
* it can use it's own "private" values
|
||||
*/
|
||||
|
||||
// Logical events
|
||||
// CYEVENT_KEY_OFF + CYEVENT_KEY_VOLN
|
||||
#define CYEVENT_FACTORY_OFF 'x'
|
||||
#define CYEVENT_SUSPEND_SCREEN 'y'
|
||||
#define CYEVENT_SUSPEND_DEVICE 'z'
|
||||
/* Key event flags */
|
||||
#define CYEVENT_FLAG_KEY_REPEAT (1 << 7) /*** Signal that this key is repeated */
|
||||
#define CYEVENT_FLAG_KEY_END_OF_REPEAT (1 << 6) /*** Signal that the repeat is finished */
|
||||
#define CYEVENT_FLAG_KEY_CONTROL_CHARS (1 << 5) /*** Signal that the current key is not a real key (ie not an ascii value) */
|
||||
|
||||
/* Normaly no more used... */
|
||||
//#define CYIO_KERNEL_2_6 1
|
||||
/* Touch event flags */
|
||||
#define CYEVENT_FLAG_TOUCH_UP (0x1 << 6)
|
||||
#define CYEVENT_FLAG_TOUCH_MOVE (0x2 << 6)
|
||||
#define CYEVENT_FLAG_TOUCH_DOWN (0x3 << 6)
|
||||
|
||||
/* System Event */
|
||||
#define CYEVENT_FLAG_USB_STATE (1 << 7) /*** If not set, the USB is unplugged */
|
||||
#define CYEVENT_FLAG_AC_STATE (1 << 6) /*** If not set, the AC is unplugged */
|
||||
#define CYEVENT_FLAG_AC_STATE (1 << 5) /*** If not set, the SD is unplugged */
|
||||
|
||||
/* Timer event */
|
||||
#define CYEVENT_FLAG_TIMER_SCREEN (1 << 7)
|
||||
#define CYEVENT_FLAG_TIMER_DEVICE (1 << 6)
|
||||
|
||||
/* Bit 3 to Bit 1 are reserved (v1) */
|
||||
#define CYEVENT_FLAG_UNIQUEEVENT (1 << 0) /*** Used internaly to prevent other event of the same type to be pushed */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* TODO: This part should be moved elsewhere... */
|
||||
// ===========================================================================
|
||||
/* Non directly CyIO related values, but used for the Accelerometer */
|
||||
#define G_SENSOR_ON '1'
|
||||
@ -67,5 +107,6 @@ enum
|
||||
// ===========================================================================
|
||||
/* Exported function of CyIO */
|
||||
void Cyio_ResetTimer(void);
|
||||
int Cyio_PushEvent(char eventId, char unique);
|
||||
int __deprecated Cyio_PushEvent(char eventId, char unique); /* Old way */
|
||||
int Cyio_PushCyEvent(char eventId, char unique);
|
||||
// ===========================================================================
|
||||
|
||||
@ -414,13 +414,6 @@ void __init prepare_namespace(void)
|
||||
{
|
||||
int is_floppy;
|
||||
|
||||
/* qisda tim.huang 091115 delay 1 sec for more time to mount sd card { */
|
||||
#ifdef MOUNT_DELAY
|
||||
root_delay = 1;
|
||||
#endif
|
||||
/* qisda tim.huang 091115 delay 1 sec for more time to mount sd card } */
|
||||
|
||||
|
||||
if (root_delay) {
|
||||
printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
|
||||
root_delay);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user