Commit for backup purpose

This commit is contained in:
mlt
2010-06-28 17:51:53 +00:00
committed by Godzil
parent 71062896b6
commit e3c7c1b8b5
17 changed files with 1809 additions and 261 deletions

View File

@@ -24,7 +24,7 @@
#include <cybook.h>
#include <linux/cyio.h>
#define DEBUG_MESSAGES
//#define DEBUG_MESSAGES
//#define DEBUG_TRACEFUNC
#define MODULE_NAME "ORIZON-TS"
@@ -299,12 +299,13 @@ static int ots_detect (struct i2c_adapter *adapter, int address, int kind)
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;
}
enable_irq_wake(IRQ_EINT2);
}
goto exit;
@@ -352,25 +353,45 @@ static int ots_resume (struct device *dev)
/******************************************************************************/
/********************** Interrupt Related functions ***************************/
/******************************************************************************/
static int oldX = 0, oldY = 0;
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;
/* TODO: I reversed the X / Y axis to match old driver and revese the X value */
y1 = i2c_smbus_read_byte_data(ots_client, 0);
y1 |= i2c_smbus_read_byte_data(ots_client, 1) << 8;
x2 = i2c_smbus_read_byte_data(ots_client, 4);
x2 |= i2c_smbus_read_byte_data(ots_client, 5) << 8;
x1 = i2c_smbus_read_byte_data(ots_client, 2);
x1 |= i2c_smbus_read_byte_data(ots_client, 3) << 8;
y2 = i2c_smbus_read_byte_data(ots_client, 6);
y2 |= i2c_smbus_read_byte_data(ots_client, 7) << 8;
y2 = i2c_smbus_read_byte_data(ots_client, 4);
y2 |= i2c_smbus_read_byte_data(ots_client, 5) << 8;
DBG("x1: %lu\ty1: %lu\ty1: %lu\ty2: %lu", x1, y1, x2, y2);
x2 = i2c_smbus_read_byte_data(ots_client, 6);
x2 |= i2c_smbus_read_byte_data(ots_client, 7) << 8;
DBG("x1: %lu\ty1: %lu\tx2: %lu\ty2: %lu", x1, y1, x2, y2);
if ((x1 == 0) && (y1 == 0))
{ /* We assume that this is a finger up event */
if ( Cyio_PushEvent('R', 1) >= 0 )
{
Cyio_PushEvent((oldX >> 8) & 0xFF, 0);
Cyio_PushEvent((oldX >> 0) & 0xFF, 0);
Cyio_PushEvent((oldY >> 8) & 0xFF, 0);
Cyio_PushEvent((oldY >> 0) & 0xFF, 0);
}
}
else
{
oldX = 600 - x1;
oldY = y1;
}
/* Say I get the data */
ots_ackInterrupt();