diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 14b1f17..eb4e3a4 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -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", diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c index 3ab742a..7ea686d 100644 --- a/arch/arm/mach-s3c2416/s3c2416.c +++ b/arch/arm/mach-s3c2416/s3c2416.c @@ -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); diff --git a/drivers/input/keyboard/cyio.c b/drivers/input/keyboard/cyio.c index 783349f..dabe4c3 100644 --- a/drivers/input/keyboard/cyio.c +++ b/drivers/input/keyboard/cyio.c @@ -1,6 +1,6 @@ // =========================================================================== // cyio.c -// Copyright (C) 2008-2009 Bookeen - All rights reserved +// Copyright (C) 2008-2010 Bookeen - All rights reserved // =========================================================================== #include #include @@ -14,7 +14,6 @@ #include #include - #include #include diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 20cdef1..0bfb564 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -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" diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 97db8a7..d2db91d 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -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 ] diff --git a/drivers/input/touchscreen/orizon_ts.c b/drivers/input/touchscreen/orizon_ts.c new file mode 100644 index 0000000..fa71089 --- /dev/null +++ b/drivers/input/touchscreen/orizon_ts.c @@ -0,0 +1,578 @@ +// =========================================================================== +// orizon_ts.c +// Copyright (C) 2003-2010 Bookeen - All rights reserved +// =========================================================================== + +/* TODO: Verify if all this includes are necessary */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#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 "); +MODULE_VERSION ("1.0"); +MODULE_DESCRIPTION ("Cybook Orizon Touchpanel driver"); +// =========================================================================== diff --git a/drivers/input/touchscreen/s3c_ts_iic.c b/drivers/input/touchscreen/s3c_ts_iic.c index 6c17ed9..8bec094 100644 --- a/drivers/input/touchscreen/s3c_ts_iic.c +++ b/drivers/input/touchscreen/s3c_ts_iic.c @@ -48,10 +48,10 @@ /* Aaron, 20090122, add for CPU sleep prevention */ /* prevent cpu from sleep when any event happens */ #ifdef CONFIG_PM_PLATFORM_POWER_SAVING -#define CPU_SLEEP_PREVENT +# define CPU_SLEEP_PREVENT #endif //#ifdef CONFIG_PM_PLATFORM_POWER_SAVING -int Cyio_PushEvent(char eventId, char unique); +int Cyio_PushEvent (char eventId, char unique); #ifdef USE_BUFFERED_TOUCH_DATA static int go_in_suspend = 0; @@ -82,30 +82,33 @@ extern unsigned int g_wakeup_event_occurs; //#endif #define KEY_BUF_SIZE 1 -struct s3c_ts_iic { - struct input_dev *dev; - struct i2c_client *client; - struct platform_device *pdev; - long xp; - long yp; - unsigned int polling_time; + +struct s3c_ts_iic +{ + struct input_dev *dev; + struct i2c_client *client; + struct platform_device *pdev; + long xp; + long yp; + unsigned int polling_time; }; -struct t_point { - short x; - short y; +struct t_point +{ + short x; + short y; }; static struct platform_driver s3c_ts_iic_driver; -static struct work_struct workq_readdata; -static struct s3c_ts_iic *ts_iic; +static struct work_struct workq_readdata; +static struct s3c_ts_iic *ts_iic; static char *s3c_ts_iic_name = "TouchScreen Of IIC Type"; #ifdef QISDA_TEST_GPIO_PROBE static void __iomem *g_pGPIOReg_GPFCON; #endif struct t_point keybuffer[KEY_BUF_SIZE]; -static short IdxBottom =0; -static struct timer_list touch_iic_timer_qisda; +static short IdxBottom = 0; +static struct timer_list touch_iic_timer_qisda; #ifdef POLLING_MODE static int need_calibration = FALSE; @@ -113,7 +116,7 @@ static int need_calibration = FALSE; #ifdef KTHREAD_USE static wait_queue_head_t wait; -static struct task_struct *kmain_task=NULL; +static struct task_struct *kmain_task = NULL; #endif //Tony test @@ -123,16 +126,20 @@ 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<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 is empty, do nothing before return*/ - return; - } - 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])) { - //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) { - /* 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); - //printk("bufferd_touch_point_handler: panel is Pressed(only one buffered data)\n"); - //maybe not necessary//IsPanelPressed = 1; - } - input_report_key(ts_iic->dev, BTN_TOUCH, 0); - input_report_abs(ts_iic->dev, ABS_PRESSURE,0); - IsPanelPressed = 0; - //printk("bufferd_touch_point_handler: panel is Released(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i); - } - input_sync(ts_iic->dev); - - break; - } - //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) { - input_report_key(ts_iic->dev, BTN_TOUCH, 1); - input_report_abs(ts_iic->dev, ABS_PRESSURE,1); - IsPanelPressed = 1; - printk("bufferd_touch_point_handler: panel is Pressed(%d,%d)\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1]); -// } else { -// //for debug -// printk("\n bufferd_touch_point_handler: panel is touching(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i); - } - input_sync(ts_iic->dev); - } +static void bufferd_touch_point_handler (int WithRelease) +{ + /* [0] is the index of check count */ + /* [1] is the check length */ + /* buffered data start from [2],x1_y1_x2_y2_x3_y3 */ + int buffered_data[BUFFERED_DATA_LEN * 2 + (2 + 1)] = { 0 }; + int i, IndexOffset; + + //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++ ) + { + 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 is empty, do nothing before return*/ + return; + } + 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]) ) + { + //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 ) + { + /* 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); + //printk("bufferd_touch_point_handler: panel is Pressed(only one buffered data)\n"); + //maybe not necessary//IsPanelPressed = 1; + } + input_report_key(ts_iic->dev, BTN_TOUCH, 0); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 0); + IsPanelPressed = 0; + //printk("bufferd_touch_point_handler: panel is Released(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i); + } + input_sync(ts_iic->dev); + + break; + } + //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 ) + { + input_report_key(ts_iic->dev, BTN_TOUCH, 1); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 1); + IsPanelPressed = 1; + printk("bufferd_touch_point_handler: panel is Pressed(%d,%d)\n", buffered_data[IndexOffset], buffered_data[IndexOffset + 1]); + // } else { + // //for debug + // printk("\n bufferd_touch_point_handler: panel is touching(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i); + } + input_sync(ts_iic->dev); + } } #endif -static void ts_iic_workqueue(struct work_struct *work) +static void ts_iic_workqueue (struct work_struct *work) { - static int startpoint[2]; - static int emptyKeyBuffer=TRUE; - int curpoint[2]; - short i=0; + static int startpoint[2]; + static int emptyKeyBuffer = TRUE; + int curpoint[2]; + short i = 0; - #ifdef NEW_TCOM_BOARD - static int zeroCount=0; - static int prevpoint[2]; - #endif - +#ifdef NEW_TCOM_BOARD + static int zeroCount = 0; + static int prevpoint[2]; +#endif -//Qisda Tony 090415 [ + + //Qisda Tony 090415 [ #ifdef POLLING_MODE -#ifdef KTHREAD_USE -for(;;){ - //This only get the interrupt periodically. No while loop in workqueue, use polling.... -//Tony test - //Tony test -#ifndef NEW_TCOM_BOARD -#else - ts_iic->client->driver->command(ts_iic->client,QISDA_IIC_READ_POSITION,curpoint); - if((curpoint[0]==0) ||(curpoint[1]==0)) - { - if(emptyKeyBuffer==TRUE) goto finished; - #ifdef NEW_TCOM_BOARD - else - { - if(zeroCount<3) - { - zeroCount++; - goto finished; - } - else - { - //printk("\nooooo %d,%d\n",curpoint[0],curpoint[1]); - goto release; - } - } - #else - else goto release; - #endif - } - //key input - ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0]; - ts_iic->yp =keybuffer[IdxBottom].y = curpoint[1]; - input_report_abs(ts_iic->dev, ABS_X, ts_iic->xp); - input_report_abs(ts_iic->dev, ABS_Y, ts_iic->yp); - input_report_key(ts_iic->dev, BTN_TOUCH, 1); - input_report_abs(ts_iic->dev, ABS_PRESSURE,1); - input_sync(ts_iic->dev); - //printk("\n--%d,%d,%d\n",curpoint[0],curpoint[1],IdxBottom); - #ifdef NEW_TCOM_BOARD - prevpoint[0]=curpoint[0]; - prevpoint[1]=curpoint[1]; - #endif - if(emptyKeyBuffer==TRUE) - { - emptyKeyBuffer=FALSE; - memcpy(startpoint,curpoint,sizeof(startpoint)); - printk("\n--%d,%d,%d\n",startpoint[0],startpoint[1],IdxBottom); - } - IdxBottom++; - if( IdxBottom >= KEY_BUF_SIZE ) - IdxBottom = 0; - goto finished; +# ifdef KTHREAD_USE + for (;; ) + { + //This only get the interrupt periodically. No while loop in workqueue, use polling.... + //Tony test + //Tony test +# ifndef NEW_TCOM_BOARD +# else + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_READ_POSITION, curpoint); + if ( (curpoint[0] == 0) || (curpoint[1] == 0) ) + { + if ( emptyKeyBuffer == TRUE ) goto finished; +# ifdef NEW_TCOM_BOARD + else + { + if ( zeroCount < 3 ) + { + zeroCount++; + goto finished; + } + else + { + //printk("\nooooo %d,%d\n",curpoint[0],curpoint[1]); + goto release; + } + } +# else + else goto release; +# endif + } + //key input + ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0]; + ts_iic->yp = keybuffer[IdxBottom].y = curpoint[1]; + input_report_abs(ts_iic->dev, ABS_X, ts_iic->xp); + input_report_abs(ts_iic->dev, ABS_Y, ts_iic->yp); + input_report_key(ts_iic->dev, BTN_TOUCH, 1); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 1); + input_sync(ts_iic->dev); + //printk("\n--%d,%d,%d\n",curpoint[0],curpoint[1],IdxBottom); +# ifdef NEW_TCOM_BOARD + prevpoint[0] = curpoint[0]; + prevpoint[1] = curpoint[1]; +# endif + if ( emptyKeyBuffer == TRUE ) + { + emptyKeyBuffer = FALSE; + memcpy(startpoint, curpoint, sizeof (startpoint)); + printk("\n--%d,%d,%d\n", startpoint[0], startpoint[1], IdxBottom); + } + IdxBottom++; + if ( IdxBottom >= KEY_BUF_SIZE ) + IdxBottom = 0; + goto finished; release: - printk("++%d,%d,%d\n",startpoint[0],startpoint[1],IdxBottom); - for(i=0;i50)) - printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/ - - // Key input - if (Cyio_PushEvent('R', 1) >= 0) - { - Cyio_PushEvent( (keybuffer[0].x >> 8) & 0xFF, 0 ); - Cyio_PushEvent( (keybuffer[0].x >> 0) & 0xFF, 0 ); + printk("++%d,%d,%d\n", startpoint[0], startpoint[1], IdxBottom); + for ( i = 0; i < KEY_BUF_SIZE; ++i ) + printk("%d,%d\n", keybuffer[i].x, keybuffer[i].y); + i = IdxBottom - 1; + if ( i <= -1 ) + i = KEY_BUF_SIZE - 1; + startpoint[0] -= keybuffer[i].x; + startpoint[1] -= keybuffer[i].y; + //Put your gesture function here!!!! + /*if(( startpoint[1]<-50) || (startpoint[1]>50)) + printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/ - Cyio_PushEvent( (keybuffer[0].y >> 8) & 0xFF, 0 ); - Cyio_PushEvent( (keybuffer[0].y >> 0) & 0xFF, 0 ); - } - memset(keybuffer,0x0,sizeof(keybuffer)); - memset(startpoint,0x0,sizeof(startpoint)); - IdxBottom = 0; - emptyKeyBuffer = TRUE; - //Key input - ts_iic->xp =ts_iic->yp = 0; - input_report_key(ts_iic->dev, BTN_TOUCH, 0); - input_report_abs(ts_iic->dev, ABS_PRESSURE,0); - input_sync(ts_iic->dev); - #ifdef NEW_TCOM_BOARD - prevpoint[0]=0; - prevpoint[1]=0; - zeroCount = 0; - #endif + // Key input + if ( Cyio_PushEvent('R', 1) >= 0 ) + { + Cyio_PushEvent((keybuffer[0].x >> 8) & 0xFF, 0); + Cyio_PushEvent((keybuffer[0].x >> 0) & 0xFF, 0); + + Cyio_PushEvent((keybuffer[0].y >> 8) & 0xFF, 0); + Cyio_PushEvent((keybuffer[0].y >> 0) & 0xFF, 0); + } + memset(keybuffer, 0x0, sizeof (keybuffer)); + memset(startpoint, 0x0, sizeof (startpoint)); + IdxBottom = 0; + emptyKeyBuffer = TRUE; + //Key input + ts_iic->xp = ts_iic->yp = 0; + input_report_key(ts_iic->dev, BTN_TOUCH, 0); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 0); + input_sync(ts_iic->dev); +# ifdef NEW_TCOM_BOARD + prevpoint[0] = 0; + prevpoint[1] = 0; + zeroCount = 0; +# endif finished: - msleep(15); -#endif //#if NEW_TCOM_BOARD -} + msleep(15); +# endif //#if NEW_TCOM_BOARD + } -#else //Not Ktherad_use - //This only get the interrupt periodically. No while loop in workqueue, use polling.... - ts_iic->client->driver->command(ts_iic->client,QISDA_IIC_READ_POSITION,curpoint); +# else //Not Ktherad_use + //This only get the interrupt periodically. No while loop in workqueue, use polling.... + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_READ_POSITION, curpoint); - if((curpoint[0]==0) ||(curpoint[1]==0)) - { - if(emptyKeyBuffer==TRUE) goto finished; + if ( (curpoint[0] == 0) || (curpoint[1] == 0) ) + { + if ( emptyKeyBuffer == TRUE ) goto finished; - #ifdef NEW_TCOM_BOARD - else - { - if(zeroCount<3) - { - zeroCount++; - goto finished; - } - else - { - //printk("\nooooo %d,%d\n", curpoint[0], curpoint[1]); - goto release; - } - } - #else - else goto release; - #endif - - } - //key input - ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0]; - ts_iic->yp =keybuffer[IdxBottom].y = curpoint[1]; - input_report_abs(ts_iic->dev, ABS_X, ts_iic->xp); - input_report_abs(ts_iic->dev, ABS_Y, ts_iic->yp); - input_report_key(ts_iic->dev, BTN_TOUCH, 1); - input_report_abs(ts_iic->dev, ABS_PRESSURE,1); - input_sync(ts_iic->dev); - //printk("\n--%d,%d,%d\n",curpoint[0],curpoint[1],IdxBottom); - if(emptyKeyBuffer==TRUE) - { - emptyKeyBuffer=FALSE; - memcpy(startpoint,curpoint,sizeof(startpoint)); - printk("\n++%d,%d,%d\n",startpoint[0],startpoint[1],IdxBottom); - } - IdxBottom++; - if( IdxBottom >= KEY_BUF_SIZE ) - IdxBottom = 0; - goto finished; +# ifdef NEW_TCOM_BOARD + else + { + if ( zeroCount < 3 ) + { + zeroCount++; + goto finished; + } + else + { + //printk("\nooooo %d,%d\n", curpoint[0], curpoint[1]); + goto release; + } + } +# else + else goto release; +# endif + + } + //key input + ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0]; + ts_iic->yp = keybuffer[IdxBottom].y = curpoint[1]; + input_report_abs(ts_iic->dev, ABS_X, ts_iic->xp); + input_report_abs(ts_iic->dev, ABS_Y, ts_iic->yp); + input_report_key(ts_iic->dev, BTN_TOUCH, 1); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 1); + input_sync(ts_iic->dev); + //printk("\n--%d,%d,%d\n",curpoint[0],curpoint[1],IdxBottom); + if ( emptyKeyBuffer == TRUE ) + { + emptyKeyBuffer = FALSE; + memcpy(startpoint, curpoint, sizeof (startpoint)); + printk("\n++%d,%d,%d\n", startpoint[0], startpoint[1], IdxBottom); + } + IdxBottom++; + if ( IdxBottom >= KEY_BUF_SIZE ) + IdxBottom = 0; + goto finished; release: - printk("--%d,%d,%d\n", curpoint[0], curpoint[1],IdxBottom); - for(i=0;i50)) - printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/ - // Key input - if (Cyio_PushEvent('R', 1) >= 0) - { - Cyio_PushEvent( (keybuffer[0].x >> 8) & 0xFF, 0 ); - Cyio_PushEvent( (keybuffer[0].x >> 0) & 0xFF, 0 ); + printk("--%d,%d,%d\n", curpoint[0], curpoint[1], IdxBottom); + for ( i = 0; i < KEY_BUF_SIZE; ++i ) + printk("%d,%d\n", keybuffer[i].x, keybuffer[i].y); + i = IdxBottom - 1; + if ( i <= -1 ) + i = KEY_BUF_SIZE - 1; + startpoint[0] -= keybuffer[i].x; + startpoint[1] -= keybuffer[i].y; + //Put your gesture function here!!!! + /*if(( startpoint[1]<-50) || (startpoint[1]>50)) + printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/ + // Key input + if ( Cyio_PushEvent('R', 1) >= 0 ) + { + Cyio_PushEvent((keybuffer[0].x >> 8) & 0xFF, 0); + Cyio_PushEvent((keybuffer[0].x >> 0) & 0xFF, 0); - Cyio_PushEvent( (keybuffer[0].y >> 8) & 0xFF, 0 ); - Cyio_PushEvent( (keybuffer[0].y >> 0) & 0xFF, 0 ); - } + Cyio_PushEvent((keybuffer[0].y >> 8) & 0xFF, 0); + Cyio_PushEvent((keybuffer[0].y >> 0) & 0xFF, 0); + } - - memset(keybuffer,0x0,sizeof(keybuffer)); - memset(startpoint,0x0,sizeof(startpoint)); - IdxBottom = 0; - emptyKeyBuffer = TRUE; - //Key input - ts_iic->xp =ts_iic->yp = 0; - input_report_key(ts_iic->dev, BTN_TOUCH, 0); - input_report_abs(ts_iic->dev, ABS_PRESSURE,0); - input_sync(ts_iic->dev); - #ifdef NEW_TCOM_BOARD - prevpoint[0]=0; - prevpoint[1]=0; - zeroCount = 0; - #endif + + memset(keybuffer, 0x0, sizeof (keybuffer)); + memset(startpoint, 0x0, sizeof (startpoint)); + IdxBottom = 0; + emptyKeyBuffer = TRUE; + //Key input + ts_iic->xp = ts_iic->yp = 0; + input_report_key(ts_iic->dev, BTN_TOUCH, 0); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 0); + input_sync(ts_iic->dev); +# ifdef NEW_TCOM_BOARD + prevpoint[0] = 0; + prevpoint[1] = 0; + zeroCount = 0; +# endif finished: - if(need_calibration){ - printk("TOUCH_IIC_CALIBRATION..."); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_CALIBRATION, NULL); - need_calibration = FALSE; - printk("done\n"); - } + if ( need_calibration ) + { + printk("TOUCH_IIC_CALIBRATION..."); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_CALIBRATION, NULL); + need_calibration = FALSE; + printk("done\n"); + } - touch_iic_timer_qisda.expires = jiffies + (HZ/ts_iic->polling_time); - mod_timer(&touch_iic_timer_qisda,touch_iic_timer_qisda.expires); - return; -#endif //KTHREAD_USE + touch_iic_timer_qisda.expires = jiffies + (HZ / ts_iic->polling_time); + mod_timer(&touch_iic_timer_qisda, touch_iic_timer_qisda.expires); + return; +# endif //KTHREAD_USE #else // NOT POLLING_MODE - //This only get the interrupt - ts_iic->client->driver->command(ts_iic->client,QISDA_IIC_READ_POSITION,curpoint); + //This only get the interrupt + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_READ_POSITION, curpoint); - if((curpoint[0]==0) ||(curpoint[1]==0)) - { - //printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer); - if(emptyKeyBuffer==TRUE){ - emptyKeyBuffer = FALSE; -#ifdef USE_BUFFERED_TOUCH_DATA - bufferd_touch_point_handler(1); /* with release */ - go_in_suspend = 0; -#endif - goto finished; - } - else{ - //printk("goto release \n"); - goto release; - } - } -#ifdef USE_BUFFERED_TOUCH_DATA - if (go_in_suspend) { - bufferd_touch_point_handler(0); /* without release */ - go_in_suspend = 0; - } -#endif - //key input - ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0]; - ts_iic->yp =keybuffer[IdxBottom].y = curpoint[1]; - 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) { - input_report_key(ts_iic->dev, BTN_TOUCH, 1); - input_report_abs(ts_iic->dev, ABS_PRESSURE,1); - IsPanelPressed = 1; - } -#else - input_report_key(ts_iic->dev, BTN_TOUCH, 1); - input_report_abs(ts_iic->dev, ABS_PRESSURE,1); -#endif - input_sync(ts_iic->dev); - #ifdef CONFIG_QISDA_BK060B00 - s3c2410_gpio_cfgpin(S3C2410_GPH12, S3C2410_GPH12_OUTP); - s3c2410_gpio_setpin(S3C2410_GPH12, 1); - #endif - - //printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer); - if((startpoint[0]==0) || (startpoint[1]==0)) - { - emptyKeyBuffer=FALSE; - memcpy(startpoint,curpoint,sizeof(startpoint)); - printk("\n++%d,%d,%d\n",startpoint[0],startpoint[1],IdxBottom); - } - IdxBottom++; - if( IdxBottom >= KEY_BUF_SIZE ) - IdxBottom = 0; - goto finished; + if ( (curpoint[0] == 0) || (curpoint[1] == 0) ) + { + //printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer); + if ( emptyKeyBuffer == TRUE ) + { + emptyKeyBuffer = FALSE; +# ifdef USE_BUFFERED_TOUCH_DATA + bufferd_touch_point_handler(1); /* with release */ + go_in_suspend = 0; +# endif + goto finished; + } + else + { + //printk("goto release \n"); + goto release; + } + } +# ifdef USE_BUFFERED_TOUCH_DATA + if ( go_in_suspend ) + { + bufferd_touch_point_handler(0); /* without release */ + go_in_suspend = 0; + } +# endif + //key input + ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0]; + ts_iic->yp = keybuffer[IdxBottom].y = curpoint[1]; + 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 ) + { + input_report_key(ts_iic->dev, BTN_TOUCH, 1); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 1); + IsPanelPressed = 1; + } +# else + input_report_key(ts_iic->dev, BTN_TOUCH, 1); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 1); +# endif + input_sync(ts_iic->dev); +# ifdef CONFIG_QISDA_BK060B00 + s3c2410_gpio_cfgpin(S3C2410_GPH12, S3C2410_GPH12_OUTP); + s3c2410_gpio_setpin(S3C2410_GPH12, 1); +# endif + + //printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer); + if ( (startpoint[0] == 0) || (startpoint[1] == 0) ) + { + emptyKeyBuffer = FALSE; + memcpy(startpoint, curpoint, sizeof (startpoint)); + printk("\n++%d,%d,%d\n", startpoint[0], startpoint[1], IdxBottom); + } + IdxBottom++; + if ( IdxBottom >= KEY_BUF_SIZE ) + IdxBottom = 0; + goto finished; release: - printk("--%d,%d,%d\n", curpoint[0], curpoint[1],IdxBottom); - for(i=0;i50)) - printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/ - // Key input - if (Cyio_PushEvent('R', 1) >= 0) - { - Cyio_PushEvent( (keybuffer[0].x >> 8) & 0xFF, 0 ); - Cyio_PushEvent( (keybuffer[0].x >> 0) & 0xFF, 0 ); + printk("--%d,%d,%d\n", curpoint[0], curpoint[1], IdxBottom); + for ( i = 0; i < KEY_BUF_SIZE; ++i ) + printk("%d,%d\n", keybuffer[i].x, keybuffer[i].y); + i = IdxBottom - 1; + if ( i <= -1 ) + i = KEY_BUF_SIZE - 1; + startpoint[0] -= keybuffer[i].x; + startpoint[1] -= keybuffer[i].y; + //Put your gesture function here!!!! + /*if(( startpoint[1]<-50) || (startpoint[1]>50)) + printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/ + // Key input + if ( Cyio_PushEvent('R', 1) >= 0 ) + { + Cyio_PushEvent((keybuffer[0].x >> 8) & 0xFF, 0); + Cyio_PushEvent((keybuffer[0].x >> 0) & 0xFF, 0); - Cyio_PushEvent( (keybuffer[0].y >> 8) & 0xFF, 0 ); - Cyio_PushEvent( (keybuffer[0].y >> 0) & 0xFF, 0 ); - } + Cyio_PushEvent((keybuffer[0].y >> 8) & 0xFF, 0); + Cyio_PushEvent((keybuffer[0].y >> 0) & 0xFF, 0); + } - memset(keybuffer,0x0,sizeof(keybuffer)); - memset(startpoint,0x0,sizeof(startpoint)); - IdxBottom = 0; - emptyKeyBuffer = TRUE; - //Key input - ts_iic->xp =ts_iic->yp = 0; -#ifdef USE_BUFFERED_TOUCH_DATA - IsPanelPressed = 0; -#endif - input_report_key(ts_iic->dev, BTN_TOUCH, 0); - input_report_abs(ts_iic->dev, ABS_PRESSURE,0); - input_sync(ts_iic->dev); - #ifdef CONFIG_QISDA_BK060B00 - s3c2410_gpio_cfgpin(S3C2410_GPH12, S3C2410_GPH12_OUTP); - s3c2410_gpio_setpin(S3C2410_GPH12, 0); - #endif - - #ifdef NEW_TCOM_BOARD - prevpoint[0]=0; - prevpoint[1]=0; - zeroCount = 0; - #endif - del_timer(&touch_iic_timer_qisda); - enable_irq(IRQ_EINT2); - //touch_iic_clear_interrupt_pending(); - //touch_iic_enable_interrupt(); - return; + memset(keybuffer, 0x0, sizeof (keybuffer)); + memset(startpoint, 0x0, sizeof (startpoint)); + IdxBottom = 0; + emptyKeyBuffer = TRUE; + //Key input + ts_iic->xp = ts_iic->yp = 0; +# ifdef USE_BUFFERED_TOUCH_DATA + IsPanelPressed = 0; +# endif + input_report_key(ts_iic->dev, BTN_TOUCH, 0); + input_report_abs(ts_iic->dev, ABS_PRESSURE, 0); + input_sync(ts_iic->dev); +# ifdef CONFIG_QISDA_BK060B00 + s3c2410_gpio_cfgpin(S3C2410_GPH12, S3C2410_GPH12_OUTP); + s3c2410_gpio_setpin(S3C2410_GPH12, 0); +# endif + +# ifdef NEW_TCOM_BOARD + prevpoint[0] = 0; + prevpoint[1] = 0; + zeroCount = 0; +# endif + del_timer(&touch_iic_timer_qisda); + enable_irq(IRQ_EINT2); + //touch_iic_clear_interrupt_pending(); + //touch_iic_enable_interrupt(); + return; finished: - //msleep(15); - touch_iic_timer_qisda.expires = jiffies + (HZ/ts_iic->polling_time); - mod_timer(&touch_iic_timer_qisda,touch_iic_timer_qisda.expires); - return; + //msleep(15); + touch_iic_timer_qisda.expires = jiffies + (HZ / ts_iic->polling_time); + mod_timer(&touch_iic_timer_qisda, touch_iic_timer_qisda.expires); + return; #endif -//Qisda Tony 090415 ] + //Qisda Tony 090415 ] } //static void ts_iic_port_deinit(void) @@ -601,31 +622,32 @@ finished: //Qisda Tony 090415 [ #ifndef POLLING_MODE - static irqreturn_t touch_iic_isr(int irq, void *dev_id) - { - //static int count=0; - printk(KERN_ERR "\ntouch_iic_isr\n"); - disable_irq(IRQ_EINT2); -#ifdef CPU_SLEEP_PREVENT - g_wakeup_event_occurs = 1; - //printk("touch_iic_isr: set g_wakeup_event_occurs\n"); -#endif - //touch_iic_disable_interrupt(); - //touch_iic_clear_interrupt_pending(); - touch_iic_timer_qisda.expires = jiffies + (HZ/ts_iic->polling_time); - add_timer(&touch_iic_timer_qisda); - //It wait for kernel timer launch. - //schedule_work(&workq_readdata); - //Enable interrupt funciton will postphone at workqueue stage - //touch_iic_enable_interrupt(); - return IRQ_HANDLED; - } + +static irqreturn_t touch_iic_isr (int irq, void *dev_id) +{ + //static int count=0; + printk(KERN_ERR "\ntouch_iic_isr\n"); + disable_irq(IRQ_EINT2); +# ifdef CPU_SLEEP_PREVENT + g_wakeup_event_occurs = 1; + //printk("touch_iic_isr: set g_wakeup_event_occurs\n"); +# endif + //touch_iic_disable_interrupt(); + //touch_iic_clear_interrupt_pending(); + touch_iic_timer_qisda.expires = jiffies + (HZ / ts_iic->polling_time); + add_timer(&touch_iic_timer_qisda); + //It wait for kernel timer launch. + //schedule_work(&workq_readdata); + //Enable interrupt funciton will postphone at workqueue stage + //touch_iic_enable_interrupt(); + return IRQ_HANDLED; +} #endif //Qisda Tony 090415 ] -static int s3c_ts_iic_open(struct inode *inode, struct file *file) +static int s3c_ts_iic_open (struct inode *inode, struct file *file) { - return 0; + return 0; } /* Qisda, howard hsu, 2010/01/27, touch firmware update { */ #define NORMAL_SLAVE_ADDR 0x5C @@ -637,362 +659,368 @@ static int s3c_ts_iic_open(struct inode *inode, struct file *file) #define OPCODE_EEPROM 3 #define OPCODE_QUERY 8 -typedef struct BLModeInfo { - char Status; - char FlashLock; - char Version; - char Key; -} __attribute__((packed)) BLModeInfo; - -int normalmode_read_eeprom(unsigned int eepr_addr, unsigned char *buff) +typedef struct BLModeInfo { - unsigned char tmp[4]; - struct i2c_msg msg; - unsigned long nmsgs; - int ret=0; - tmp[0]=120; - tmp[1]=0x01;//read - tmp[2]=(eepr_addr&0xFF); - tmp[3]=eepr_addr>>8; + char Status; + char FlashLock; + char Version; + char Key; +} __attribute__ ((packed)) BLModeInfo; - nmsgs=1; +int normalmode_read_eeprom (unsigned int eepr_addr, unsigned char *buff) +{ + unsigned char tmp[4]; + struct i2c_msg msg; + unsigned long nmsgs; + int ret = 0; + tmp[0] = 120; + tmp[1] = 0x01; //read + tmp[2] = (eepr_addr & 0xFF); + tmp[3] = eepr_addr >> 8; - msg.len=4; //mem address - msg.addr=NORMAL_SLAVE_ADDR; - msg.flags=0; - msg.buf=tmp; + nmsgs = 1; - ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + msg.len = 4; //mem address + msg.addr = NORMAL_SLAVE_ADDR; + msg.flags = 0; + msg.buf = tmp; - nmsgs=1; - msg.len=1; //mem address - msg.addr=NORMAL_SLAVE_ADDR; - msg.flags=I2C_M_RD; - msg.buf=buff; + ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); - ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + nmsgs = 1; + msg.len = 1; //mem address + msg.addr = NORMAL_SLAVE_ADDR; + msg.flags = I2C_M_RD; + msg.buf = buff; - if(ret<0) - printk("normalmode_read_eeprom error code:%d\n",ret); + ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); - return ret; + if ( ret < 0 ) + printk("normalmode_read_eeprom error code:%d\n", ret); + + return ret; } - - -int normalmode_read_op(unsigned int mem_addr,unsigned char *buff) +int normalmode_read_op (unsigned int mem_addr, unsigned char *buff) { - unsigned char tmp[2]; - struct i2c_msg msg[2]; - unsigned long nmsgs; - int ret=0; - tmp[0]=mem_addr; - //tmp[0]=mem_addr; - //tmp[1]=val; + unsigned char tmp[2]; + struct i2c_msg msg[2]; + unsigned long nmsgs; + int ret = 0; + tmp[0] = mem_addr; + //tmp[0]=mem_addr; + //tmp[1]=val; - nmsgs=2; + nmsgs = 2; - msg[0].len=1; //mem address - msg[0].addr=NORMAL_SLAVE_ADDR; - msg[0].flags=0; - msg[0].buf=tmp; + msg[0].len = 1; //mem address + msg[0].addr = NORMAL_SLAVE_ADDR; + msg[0].flags = 0; + msg[0].buf = tmp; - msg[1].len=1; - msg[1].addr=NORMAL_SLAVE_ADDR; - msg[1].flags=I2C_M_RD; - msg[1].buf=buff; - ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + msg[1].len = 1; + msg[1].addr = NORMAL_SLAVE_ADDR; + msg[1].flags = I2C_M_RD; + msg[1].buf = buff; + ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); - if(ret<0) - printk("[normalmode_read_op] error:%d\n",ret); - else - printk("[normalmode_read_op] ok addr:%d value:%d\n",mem_addr,buff[0]); - return ret; + if ( ret < 0 ) + printk("[normalmode_read_op] error:%d\n", ret); + else + printk("[normalmode_read_op] ok addr:%d value:%d\n", mem_addr, buff[0]); + return ret; } -int normalmode_write_op(unsigned char mem_addr,unsigned char val) +int normalmode_write_op (unsigned char mem_addr, unsigned char val) { - unsigned char tmp[2]; - struct i2c_msg msg; - unsigned long nmsgs; - int ret=0; - tmp[0]=mem_addr; - tmp[1]=val; + unsigned char tmp[2]; + struct i2c_msg msg; + unsigned long nmsgs; + int ret = 0; + tmp[0] = mem_addr; + tmp[1] = val; - nmsgs=1; + nmsgs = 1; - msg.len=2; //mem address - msg.addr=NORMAL_SLAVE_ADDR; - msg.flags=0; - msg.buf=tmp; + msg.len = 2; //mem address + msg.addr = NORMAL_SLAVE_ADDR; + msg.flags = 0; + msg.buf = tmp; - ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); - if(ret<0) - printk("[normalmode_write_op] error:%d\n",ret); - else - printk("[normalmode_write_op] ok addr:%d value:%d\n",mem_addr,val); - return ret; + if ( ret < 0 ) + printk("[normalmode_write_op] error:%d\n", ret); + else + printk("[normalmode_write_op] ok addr:%d value:%d\n", mem_addr, val); + return ret; } -int blmode_read_op(int opcode) +int blmode_read_op (int opcode) { - struct i2c_msg msg; - unsigned long nmsgs; - int ret=0; - BLModeInfo *bl_info = vmalloc(sizeof(BLModeInfo)); - nmsgs = 1; - msg.addr = BOOTLOADER_SLAVE_ADDR; - msg.flags= I2C_M_RD; //0 for write - msg.len = 4; - msg.buf = bl_info; + struct i2c_msg msg; + unsigned long nmsgs; + int ret = 0; + BLModeInfo *bl_info = vmalloc(sizeof (BLModeInfo)); + nmsgs = 1; + msg.addr = BOOTLOADER_SLAVE_ADDR; + msg.flags = I2C_M_RD; //0 for write + msg.len = 4; + msg.buf = bl_info; - ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); - - if(ret<0) - { - printk("[blmode_read_op] error:%d\n",ret); - } - 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) { - ret = -8; - } - else { - if (opcode==OPCODE_AES) - { - if(bl_info->FlashLock==0x00) - printk("=Flash is locked\n"); - else if (bl_info->FlashLock==0x05) - printk("=Flash verified failed\n"); - else if (bl_info->FlashLock==0xFF) - printk("=Flash is erased\n"); - else if (bl_info->FlashLock==0xA5) - printk("=Flash is unlocked\n"); - else - printk("=Flash status Unknown(%x)\n",bl_info->FlashLock); - } - } - } - return ret; + ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + + if ( ret < 0 ) + { + printk("[blmode_read_op] error:%d\n", ret); + } + 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 ) + { + ret = -8; + } + else + { + if ( opcode == OPCODE_AES ) + { + if ( bl_info->FlashLock == 0x00 ) + printk("=Flash is locked\n"); + else if ( bl_info->FlashLock == 0x05 ) + printk("=Flash verified failed\n"); + else if ( bl_info->FlashLock == 0xFF ) + printk("=Flash is erased\n"); + else if ( bl_info->FlashLock == 0xA5 ) + printk("=Flash is unlocked\n"); + else + printk("=Flash status Unknown(%x)\n", bl_info->FlashLock); + } + } + } + return ret; } -int blmode_write_op(char *data_ptr) +int blmode_write_op (char *data_ptr) { - struct i2c_msg msg; - unsigned long nmsgs; - int ret=0; + struct i2c_msg msg; + unsigned long nmsgs; + int ret = 0; - nmsgs = 1; - msg.addr = BOOTLOADER_SLAVE_ADDR; - msg.flags= 0; - msg.len = 143; - msg.buf = data_ptr; - - ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + nmsgs = 1; + msg.addr = BOOTLOADER_SLAVE_ADDR; + msg.flags = 0; + msg.len = 143; + msg.buf = data_ptr; - if(ret<0) - { - printk("blmode_write_op error:%d\n",ret); - } - else - { - ret = data_ptr[0]; - printk("opcode[%d] OK\n",data_ptr[0]); - } - return ret; + ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs); + + if ( ret < 0 ) + { + printk("blmode_write_op error:%d\n", ret); + } + else + { + ret = data_ptr[0]; + printk("opcode[%d] OK\n", data_ptr[0]); + } + return ret; } -int blmode_wait_ready() +int blmode_wait_ready () { - unsigned int pin_state; - int count = 0; - int ret =0; - do { - pin_state = (__raw_readl(S3C2410_GPFDAT)&(1<<2)); - count++; - msleep(20); - } while((pin_state!=0)&&(count<100)); //wait for 2 seconds - //printk("[blmode_wait_ready]count=%d pin=%d\n",count,pin_state); - ret = (pin_state==0)? 0:1; - return ret; + unsigned int pin_state; + int count = 0; + int ret = 0; + do + { + pin_state = (__raw_readl(S3C2410_GPFDAT)&(1 << 2)); + count++; + msleep(20); + } while ( (pin_state != 0) && (count < 100) ); //wait for 2 seconds + //printk("[blmode_wait_ready]count=%d pin=%d\n",count,pin_state); + ret = (pin_state == 0) ? 0 : 1; + return ret; } -int get_touch_firmware_info(char *buff) +int get_touch_firmware_info (char *buff) { - /* read version */ - normalmode_read_op(119,buff); + /* read version */ + normalmode_read_op(119, buff); } + int enter_blmode (int method) { - disable_irq(IRQ_EINT2); - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - s3c2410_gpio_pullup(S3C2410_GPF2, 0); - if( method==0 ) - { - printk("TP:HW_blmode entry\n"); - //turn-off - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 0); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 0); - #endif - msleep(2000); - - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 1); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 1); - #endif - //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - //s3c2410_gpio_pullup(S3C2410_GPF2, 0); - blmode_read_op(OPCODE_QUERY); - blmode_wait_ready(); - blmode_read_op(OPCODE_QUERY); - } - else - { - printk("TP:SW_blmode entry\n"); - msleep(100); - normalmode_write_op(120,5); - blmode_read_op(OPCODE_QUERY); - blmode_wait_ready(); - blmode_read_op(OPCODE_QUERY); - } -} -int reset_touch() -{ + disable_irq(IRQ_EINT2); + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + s3c2410_gpio_pullup(S3C2410_GPF2, 0); + if ( method == 0 ) + { + printk("TP:HW_blmode entry\n"); + //turn-off #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 0); -#else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 0); + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 0); +#else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 0); #endif - //s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); //?smart card - //s3c2410_gpio_setpin(S3C2410_GPC3, 0); - msleep(2000); - //on - //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - //s3c2410_gpio_pullup(S3C2410_GPF2, 2); + msleep(2000); #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 1); -#else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 1); + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 1); +#else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); #endif - msleep(400); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL); - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); - enable_irq(IRQ_EINT2); - msleep(100); - + //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + //s3c2410_gpio_pullup(S3C2410_GPF2, 0); + blmode_read_op(OPCODE_QUERY); + blmode_wait_ready(); + blmode_read_op(OPCODE_QUERY); + } + else + { + printk("TP:SW_blmode entry\n"); + msleep(100); + normalmode_write_op(120, 5); + blmode_read_op(OPCODE_QUERY); + blmode_wait_ready(); + blmode_read_op(OPCODE_QUERY); + } } -int update_touch_firmware(unsigned long size, char* frame_data) +int reset_touch () { - unsigned int pin_state; - int count, count_max; - int opcode, result; - int i; +#ifdef CONFIG_QISDA_BK060B00 - unsigned long offset = 0; + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 0); +#else - /* - disable_irq(IRQ_EINT2); - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - s3c2410_gpio_pullup(S3C2410_GPF2, 0); - msleep(100); + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 0); +#endif + //s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); //?smart card + //s3c2410_gpio_setpin(S3C2410_GPC3, 0); + msleep(2000); + //on + //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + //s3c2410_gpio_pullup(S3C2410_GPF2, 2); - normalmode_write_op(120,5); - blmode_wait_ready(); - blmode_read_op(OPCODE_QUERY); - */ - enter_blmode(0); - char *cmd_buff = vmalloc(143, GFP_KERNEL); - char *data_ptr = frame_data; - unsigned long limit = frame_data + size; - char *p_head; - char *p_tail; +#ifdef CONFIG_QISDA_BK060B00 - count = 0; - do { - p_head = strchr(data_ptr,'$'); - if ( (p_head != NULL)&& (p_tail (limit-280) ) - { - printk("end of file,stop\n"); - printk("curr:%lu limit:%lu\n",data_ptr,limit); - p_head=0; - } - } - else - { - p_head=0; - } - } - printk("==p_head=%lu\n",p_head); - } while(p_head!=0); - vfree(cmd_buff); - /* printk("restore EINT\n"); - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); - enable_irq(IRQ_EINT2); - msleep(100); */ - reset_touch(); - return 0; + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); +#endif + msleep(400); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); + enable_irq(IRQ_EINT2); + msleep(100); + +} + +int update_touch_firmware (unsigned long size, char* frame_data) +{ + unsigned int pin_state; + int count, count_max; + int opcode, result; + int i; + + unsigned long offset = 0; + + /* + disable_irq(IRQ_EINT2); + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + s3c2410_gpio_pullup(S3C2410_GPF2, 0); + msleep(100); + + normalmode_write_op(120,5); + blmode_wait_ready(); + blmode_read_op(OPCODE_QUERY); + */ + enter_blmode(0); + char *cmd_buff = vmalloc(143, GFP_KERNEL); + char *data_ptr = frame_data; + unsigned long limit = frame_data + size; + char *p_head; + char *p_tail; + + count = 0; + do + { + p_head = strchr(data_ptr, '$'); + if ( (p_head != NULL) && (p_tail < limit) ) + { + p_tail = strchr(p_head + 1, 0xd); + if ( (p_tail != NULL) && (p_tail < limit) ) + { + printk("p_head=%lu p_tail=%lu \n", p_head, p_tail); + unsigned long length = p_tail - p_head; + p_head++; + if ( length != 287 ) + goto FAIL; + char tmpToken[3]; + memset(tmpToken, 0, sizeof (tmpToken)); + for ( i = 0; i < 143; i++ ) + { + strncpy(tmpToken, p_head + i * 2, 2); + sprintf(cmd_buff + i, "%c", simple_strtol(tmpToken, NULL, 16)); + } + count++; + printk("OpCode[%2x] CRC[%2x][%2x]\n", cmd_buff[0], cmd_buff[141], cmd_buff[142]); + + opcode = blmode_write_op(cmd_buff); + printk("[blmode_write_op][%d]=%d\n", count, opcode); + if ( opcode < 0 ) + { + goto FAIL; + } + if ( opcode != OPCODE_USER ) + { + if ( blmode_wait_ready() != 0 ) + goto FAIL_BUSY; + result = blmode_read_op(opcode); + printk("[blmode_read_op]=%d\n", result); + if ( result < 0 ) + goto FAIL; + } + data_ptr = p_tail + 1; + if ( data_ptr > (limit - 280) ) + { + printk("end of file,stop\n"); + printk("curr:%lu limit:%lu\n", data_ptr, limit); + p_head = 0; + } + } + else + { + p_head = 0; + } + } + printk("==p_head=%lu\n", p_head); + } while ( p_head != 0 ); + vfree(cmd_buff); + /* printk("restore EINT\n"); + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); + enable_irq(IRQ_EINT2); + msleep(100); */ + reset_touch(); + return 0; FAIL_BUSY: - printk("[FAIL]Dev is Busy\n"); + printk("[FAIL]Dev is Busy\n"); FAIL: - return -1; + return -1; } /* } Qisda, howard hsu, 2010/01/27, touch firmware update */ @@ -1000,559 +1028,576 @@ 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) +static int s3c_ts_iic_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - switch(cmd){ - case TOUCH_IIC_CALIBRATION: - #ifdef POLLING_MODE - need_calibration = TRUE; - #else - printk("TOUCH_IIC_CALIBRATION..."); - disable_irq(IRQ_EINT2); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_CALIBRATION, NULL); - printk("done\n"); - enable_irq(IRQ_EINT2); - #endif - break; + switch ( cmd ) + { + case TOUCH_IIC_CALIBRATION: +#ifdef POLLING_MODE + need_calibration = TRUE; +#else + printk("TOUCH_IIC_CALIBRATION..."); + disable_irq(IRQ_EINT2); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_CALIBRATION, NULL); + printk("done\n"); + enable_irq(IRQ_EINT2); +#endif + break; - case TOUCH_IIC_SET_POLLING_TIME: - if((arg<1) || (arg>80)){ - printk("polling time should be 1-80\n"); - } - else{ - ts_iic->polling_time = arg; - touchPollingTime = arg; - } - break; - /*kit.mod 2009/11/04*/ - case TOUCH_DEVICE_POWER_STATE: - switch(arg) - { - case TOUCH_DEVICE_ACTIVE_STATE: - if(isTouchPowerOff) - { - isTouchPowerOff = 0; - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 1); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 1); - #endif - msleep(200); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); + case TOUCH_IIC_SET_POLLING_TIME: + if ( (arg < 1) || (arg > 80) ) + { + printk("polling time should be 1-80\n"); + } + else + { + ts_iic->polling_time = arg; + touchPollingTime = arg; + } + break; + /*kit.mod 2009/11/04*/ + case TOUCH_DEVICE_POWER_STATE: + switch ( arg ) + { + case TOUCH_DEVICE_ACTIVE_STATE: + if ( isTouchPowerOff ) + { + isTouchPowerOff = 0; +#ifdef CONFIG_QISDA_BK060B00 - /*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/ - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); - /*kit.end*/ + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 1); +#else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); +#endif + msleep(200); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); - enable_irq(IRQ_EINT2); - } - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_ACTIVE_MODE, NULL); + /*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/ + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); + /*kit.end*/ - /*kit.add 2009/11/16*/ - ts_iic->polling_time = touchPollingTime; - touchPowerState = TOUCH_DEVICE_ACTIVE_STATE; - /*kit.end*/ + enable_irq(IRQ_EINT2); + } + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_ACTIVE_MODE, NULL); - printk("Touch Device => Active State\n"); - break; + /*kit.add 2009/11/16*/ + ts_iic->polling_time = touchPollingTime; + touchPowerState = TOUCH_DEVICE_ACTIVE_STATE; + /*kit.end*/ - case TOUCH_DEVICE_SLEEP_STATE: - if(isTouchPowerOff) - { - isTouchPowerOff = 0; - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 1); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 1); - #endif - msleep(200); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL); + printk("Touch Device => Active State\n"); + break; - /*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/ - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); - /*kit.end*/ + case TOUCH_DEVICE_SLEEP_STATE: + if ( isTouchPowerOff ) + { + isTouchPowerOff = 0; +#ifdef CONFIG_QISDA_BK060B00 - enable_irq(IRQ_EINT2); - } - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_SLEEP_MODE, NULL); + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 1); +#else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); +#endif + msleep(200); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); - /*kit.add 2009/11/16*/ - ts_iic->polling_time = TOUCH_SLEEP_POLLING_TIME; - touchPowerState = TOUCH_DEVICE_SLEEP_STATE; - /*kit.end*/ + /*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/ + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); + /*kit.end*/ - printk("Touch Device => Sleep State\n"); - break; + enable_irq(IRQ_EINT2); + } + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_SLEEP_MODE, NULL); - case TOUCH_DEVICE_DEEPSLEEP_STATE: - if(isTouchPowerOff) - { - isTouchPowerOff = 0; - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 1); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 1); - #endif - msleep(200); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL); + /*kit.add 2009/11/16*/ + ts_iic->polling_time = TOUCH_SLEEP_POLLING_TIME; + touchPowerState = TOUCH_DEVICE_SLEEP_STATE; + /*kit.end*/ - /*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/ - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); - /*kit.end*/ + printk("Touch Device => Sleep State\n"); + break; - enable_irq(IRQ_EINT2); - } - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_DEEPSLEEP_MODE, NULL); + case TOUCH_DEVICE_DEEPSLEEP_STATE: + if ( isTouchPowerOff ) + { + isTouchPowerOff = 0; +#ifdef CONFIG_QISDA_BK060B00 - /*kit.add 2009/11/16*/ - ts_iic->polling_time = TOUCH_DEEPSLEEP_POLLING_TIME; - touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE; - /*kit.end*/ + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 1); +#else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); +#endif + msleep(200); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); - printk("Touch Device => Deep Sleep State\n"); - break; + /*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/ + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); + /*kit.end*/ - case TOUCH_DEVICE_POWEROFF_STATE: - if(isTouchPowerOff) - printk("Touch Device => Already Power Off State\n"); - else - { - isTouchPowerOff = 1; - disable_irq(IRQ_EINT2); + enable_irq(IRQ_EINT2); + } + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_DEEPSLEEP_MODE, NULL); - /*kit.add 2010/01/20, turn off TP_INT(GPF2) power*/ - /*test1: TP_INT(GPF2) => Input, Disable*/ - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - s3c2410_gpio_pullup(S3C2410_GPF2, 0); - /*test2: TP_INT(GPF2) => Input, Pull Low*/ - //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - //s3c2410_gpio_setpin(S3C2410_GPF2, 1); - /*kit.end*/ + /*kit.add 2009/11/16*/ + ts_iic->polling_time = TOUCH_DEEPSLEEP_POLLING_TIME; + touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE; + /*kit.end*/ - /*Turn off touch power(TOUCH_EN)*/ - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 0); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 0); - #endif + printk("Touch Device => Deep Sleep State\n"); + break; - printk("Touch Device => Power Off State\n"); - } + case TOUCH_DEVICE_POWEROFF_STATE: + if ( isTouchPowerOff ) + printk("Touch Device => Already Power Off State\n"); + else + { + isTouchPowerOff = 1; + disable_irq(IRQ_EINT2); - /*kit.add 2009/11/16*/ - touchPowerState = TOUCH_DEVICE_POWEROFF_STATE; - /*kit.end*/ - break; + /*kit.add 2010/01/20, turn off TP_INT(GPF2) power*/ + /*test1: TP_INT(GPF2) => Input, Disable*/ + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + s3c2410_gpio_pullup(S3C2410_GPF2, 0); + /*test2: TP_INT(GPF2) => Input, Pull Low*/ + //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + //s3c2410_gpio_setpin(S3C2410_GPF2, 1); + /*kit.end*/ - default: - printk("Touch Device => No Such Power State...\n"); - } - break; - /*kit.end*/ -/* Qisda, howard hsu, 2010/01/27, TOUCH firmware update { */ - case TOUCH_IIC_FW_UPDATE: - { - printk("Call TOUCH_IIC_FW_UPDATE\n"); - unsigned long fw_size = 0; - int result = 0; - if(copy_from_user(&fw_size, (unsigned long*) arg, sizeof(unsigned long))) - return -EFAULT; - unsigned char *fw_data = vmalloc(fw_size, GFP_KERNEL); - if(copy_from_user(fw_data, (char*) ((char *)arg+sizeof(unsigned long)), fw_size)) - return -EFAULT; + /*Turn off touch power(TOUCH_EN)*/ +#ifdef CONFIG_QISDA_BK060B00 - printk("FW_Size=%d\n",fw_size); - result = update_touch_firmware(fw_size,fw_data); - printk("TOUCH_IIC_FW_UPDATE Complete(result=%d)!!!\n",result); - vfree(fw_data); - return result; - } - break; - case TOUCH_IIC_GET_FW_INFO: - { - char info = 0; - get_touch_firmware_info(&info); - if(copy_to_user((void *)arg, (const void *) &info, sizeof(char))) - return -EFAULT; - } - break; -/* } Qisda, howard hsu, 2010/01/27, TOUCH firmware update */ + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 0); +#else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 0); +#endif - /*kit.add 2010/01/30*/ - case TOUCH_IIC_T_SENSOR_ENABLE: - { - switch(arg) - { - case 0: - s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); - s3c2410_gpio_setpin(S3C2410_GPC3, 0); - printk("T-Sensor power off\n"); - break; + printk("Touch Device => Power Off State\n"); + } - case 1: - s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); - s3c2410_gpio_setpin(S3C2410_GPC3, 1); - printk("T-Sensor power on\n"); - break; + /*kit.add 2009/11/16*/ + touchPowerState = TOUCH_DEVICE_POWEROFF_STATE; + /*kit.end*/ + break; - default: - printk("T-Sensor no such command\n"); - break; - } - } - break; - /*kit.end*/ + default: + printk("Touch Device => No Such Power State...\n"); + } + break; + /*kit.end*/ + /* Qisda, howard hsu, 2010/01/27, TOUCH firmware update { */ + case TOUCH_IIC_FW_UPDATE: + { + printk("Call TOUCH_IIC_FW_UPDATE\n"); + unsigned long fw_size = 0; + int result = 0; + if ( copy_from_user(&fw_size, (unsigned long*)arg, sizeof (unsigned long)) ) + return -EFAULT; + unsigned char *fw_data = vmalloc(fw_size, GFP_KERNEL); + if ( copy_from_user(fw_data, (char*)((char *)arg + sizeof (unsigned long)), fw_size) ) + return -EFAULT; - default: - printk("No such command\n"); - } - return 0; + printk("FW_Size=%d\n", fw_size); + result = update_touch_firmware(fw_size, fw_data); + printk("TOUCH_IIC_FW_UPDATE Complete(result=%d)!!!\n", result); + vfree(fw_data); + return result; + } + break; + case TOUCH_IIC_GET_FW_INFO: + { + char info = 0; + get_touch_firmware_info(&info); + if ( copy_to_user((void *)arg, (const void *) & info, sizeof (char)) ) + return -EFAULT; + } + break; + /* } Qisda, howard hsu, 2010/01/27, TOUCH firmware update */ + + /*kit.add 2010/01/30*/ + case TOUCH_IIC_T_SENSOR_ENABLE: + { + switch ( arg ) + { + case 0: + s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); + s3c2410_gpio_setpin(S3C2410_GPC3, 0); + printk("T-Sensor power off\n"); + break; + + case 1: + s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); + s3c2410_gpio_setpin(S3C2410_GPC3, 1); + printk("T-Sensor power on\n"); + break; + + default: + printk("T-Sensor no such command\n"); + break; + } + } + break; + /*kit.end*/ + + default: + printk("No such command\n"); + } + return 0; } /* File operations struct for character device */ static const struct file_operations s3c_ts_iic_fops = { - .owner = THIS_MODULE, - .ioctl = s3c_ts_iic_ioctl, - .open = s3c_ts_iic_open, - .release = NULL + .owner = THIS_MODULE, + .ioctl = s3c_ts_iic_ioctl, + .open = s3c_ts_iic_open, + .release = NULL }; - - -int s3c_ts_iic_port_init(struct i2c_client *c) +int s3c_ts_iic_port_init (struct i2c_client *c) { - int err = 0; + int err = 0; - ts_iic->client = c; - err = c->driver->command(c,QISDA_IIC_INIT,NULL); - if(err<0){ - printk("Touch init faied\n"); - goto fail; - } + ts_iic->client = c; + err = c->driver->command(c, QISDA_IIC_INIT, NULL); + if ( err < 0 ) + { + printk("Touch init faied\n"); + goto fail; + } - //touch_iic_init(); - //touch_iic_port_initialize(); + //touch_iic_init(); + //touch_iic_port_initialize(); - //Qisda Tony 090415 [ - #ifdef POLLING_MODE + //Qisda Tony 090415 [ +#ifdef POLLING_MODE - #ifdef KTHREAD_USE - init_waitqueue_head(&wait); - kmain_task = kthread_create(ts_iic_workqueue, NULL,"ts_iic_kthread"); - wake_up_process(kmain_task); - #else - init_timer(&touch_iic_timer_qisda); - touch_iic_timer_qisda.function =touhc_iic_timer_handler_qisda; - //touch_iic_timer_qisda.data; - touch_iic_timer_qisda.expires = jiffies + 10*HZ; - add_timer(&touch_iic_timer_qisda); - #endif +# ifdef KTHREAD_USE + init_waitqueue_head(&wait); + kmain_task = kthread_create(ts_iic_workqueue, NULL, "ts_iic_kthread"); + wake_up_process(kmain_task); +# else + init_timer(&touch_iic_timer_qisda); + touch_iic_timer_qisda.function = touhc_iic_timer_handler_qisda; + //touch_iic_timer_qisda.data; + touch_iic_timer_qisda.expires = jiffies + 10 * HZ; + add_timer(&touch_iic_timer_qisda); +# endif - #else //NOT POLLING_MODE +#else //NOT POLLING_MODE - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); - #ifndef KTHREAD_USE - init_timer(&touch_iic_timer_qisda); - touch_iic_timer_qisda.function =touhc_iic_timer_handler_qisda; - #endif +# ifndef KTHREAD_USE + init_timer(&touch_iic_timer_qisda); + touch_iic_timer_qisda.function = touhc_iic_timer_handler_qisda; +# endif - set_irq_type(IRQ_EINT2, S3C2410_EXTINT_FALLEDGE); - err = request_irq(IRQ_EINT2, touch_iic_isr, SA_INTERRUPT, DEVICE_NAME, (void *) ts_iic->pdev); + 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) { - printk("request_irq failed (IRQ_EINT2) !!!\n"); - free_irq(IRQ_EINT2, ts_iic->dev); - //ts_iic_port_deinit(); - goto fail; - } + if ( err ) + { + printk("request_irq failed (IRQ_EINT2) !!!\n"); + free_irq(IRQ_EINT2, ts_iic->dev); + //ts_iic_port_deinit(); + goto fail; + } - //touch_iic_clear_interrupt_pending(); - //touch_iic_enable_interrupt(); - #endif //End of NOT POLLING_MODE + //touch_iic_clear_interrupt_pending(); + //touch_iic_enable_interrupt(); +#endif //End of NOT POLLING_MODE - memset(keybuffer,0x0,sizeof(keybuffer)); - //Qisda Tony 090415 ] - if (register_chrdev (TOUCH_MAJOR, "touch_cmd", &s3c_ts_iic_fops)) { - printk("unable to get major %d\n", TOUCH_MAJOR); + memset(keybuffer, 0x0, sizeof (keybuffer)); + //Qisda Tony 090415 ] + if ( register_chrdev(TOUCH_MAJOR, "touch_cmd", &s3c_ts_iic_fops) ) + { + printk("unable to get major %d\n", TOUCH_MAJOR); - } - printk("s3c_ts_iic_port_init is initialized!!\n"); + } + printk("s3c_ts_iic_port_init is initialized!!\n"); #ifdef CONFIG_QISDA_BK060B00 - s3c2410_gpio_pullup(S3C2410_GPD10, 2); - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10,1); + s3c2410_gpio_pullup(S3C2410_GPD10, 2); + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 1); #else - s3c2410_gpio_pullup(S3C2410_GPF5, 2); - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5,1); + s3c2410_gpio_pullup(S3C2410_GPF5, 2); + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); #endif - /*Qisda Qube for open smartcard pwr*/ + /*Qisda Qube for open smartcard pwr*/ #if defined (CONFIG_QISDA_AS090B00_EVT1) || defined (CONFIG_QISDA_AS090B00_EVT1_1) - s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); - /*kit.mod 2009/12/25*/ - s3c2410_gpio_setpin(S3C2410_GPC3, 0); - /*kit.end*/ + s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); + /*kit.mod 2009/12/25*/ + s3c2410_gpio_setpin(S3C2410_GPC3, 0); + /*kit.end*/ #endif - /*Qisda Qube for open smartcard pwr*/ + /*Qisda Qube for open smartcard pwr*/ - return 0; + return 0; fail: - platform_driver_unregister(&s3c_ts_iic_driver); - input_free_device(ts_iic->dev); - kfree(ts_iic); - return -EIO; + platform_driver_unregister(&s3c_ts_iic_driver); + input_free_device(ts_iic->dev); + kfree(ts_iic); + return -EIO; } -static int __init s3c_ts_iic_probe(struct platform_device *pdev) +static int __init s3c_ts_iic_probe (struct platform_device *pdev) { - struct input_dev *input_dev; - int err; + struct input_dev *input_dev; + int err; -//Tony test + //Tony test #ifdef QISDA_TEST_GPIO_PROBE -g_pGPIOReg_GPFCON = ioremap(0x56000050, 0x00100000); -writel(readl(g_pGPIOReg_GPFCON) | (0x1<<0), g_pGPIOReg_GPFCON); -writel(readl(g_pGPIOReg_GPFCON+0x04) | (0x1<<0), g_pGPIOReg_GPFCON+0x04); -writel(readl(g_pGPIOReg_GPFCON+0x08) | (0x2<<0), g_pGPIOReg_GPFCON+0x08); + g_pGPIOReg_GPFCON = ioremap(0x56000050, 0x00100000); + writel(readl(g_pGPIOReg_GPFCON) | (0x1 << 0), g_pGPIOReg_GPFCON); + writel(readl(g_pGPIOReg_GPFCON + 0x04) | (0x1 << 0), g_pGPIOReg_GPFCON + 0x04); + writel(readl(g_pGPIOReg_GPFCON + 0x08) | (0x2 << 0), g_pGPIOReg_GPFCON + 0x08); #endif - ts_iic = kzalloc(sizeof(struct s3c_ts_iic), GFP_KERNEL); - input_dev = input_allocate_device(); + ts_iic = kzalloc(sizeof (struct s3c_ts_iic), GFP_KERNEL); + input_dev = input_allocate_device(); - if (!input_dev) { - err = -ENOMEM; - goto fail; - } - ts_iic->dev = input_dev; + if ( !input_dev ) + { + err = -ENOMEM; + goto fail; + } + ts_iic->dev = input_dev; - ts_iic->dev->evbit[0] = ts_iic->dev->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); - ts_iic->dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); + ts_iic->dev->evbit[0] = ts_iic->dev->evbit[0] = BIT(EV_SYN) | BIT(EV_KEY) | BIT(EV_ABS); + ts_iic->dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); - input_set_abs_params(ts_iic->dev, ABS_X, 0, 0xFFF, 0, 0); - input_set_abs_params(ts_iic->dev, ABS_Y, 0, 0xFFF, 0, 0); - input_set_abs_params(ts_iic->dev, ABS_PRESSURE, 0, 1, 0, 0); + input_set_abs_params(ts_iic->dev, ABS_X, 0, 0xFFF, 0, 0); + input_set_abs_params(ts_iic->dev, ABS_Y, 0, 0xFFF, 0, 0); + input_set_abs_params(ts_iic->dev, ABS_PRESSURE, 0, 1, 0, 0); - ts_iic->dev->private = ts_iic; - ts_iic->dev->name = s3c_ts_iic_name; - ts_iic->dev->id.bustype = BUS_I2C; - ts_iic->dev->id.vendor = 0xDEAD; - ts_iic->dev->id.product = 0xBEEF; - ts_iic->dev->id.version = 0x0010; - platform_set_drvdata(pdev, ts_iic); + ts_iic->dev->private = ts_iic; + ts_iic->dev->name = s3c_ts_iic_name; + ts_iic->dev->id.bustype = BUS_I2C; + ts_iic->dev->id.vendor = 0xDEAD; + ts_iic->dev->id.product = 0xBEEF; + ts_iic->dev->id.version = 0x0010; + platform_set_drvdata(pdev, ts_iic); - /* All went ok, so register to the input system */ - err = input_register_device(ts_iic->dev); - if(err) { - goto fail; - } + /* All went ok, so register to the input system */ + err = input_register_device(ts_iic->dev); + if ( err ) + { + goto fail; + } - ts_iic->pdev = pdev; - ts_iic->polling_time = 20; - INIT_WORK(&workq_readdata,ts_iic_workqueue); - //However, stop interrupt first. This is because the signal is emitted from the panel repeatedly - //Unless we set the interrupt mode of the the panel to stop emitting. - //touch_iic_disable_interrupt(); - //printk("s3c_ts_iic_probe IRQ is initialized!!\n"); + ts_iic->pdev = pdev; + ts_iic->polling_time = 20; + INIT_WORK(&workq_readdata, ts_iic_workqueue); + //However, stop interrupt first. This is because the signal is emitted from the panel repeatedly + //Unless we set the interrupt mode of the the panel to stop emitting. + //touch_iic_disable_interrupt(); + //printk("s3c_ts_iic_probe IRQ is initialized!!\n"); - // touch panel enable in common-smdk.c - //writel((readl(S3C2416_GPKCON) & ~(1<<5) | (1<<4)), S3C2416_GPKCON); - //writel((readl(S3C2416_GPKDAT) | (1<<2)), S3C2416_GPKDAT); + // touch panel enable in common-smdk.c + //writel((readl(S3C2416_GPKCON) & ~(1<<5) | (1<<4)), S3C2416_GPKCON); + //writel((readl(S3C2416_GPKDAT) | (1<<2)), S3C2416_GPKDAT); - return 0; + return 0; fail: - input_free_device(input_dev); - kfree(ts_iic); - return -EIO; + input_free_device(input_dev); + kfree(ts_iic); + return -EIO; } -static int s3c_ts_iic_remove(struct platform_device *dev) +static int s3c_ts_iic_remove (struct platform_device *dev) { - return 0; + return 0; } #ifdef CONFIG_PM -static int s3c_ts_iic_suspend(struct platform_device *dev, pm_message_t state) + +static int s3c_ts_iic_suspend (struct platform_device *dev, pm_message_t state) { - /*kit.add 2010/01/06, turn off Tilt-Sensor power*/ - s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); - s3c2410_gpio_setpin(S3C2410_GPC3, 0); - /*kit.end*/ + /*kit.add 2010/01/06, turn off Tilt-Sensor power*/ + s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); + s3c2410_gpio_setpin(S3C2410_GPC3, 0); + /*kit.end*/ - /*kit.test 2010/01/30, turn off SPI_INT power*/ - s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP); - s3c2410_gpio_pullup(S3C2410_GPF3, 0); /* pull-up/down disable */ - /*kit.end*/ + /*kit.test 2010/01/30, turn off SPI_INT power*/ + s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP); + s3c2410_gpio_pullup(S3C2410_GPF3, 0); /* pull-up/down disable */ + /*kit.end*/ - /*kit.add 2009/11/04*/ - if(wkup_srce == 1) - { - printk("\nTouch Suspend: Add touch to wakeup source, do not turn off touch power...\n"); - } - //else if(wkup_srce == 0) - else - { - if(!isTouchPowerOff) - { - printk("\nTouch Suspend: Do not add touch to wakeup source, turn off touch power...\n"); - disable_irq(IRQ_EINT2); + /*kit.add 2009/11/04*/ + if ( wkup_srce == 1 ) + { + printk("\nTouch Suspend: Add touch to wakeup source, do not turn off touch power...\n"); + } + //else if(wkup_srce == 0) + else + { + if ( !isTouchPowerOff ) + { + printk("\nTouch Suspend: Do not add touch to wakeup source, turn off touch power...\n"); + disable_irq(IRQ_EINT2); - /*kit.add 2010/01/20, turn off TP_INT(GPF2) power*/ - /*test1: TP_INT(GPF2) => Input, Disable*/ - //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - //s3c2410_gpio_pullup(S3C2410_GPF2, 0); - /*test2: TP_INT(GPF2) => Input, Pull Low*/ - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); - s3c2410_gpio_setpin(S3C2410_GPF2, 1); - /*kit.end*/ + /*kit.add 2010/01/20, turn off TP_INT(GPF2) power*/ + /*test1: TP_INT(GPF2) => Input, Disable*/ + //s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + //s3c2410_gpio_pullup(S3C2410_GPF2, 0); + /*test2: TP_INT(GPF2) => Input, Pull Low*/ + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP); + s3c2410_gpio_setpin(S3C2410_GPF2, 1); + /*kit.end*/ - /*turn off TOUCH_EN power*/ -#ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 0); -#else + /*turn off TOUCH_EN power*/ +# ifdef CONFIG_QISDA_BK060B00 - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 0); -#endif - } - } - /*kit.end*/ - - #ifdef USE_BUFFERED_TOUCH_DATA - go_in_suspend = 1; - #endif + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 0); +# else - return 0; + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 0); +# endif + } + } + /*kit.end*/ + +# ifdef USE_BUFFERED_TOUCH_DATA + go_in_suspend = 1; +# endif + + return 0; } -static int s3c_ts_iic_resume(struct platform_device *pdev) +static int s3c_ts_iic_resume (struct platform_device *pdev) { - /*kit.add 2010/01/06, for Tilt-Sensor power*/ - s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); - s3c2410_gpio_setpin(S3C2410_GPC3, 1); - /*kit.end*/ + /*kit.add 2010/01/06, for Tilt-Sensor power*/ + s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); + s3c2410_gpio_setpin(S3C2410_GPC3, 1); + /*kit.end*/ - /*kit.test 2010/01/30, for SPI_INT power*/ - s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3); - s3c2410_gpio_pullup(S3C2410_GPF3, 2); /* pull-up enable */ - /*kit.end*/ + /*kit.test 2010/01/30, for SPI_INT power*/ + s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3); + s3c2410_gpio_pullup(S3C2410_GPF3, 2); /* pull-up enable */ + /*kit.end*/ - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); - /*kit.add 2009/11/04*/ - if(wkup_srce == 1) - { - printk("\nTouch Resume: Touch is wakeup source\n"); - } - //else if(wkup_srce == 0) - else - { - printk("\nTouch Resume: Touch is not wakeup source, turn on touch power and enable IRQ...\n"); + /*kit.add 2009/11/04*/ + if ( wkup_srce == 1 ) + { + printk("\nTouch Resume: Touch is wakeup source\n"); + } + //else if(wkup_srce == 0) + else + { + printk("\nTouch Resume: Touch is not wakeup source, turn on touch power and enable IRQ...\n"); - if(!isTouchPowerOff) - { - /*turn on TOUCH_EN power*/ - #ifdef CONFIG_QISDA_BK060B00 - - s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); - s3c2410_gpio_setpin(S3C2410_GPD10, 1); - #else - s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); - s3c2410_gpio_setpin(S3C2410_GPF5, 1); - #endif - msleep(200); - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL); + if ( !isTouchPowerOff ) + { + /*turn on TOUCH_EN power*/ +# ifdef CONFIG_QISDA_BK060B00 - /*kit.add 2010/01/20, config TP_INT(GPF2) to interrupt*/ - s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); - s3c2410_gpio_pullup(S3C2410_GPF2, 2); - /*kit.end*/ + s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP); + s3c2410_gpio_setpin(S3C2410_GPD10, 1); +# else + s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP); + s3c2410_gpio_setpin(S3C2410_GPF5, 1); +# endif + msleep(200); + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL); - enable_irq(IRQ_EINT2); + /*kit.add 2010/01/20, config TP_INT(GPF2) to interrupt*/ + s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2); + s3c2410_gpio_pullup(S3C2410_GPF2, 2); + /*kit.end*/ - switch(touchPowerState) - { - case TOUCH_DEVICE_ACTIVE_STATE: - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_ACTIVE_MODE, NULL); - ts_iic->polling_time = touchPollingTime; - touchPowerState = TOUCH_DEVICE_ACTIVE_STATE; - break; + enable_irq(IRQ_EINT2); - case TOUCH_DEVICE_SLEEP_STATE: - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_SLEEP_MODE, NULL); - ts_iic->polling_time = TOUCH_SLEEP_POLLING_TIME; - touchPowerState = TOUCH_DEVICE_SLEEP_STATE; - break; + switch ( touchPowerState ) + { + case TOUCH_DEVICE_ACTIVE_STATE: + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_ACTIVE_MODE, NULL); + ts_iic->polling_time = touchPollingTime; + touchPowerState = TOUCH_DEVICE_ACTIVE_STATE; + break; - case TOUCH_DEVICE_DEEPSLEEP_STATE: - ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_DEEPSLEEP_MODE, NULL); - ts_iic->polling_time = TOUCH_DEEPSLEEP_POLLING_TIME; - touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE; - break; + case TOUCH_DEVICE_SLEEP_STATE: + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_SLEEP_MODE, NULL); + ts_iic->polling_time = TOUCH_SLEEP_POLLING_TIME; + touchPowerState = TOUCH_DEVICE_SLEEP_STATE; + break; - case TOUCH_DEVICE_POWEROFF_STATE: - touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE; - break; + case TOUCH_DEVICE_DEEPSLEEP_STATE: + ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_DEEPSLEEP_MODE, NULL); + ts_iic->polling_time = TOUCH_DEEPSLEEP_POLLING_TIME; + touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE; + break; - default: - break; - } - } - } - /*kit.end*/ + case TOUCH_DEVICE_POWEROFF_STATE: + touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE; + break; - return 0; + default: + break; + } + } + } + /*kit.end*/ + + return 0; } #else -#define s3c_ts_iic_suspend NULL -#define s3c_ts_iic_resume NULL +# define s3c_ts_iic_suspend NULL +# define s3c_ts_iic_resume NULL #endif static struct platform_driver s3c_ts_iic_driver = { - .probe = s3c_ts_iic_probe, - .remove = s3c_ts_iic_remove, - .suspend = s3c_ts_iic_suspend, - .resume = s3c_ts_iic_resume, - .driver = { - .owner = THIS_MODULE, - .name = DEVICE_NAME, - }, + .probe = s3c_ts_iic_probe, + .remove = s3c_ts_iic_remove, + .suspend = s3c_ts_iic_suspend, + .resume = s3c_ts_iic_resume, + .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); } -module_init(s3c_ts_iic_init); -module_exit(s3c_ts_iic_exit); -MODULE_AUTHOR("Tony.YC.Huang@qisda.com"); -MODULE_DESCRIPTION("Touchscreen driver Of IIC type for Qisda"); -MODULE_LICENSE("GPL"); + +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"); +MODULE_DESCRIPTION ("Touchscreen driver Of IIC type for Qisda"); +MODULE_LICENSE ("GPL"); //Qisda Tony 090406, add Auo touch i2c driver ] diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c index 173ce81..ce85f3f 100644 --- a/drivers/serial/s3c2410.c +++ b/drivers/serial/s3c2410.c @@ -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 diff --git a/drivers/video/epaper/auo-tcon-k1900.c b/drivers/video/epaper/auo-tcon-k1900.c index 81cddb3..a9dc871 100644 --- a/drivers/video/epaper/auo-tcon-k1900.c +++ b/drivers/video/epaper/auo-tcon-k1900.c @@ -37,8 +37,8 @@ #include -//#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); diff --git a/include/linux/cyio.h b/include/linux/cyio.h index 7eaaab3..1423e1d 100644 --- a/include/linux/cyio.h +++ b/include/linux/cyio.h @@ -2,51 +2,91 @@ // 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' -#define CYEVENT_KEY_DOWN 'd' -#define CYEVENT_KEY_LEFT 'l' -#define CYEVENT_KEY_UP 'u' -#define CYEVENT_KEY_F1 '1' -#define CYEVENT_KEY_F2 '2' -#define CYEVENT_KEY_F3 '3' -#define CYEVENT_KEY_F4 '4' -#define CYEVENT_KEY_OFF 'o' -#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_ENTER 'e' +#define CYEVENT_KEY_RIGHT 'r' +#define CYEVENT_KEY_DOWN 'd' +#define CYEVENT_KEY_LEFT 'l' +#define CYEVENT_KEY_UP 'u' +#define CYEVENT_KEY_F1 '1' +#define CYEVENT_KEY_F2 '2' +#define CYEVENT_KEY_F3 '3' +#define CYEVENT_KEY_F4 '4' +#define CYEVENT_KEY_OFF 'o' +#define CYEVENT_KEY_DSLP 's' +#define CYEVENT_KEY_VOLP '+' +#define CYEVENT_KEY_VOLN '-' +#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); // =========================================================================== diff --git a/init/do_mounts.c b/init/do_mounts.c index 67402aa..2e3581a 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -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);