Add preliminary driver for touchscreen. And start of major changes in CyIO
This commit is contained in:
parent
a55a73c5d1
commit
73a653c3d6
@ -734,17 +734,6 @@ static void __init parse_tags(const struct tag *t)
|
|||||||
{
|
{
|
||||||
for (; t->hdr.size; t = tag_next(t)){
|
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))
|
if (!parse_tag(t))
|
||||||
printk(KERN_WARNING
|
printk(KERN_WARNING
|
||||||
"Ignoring unrecognised tag 0x%08x\n",
|
"Ignoring unrecognised tag 0x%08x\n",
|
||||||
|
|||||||
@ -90,10 +90,10 @@ static void s3c2416_idle(void)
|
|||||||
/* ensure our idle mode is to go to idle */
|
/* ensure our idle mode is to go to idle */
|
||||||
/*if you want to reduce CPU clock with idle */
|
/*if you want to reduce CPU clock with idle */
|
||||||
#ifdef DVS_IDLE
|
#ifdef DVS_IDLE
|
||||||
tmp = __raw_readl(S3C2443_CLKDIV0);
|
/*tmp = __raw_readl(S3C2443_CLKDIV0);
|
||||||
tmp &= ~(0x1<<13);
|
tmp &= ~(0x1<<13);
|
||||||
tmp |= (0x1<<13);
|
tmp |= (0x1<<13);
|
||||||
__raw_writel(tmp, S3C2443_CLKDIV0);
|
__raw_writel(tmp, S3C2443_CLKDIV0);*/
|
||||||
#else
|
#else
|
||||||
/* Qisda, ShiYong Lin, 2009/10/27, Modify for exception in s3c_idle function {*/
|
/* Qisda, ShiYong Lin, 2009/10/27, Modify for exception in s3c_idle function {*/
|
||||||
// tmp = __raw_readl(S3C2443_PWRMODE);
|
// tmp = __raw_readl(S3C2443_PWRMODE);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
// cyio.c
|
// cyio.c
|
||||||
// Copyright (C) 2008-2009 Bookeen - All rights reserved
|
// Copyright (C) 2008-2010 Bookeen - All rights reserved
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
@ -14,7 +14,6 @@
|
|||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
|
|
||||||
|
|
||||||
#include <cybook.h>
|
#include <cybook.h>
|
||||||
|
|
||||||
#include <linux/cyio.h>
|
#include <linux/cyio.h>
|
||||||
|
|||||||
@ -176,6 +176,14 @@ config TOUCHSCREEN_UCB1400
|
|||||||
|
|
||||||
To compile this driver as a module, choose M here: the
|
To compile this driver as a module, choose M here: the
|
||||||
module will be called ucb1400_ts.
|
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 [
|
#Qisda Tony 090406, add Auo touch i2c driver [
|
||||||
config TOUCHSCREEN_IIC_QISDA
|
config TOUCHSCREEN_IIC_QISDA
|
||||||
tristate "Touch Screen for IIC Qisda"
|
tristate "Touch Screen for IIC Qisda"
|
||||||
|
|||||||
@ -17,6 +17,7 @@ obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
|
|||||||
obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
|
obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
|
obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
|
||||||
obj-$(CONFIG_TOUCHSCREEN_S3C) += s3c-ts.o
|
obj-$(CONFIG_TOUCHSCREEN_S3C) += s3c-ts.o
|
||||||
|
obj-$(CONFIG_TOUCHSCREEN_ORIZON) += orizon_ts.o
|
||||||
#Qisda Tony 090406, add Auo touch i2c driver [
|
#Qisda Tony 090406, add Auo touch i2c driver [
|
||||||
obj-$(CONFIG_TOUCHSCREEN_IIC_QISDA) += s3c_ts_iic.o
|
obj-$(CONFIG_TOUCHSCREEN_IIC_QISDA) += s3c_ts_iic.o
|
||||||
#Qisda Tony 090406, add Auo touch i2c driver ]
|
#Qisda Tony 090406, add Auo touch i2c driver ]
|
||||||
|
|||||||
578
drivers/input/touchscreen/orizon_ts.c
Normal file
578
drivers/input/touchscreen/orizon_ts.c
Normal file
@ -0,0 +1,578 @@
|
|||||||
|
// ===========================================================================
|
||||||
|
// orizon_ts.c
|
||||||
|
// Copyright (C) 2003-2010 Bookeen - All rights reserved
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
/* TODO: Verify if all this includes are necessary */
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
#include <asm/atomic.h>
|
||||||
|
#include <asm/io.h>
|
||||||
|
#include <asm/arch/irqs.h>
|
||||||
|
#include <asm/arch/gpio.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/irq.h>
|
||||||
|
#include <linux/jiffies.h>
|
||||||
|
#include <linux/i2c.h>
|
||||||
|
#include <linux/proc_fs.h>
|
||||||
|
#include <linux/kthread.h>
|
||||||
|
#include <linux/mutex.h>
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
#include <linux/ctype.h>
|
||||||
|
|
||||||
|
#include <cybook.h>
|
||||||
|
#include <linux/cyio.h>
|
||||||
|
|
||||||
|
#define DEBUG_MESSAGES
|
||||||
|
//#define DEBUG_TRACEFUNC
|
||||||
|
|
||||||
|
#define MODULE_NAME "ORIZON-TS"
|
||||||
|
|
||||||
|
#define FINGER_NUM 0x00
|
||||||
|
#define INT_DELAY 0x64 /* Default 0x64 */
|
||||||
|
#define INT_MODE 0x01
|
||||||
|
#define X_SENS 0x22 /* Default 0x14 */
|
||||||
|
#define Y_SENS 0x22 /* Default 0x14 */
|
||||||
|
|
||||||
|
#ifdef DEBUG_MESSAGES
|
||||||
|
|
||||||
|
enum InfoLevel
|
||||||
|
{
|
||||||
|
INFO_ERROR = 0,
|
||||||
|
INFO_WARNING,
|
||||||
|
INFO_NORMAL,
|
||||||
|
INFO_DEBUG,
|
||||||
|
INFO_VERBOSE,
|
||||||
|
};
|
||||||
|
|
||||||
|
# ifndef VERBOSE_LEVEL
|
||||||
|
# define VERBOSE_LEVEL INFO_VERBOSE
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef DEBUG_TRACEFUNC
|
||||||
|
|
||||||
|
static int _dbg_FunctionLevel = 0;
|
||||||
|
|
||||||
|
# define MSG(str) {\
|
||||||
|
int __i;\
|
||||||
|
printk(KERN_ALERT "+");\
|
||||||
|
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||||
|
printk("-");\
|
||||||
|
printk("||" str "\n");\
|
||||||
|
}
|
||||||
|
|
||||||
|
# define DBG(str, ...) {\
|
||||||
|
int __i;\
|
||||||
|
printk(KERN_ALERT "+");\
|
||||||
|
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||||
|
printk("-");\
|
||||||
|
printk("||" str "\n", __VA_ARGS__);\
|
||||||
|
}
|
||||||
|
|
||||||
|
# define INFOL(level, s) do {\
|
||||||
|
if (level <= VERBOSE_LEVEL) {\
|
||||||
|
int __i;\
|
||||||
|
printk(KERN_ALERT "+");\
|
||||||
|
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||||
|
printk("-");\
|
||||||
|
printk("<%d>%s:%s(): ", level, __FILE__, __func__); printk s; printk("\n");\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
# define FUNC_IN() {\
|
||||||
|
int __i;\
|
||||||
|
_dbg_FunctionLevel++;\
|
||||||
|
printk(KERN_ALERT "+");\
|
||||||
|
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||||
|
printk("-");\
|
||||||
|
printk(">> %s() >>\n", __func__);\
|
||||||
|
}
|
||||||
|
|
||||||
|
# define FUNC_OUT() {\
|
||||||
|
int __i;\
|
||||||
|
printk(KERN_ALERT "+");\
|
||||||
|
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||||
|
printk("-");\
|
||||||
|
printk("<< %s() <<\n", __func__);\
|
||||||
|
_dbg_FunctionLevel--;\
|
||||||
|
}
|
||||||
|
|
||||||
|
# define FUNC_OUTR(val) {\
|
||||||
|
int __i;\
|
||||||
|
printk(KERN_ALERT "+");\
|
||||||
|
for (__i = 0; __i < _dbg_FunctionLevel; __i++)\
|
||||||
|
printk("-");\
|
||||||
|
printk("<< %s() = %d <<\n", __func__, val);\
|
||||||
|
_dbg_FunctionLevel--;\
|
||||||
|
}
|
||||||
|
# else /* DEBUG_TRACEFUNC */
|
||||||
|
|
||||||
|
# define MSG(str) do {\
|
||||||
|
printk(KERN_ALERT MODULE_NAME ": " str "\n");\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
# define DBG(str, ...) do {\
|
||||||
|
printk(KERN_ALERT MODULE_NAME ": " str "\n", __VA_ARGS__);\
|
||||||
|
} while(0)
|
||||||
|
# define FUNC_IN() do {\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
# define FUNC_OUT() do {\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
# define FUNC_OUTR(val) do {\
|
||||||
|
printk(KERN_ALERT MODULE_NAME ": %s() return %d\n", __func__, val);\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
# define INFOL(level, s) do {\
|
||||||
|
if (level <= VERBOSE_LEVEL) {\
|
||||||
|
printk("<%d>%s:%s(): ", level, __FILE__, __func__); printk s; printk("\n");\
|
||||||
|
}\
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
# endif /* DEBUG_TRACEFUNC */
|
||||||
|
#else /* DEBUG_MESSAGES */
|
||||||
|
# define MSG(str)
|
||||||
|
# define DBG(str, ...)
|
||||||
|
# define FUNC_IN()
|
||||||
|
# define FUNC_OUT()
|
||||||
|
# define FUNC_OUTR(val)
|
||||||
|
# define INFOL(level, s)
|
||||||
|
# define INFO(s)
|
||||||
|
#endif /* DEBUG_MESSAGES */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
POWER_UNDEFINED = -1,
|
||||||
|
POWER_OFF = 0,
|
||||||
|
POWER_ON,
|
||||||
|
POWER_ONAUTOSTANDBY,
|
||||||
|
POWER_DEEPSLEEP,
|
||||||
|
} Ots_PowerModes;
|
||||||
|
|
||||||
|
/*============================================================================*/
|
||||||
|
/*============================= Prototypes ===================================*/
|
||||||
|
/*============================================================================*/
|
||||||
|
|
||||||
|
/**************************** i2c functions ***********************************/
|
||||||
|
static int ots_attachAdapter (struct i2c_adapter *adapter);
|
||||||
|
static int ots_detect (struct i2c_adapter *adapter, int address, int kind);
|
||||||
|
static int ots_detachClient (struct i2c_client *client);
|
||||||
|
|
||||||
|
static int ots_suspend (struct device *dev, pm_message_t state);
|
||||||
|
static int ots_resume (struct device *dev);
|
||||||
|
|
||||||
|
//static void ots_dumpI2C(void);
|
||||||
|
/**************************** irq functions ***********************************/
|
||||||
|
static void ots_checkWorkFunction (struct work_struct *work);
|
||||||
|
static irqreturn_t ots_interrupt (int irq, void *dev_id);
|
||||||
|
/******************************* Chip functions *******************************/
|
||||||
|
static void ots_setPowerMode (Ots_PowerModes power);
|
||||||
|
static void ots_setDeviceParameters (unsigned char int_mode,
|
||||||
|
unsigned char x_sensitivity,
|
||||||
|
unsigned char y_sensitivity);
|
||||||
|
static void ots_ackInterrupt (void);
|
||||||
|
/****************************** Module functions ******************************/
|
||||||
|
static int __init ots_init (void);
|
||||||
|
static void __exit ots_exit (void);
|
||||||
|
/*============================= End of prototypes ============================*/
|
||||||
|
|
||||||
|
/*============================================================================*/
|
||||||
|
/*============================= Variables ====================================*/
|
||||||
|
/*============================================================================*/
|
||||||
|
struct workqueue_struct *ots_check_workqueue;
|
||||||
|
struct work_struct ots_check_work;
|
||||||
|
|
||||||
|
static Ots_PowerModes ots_currentPowerMode = POWER_UNDEFINED;
|
||||||
|
|
||||||
|
/****************************** i2c configuration *****************************/
|
||||||
|
#define OTS_ADDR_I2C 0x5C
|
||||||
|
|
||||||
|
static unsigned short normal_i2c[] = { OTS_ADDR_I2C,
|
||||||
|
I2C_CLIENT_END };
|
||||||
|
|
||||||
|
/* Insmod parameters */
|
||||||
|
I2C_CLIENT_INSMOD_1 (ots);
|
||||||
|
struct i2c_client *ots_client;
|
||||||
|
|
||||||
|
/* Each client has this additional data */
|
||||||
|
struct ots_data
|
||||||
|
{
|
||||||
|
struct i2c_client client;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This is the I2C driver that will be inserted */
|
||||||
|
static struct i2c_driver ots_driver ={
|
||||||
|
.driver =
|
||||||
|
{
|
||||||
|
.name = "orizon_ts",
|
||||||
|
.suspend = ots_suspend,
|
||||||
|
.resume = ots_resume,
|
||||||
|
},
|
||||||
|
.id = I2C_DRIVERID_EEPROM,
|
||||||
|
.attach_adapter = ots_attachAdapter,
|
||||||
|
.detach_client = ots_detachClient,
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/**************************** i2c functions ***********************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
#if 0
|
||||||
|
static void ots_dumpI2C(void)
|
||||||
|
{
|
||||||
|
int Addr = 0;
|
||||||
|
unsigned char value;
|
||||||
|
int I,J;
|
||||||
|
printk("-------------------------------------------------------------------------------\n");
|
||||||
|
printk("-------------------------------------I²C TS------------------------------------\n");
|
||||||
|
for ( J = 0; J < 16; J++ )
|
||||||
|
{
|
||||||
|
printk("%04X: ", Addr);
|
||||||
|
for ( I = 0; I < 16; I++, Addr++ )
|
||||||
|
{
|
||||||
|
value = i2c_smbus_read_byte_data(ots_client, Addr);
|
||||||
|
mdelay(4);
|
||||||
|
printk("%02X ", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
printk(" | ");
|
||||||
|
Addr -= 16;
|
||||||
|
|
||||||
|
for ( I = 0; I < 16; I++, Addr++ )
|
||||||
|
{
|
||||||
|
value = i2c_smbus_read_byte_data(ots_client, Addr);
|
||||||
|
mdelay(4);
|
||||||
|
printk("%c", isprint(value) ? value : '.');
|
||||||
|
}
|
||||||
|
printk("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
printk("-------------------------------------------------------------------------------\n");
|
||||||
|
printk("-------------------------------------------------------------------------------\n");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
static int ots_attachAdapter (struct i2c_adapter *adapter)
|
||||||
|
{
|
||||||
|
return i2c_probe(adapter, &addr_data, ots_detect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This function is called by i2c_probe */
|
||||||
|
static int ots_detect (struct i2c_adapter *adapter, int address, int kind)
|
||||||
|
{
|
||||||
|
struct ots_data *data = NULL;
|
||||||
|
|
||||||
|
int err = 0;
|
||||||
|
FUNC_IN();
|
||||||
|
//DBG(">>%s(%p, 0x%X, 0x%X)", __func__, adapter, address, kind);
|
||||||
|
|
||||||
|
|
||||||
|
if ( !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
|
||||||
|
| I2C_FUNC_SMBUS_BYTE) )
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
if ( address == OTS_ADDR_I2C )
|
||||||
|
{
|
||||||
|
if ( !(data = kzalloc(sizeof (struct ots_data), GFP_KERNEL)) )
|
||||||
|
{
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
ots_client = &data->client;
|
||||||
|
i2c_set_clientdata(ots_client, data);
|
||||||
|
ots_client->addr = address;
|
||||||
|
ots_client->adapter = adapter;
|
||||||
|
ots_client->driver = &ots_driver;
|
||||||
|
ots_client->flags = 0;
|
||||||
|
|
||||||
|
/* Fill in the remaining client fields */
|
||||||
|
strlcpy(ots_client->name, "orizon_ts", I2C_NAME_SIZE);
|
||||||
|
|
||||||
|
/* Tell the I2C layer a new client has arrived */
|
||||||
|
if ( (err = i2c_attach_client(ots_client)) )
|
||||||
|
{
|
||||||
|
goto exit_kfree;
|
||||||
|
}
|
||||||
|
|
||||||
|
ots_setPowerMode(POWER_ONAUTOSTANDBY);
|
||||||
|
ots_setDeviceParameters(INT_MODE, X_SENS, Y_SENS);
|
||||||
|
/* Now we are sure that the driver init successfully, then aquire the IRQ */
|
||||||
|
set_irq_type(IRQ_EINT2, IRQT_FALLING);
|
||||||
|
|
||||||
|
if ( request_irq(IRQ_EINT2, ots_interrupt, SA_SHIRQ, "orizon_ts", &ots_client) )
|
||||||
|
{
|
||||||
|
printk(KERN_ERR "failed to get interrupt resouce at IRQ_EINT2.\n");
|
||||||
|
goto exit_kfree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
exit_kfree:
|
||||||
|
kfree(data);
|
||||||
|
exit:
|
||||||
|
FUNC_OUTR(err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ots_detachClient (struct i2c_client *client)
|
||||||
|
{
|
||||||
|
int err = 0;
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
err = i2c_detach_client(client);
|
||||||
|
if ( err )
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
kfree(i2c_get_clientdata(client));
|
||||||
|
|
||||||
|
exit:
|
||||||
|
FUNC_OUTR(err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ots_suspend (struct device *dev, pm_message_t state)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
FUNC_OUTR(ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int ots_resume (struct device *dev)
|
||||||
|
{
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
FUNC_OUT();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/********************** Interrupt Related functions ***************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
static void ots_checkWorkFunction (struct work_struct *work)
|
||||||
|
{
|
||||||
|
unsigned long x1, y1, x2, y2;
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
/* Here do what the interrupt should... (ie read touch values) */
|
||||||
|
x1 = i2c_smbus_read_byte_data(ots_client, 0);
|
||||||
|
x1 |= i2c_smbus_read_byte_data(ots_client, 1) << 8;
|
||||||
|
|
||||||
|
y1 = i2c_smbus_read_byte_data(ots_client, 2);
|
||||||
|
y1 |= i2c_smbus_read_byte_data(ots_client, 3) << 8;
|
||||||
|
|
||||||
|
x2 = i2c_smbus_read_byte_data(ots_client, 4);
|
||||||
|
x2 |= i2c_smbus_read_byte_data(ots_client, 5) << 8;
|
||||||
|
|
||||||
|
y2 = i2c_smbus_read_byte_data(ots_client, 6);
|
||||||
|
y2 |= i2c_smbus_read_byte_data(ots_client, 7) << 8;
|
||||||
|
|
||||||
|
DBG("x1: %lu\ty1: %lu\ty1: %lu\ty2: %lu", x1, y1, x2, y2);
|
||||||
|
|
||||||
|
/* Say I get the data */
|
||||||
|
ots_ackInterrupt();
|
||||||
|
|
||||||
|
FUNC_OUT();
|
||||||
|
}
|
||||||
|
|
||||||
|
static irqreturn_t ots_interrupt (int irq, void *dev_id)
|
||||||
|
{
|
||||||
|
irqreturn_t ret = IRQ_HANDLED;
|
||||||
|
static int initialised = 0;
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
if (initialised == 0)
|
||||||
|
{
|
||||||
|
INIT_WORK(&ots_check_work, ots_checkWorkFunction);
|
||||||
|
initialised = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PREPARE_WORK(&ots_check_work, ots_checkWorkFunction);
|
||||||
|
}
|
||||||
|
schedule_work(&ots_check_work);
|
||||||
|
|
||||||
|
//FUNC_OUTR((int)ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************* Chip functions *******************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
static void ots_setPowerMode (Ots_PowerModes power)
|
||||||
|
{
|
||||||
|
unsigned char tmpReg;
|
||||||
|
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
if (power == ots_currentPowerMode)
|
||||||
|
return; /* No need to do anything, we are in the same power mode... */
|
||||||
|
|
||||||
|
switch(power)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case POWER_UNDEFINED:
|
||||||
|
/* Error */
|
||||||
|
DBG("Error: invalid power mode #%d", power);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POWER_ON:
|
||||||
|
/* Set the power to on */
|
||||||
|
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
|
||||||
|
msleep(100);
|
||||||
|
/* TODO: Does we need to set chip settings? */
|
||||||
|
tmpReg = 0x0; /* Set in "Active Mode" */
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x73, tmpReg);
|
||||||
|
msleep(400);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POWER_OFF:
|
||||||
|
/* Set the power to off */
|
||||||
|
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
|
||||||
|
msleep(10);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POWER_ONAUTOSTANDBY:
|
||||||
|
if ( (ots_currentPowerMode != POWER_ON) &&
|
||||||
|
(ots_currentPowerMode != POWER_DEEPSLEEP) )
|
||||||
|
ots_setPowerMode(POWER_ON); /* Set myself as Power ON before anything */
|
||||||
|
|
||||||
|
//tmpReg = i2c_smbus_read_byte_data(ots_client, 0x24);
|
||||||
|
tmpReg = (((50) /* timeout in ms for auto sleep */ ) & 0x0F) << 4;
|
||||||
|
tmpReg |= (1<< 2); /* Activate auto sleep mode */
|
||||||
|
tmpReg |= 0x1; /* Set in "Sleep Mode" */
|
||||||
|
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x73, tmpReg);
|
||||||
|
msleep(4);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case POWER_DEEPSLEEP:
|
||||||
|
if ( (ots_currentPowerMode != POWER_ON) &&
|
||||||
|
(ots_currentPowerMode != POWER_ONAUTOSTANDBY) )
|
||||||
|
ots_setPowerMode(POWER_ON); /* Set myself as Power ON before anything */
|
||||||
|
|
||||||
|
tmpReg = 0x02;
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x73, tmpReg);
|
||||||
|
msleep(4);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ots_currentPowerMode = power;
|
||||||
|
FUNC_OUT();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ots_setDeviceParameters (unsigned char int_mode,
|
||||||
|
unsigned char x_sensitivity,
|
||||||
|
unsigned char y_sensitivity)
|
||||||
|
{
|
||||||
|
unsigned char tmpReg;
|
||||||
|
|
||||||
|
FUNC_IN();
|
||||||
|
/* Then set INT_WIDTH */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interrupt width register @114 [0x72]
|
||||||
|
* b7-b0: int width
|
||||||
|
* Default: 0x64
|
||||||
|
*/
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x72, INT_DELAY);
|
||||||
|
mdelay(4);
|
||||||
|
/* Now set sensitivity */
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x6F, x_sensitivity);
|
||||||
|
mdelay(4);
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x70, y_sensitivity);
|
||||||
|
mdelay(4);
|
||||||
|
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0xBE, 0x01); // TEST
|
||||||
|
tmpReg = i2c_smbus_read_byte_data(ots_client, 0xBE); // TEST
|
||||||
|
DBG("0xBE = %02X", tmpReg);
|
||||||
|
|
||||||
|
DBG("Firmware Version =0x%x\n", i2c_smbus_read_byte_data(ots_client, 0x77));
|
||||||
|
|
||||||
|
/* Activate the device ! */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interrupt mode Setting register @113 [0x71]
|
||||||
|
* b7-b6-b5: TP_NUM : How many finger, 000: none, 001: One, 010: Two
|
||||||
|
* b4: INT_RELEASE: used to ack (1) IRQ in periodical mode
|
||||||
|
* b3: EN_INT: Enable int (1: enabled, 0: disable)
|
||||||
|
* b2: INT_POL: 0: active low, 1: active high
|
||||||
|
* b1-b0: INT_MODE: 00: INT periodicaly, 01: INT assert when coord changes
|
||||||
|
* 10: TOuch indicate, 11: INT assert when INT_RELEASE modified
|
||||||
|
*
|
||||||
|
* Default 0x0C [000 0 1 1 00]
|
||||||
|
* Qisda: 0x0A [000 0 1 0 10]
|
||||||
|
* Int periodicaly, Active High, and INT enabled
|
||||||
|
*/
|
||||||
|
/* 2 Finger Active High Mode */
|
||||||
|
tmpReg = (FINGER_NUM << 5) | (1 << 3) | (0 << 2) | ((int_mode & 0x03) << 0);
|
||||||
|
DBG("Settings: 0x%02X", tmpReg);
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x71, tmpReg);
|
||||||
|
mdelay(4);
|
||||||
|
tmpReg = i2c_smbus_read_byte_data(ots_client, 0x71); // TEST
|
||||||
|
DBG("[0x71] Settings = %02X", tmpReg);
|
||||||
|
FUNC_OUT();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ots_ackInterrupt (void)
|
||||||
|
{
|
||||||
|
unsigned char tmpReg;
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
tmpReg = i2c_smbus_read_byte_data(ots_client, 0x71);
|
||||||
|
tmpReg |= (1<<4);
|
||||||
|
i2c_smbus_write_byte_data(ots_client, 0x71, tmpReg);
|
||||||
|
|
||||||
|
FUNC_OUT();
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/****************************** Module functions ******************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
static int __init ots_init (void)
|
||||||
|
{
|
||||||
|
FUNC_IN();
|
||||||
|
|
||||||
|
/* if (GET_CAPABILITY(PLAT_CAP_GSENSOR) == PLAT_CAP_GMMA7660)
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Init GPIOs */
|
||||||
|
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
|
||||||
|
s3c2410_gpio_pullup(S3C2410_GPD10, 2);
|
||||||
|
|
||||||
|
i2c_add_driver(&ots_driver);
|
||||||
|
|
||||||
|
FUNC_OUT();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void __exit ots_exit (void)
|
||||||
|
{
|
||||||
|
FUNC_IN();
|
||||||
|
/*if (GET_CAPABILITY(PLAT_CAP_GSENSOR) == PLAT_CAP_GMMA7660)
|
||||||
|
{
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Deinit GPIOs */
|
||||||
|
/* Nothing to do, leave it as output is good enought, just set the
|
||||||
|
* device as power off */
|
||||||
|
ots_setPowerMode(POWER_OFF);
|
||||||
|
|
||||||
|
i2c_del_driver(&ots_driver);
|
||||||
|
FUNC_OUT();
|
||||||
|
}
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
module_init (ots_init);
|
||||||
|
module_exit (ots_exit);
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
MODULE_LICENSE ("GPL");
|
||||||
|
MODULE_AUTHOR ("Bookeen <developers@bookeen.com>");
|
||||||
|
MODULE_VERSION ("1.0");
|
||||||
|
MODULE_DESCRIPTION ("Cybook Orizon Touchpanel driver");
|
||||||
|
// ===========================================================================
|
||||||
File diff suppressed because it is too large
Load Diff
@ -667,20 +667,6 @@ static unsigned int s3c24xx_serial_getclk(struct uart_port *port,
|
|||||||
struct baud_calc *resptr, *best, *sptr;
|
struct baud_calc *resptr, *best, *sptr;
|
||||||
int i;
|
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;
|
clkp = cfg->clocks;
|
||||||
best = NULL;
|
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);
|
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)
|
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
|
||||||
quot = port->custom_divisor;
|
quot = port->custom_divisor;
|
||||||
else
|
else
|
||||||
|
|||||||
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
#include <cybook.h>
|
#include <cybook.h>
|
||||||
|
|
||||||
//#define DEBUG_MESSAGES
|
#define DEBUG_MESSAGES
|
||||||
//#define DEBUG_TRACEFUNC
|
#define DEBUG_TRACEFUNC
|
||||||
|
|
||||||
#define MODULE_NAME "AUO-TCON"
|
#define MODULE_NAME "AUO-TCON"
|
||||||
|
|
||||||
@ -717,7 +717,7 @@ static int tcon_probe (struct platform_device *dev)
|
|||||||
tmp = (tmp & ~(3 << 2)) | (1 << 2);
|
tmp = (tmp & ~(3 << 2)) | (1 << 2);
|
||||||
__raw_writel(tmp, S3C2410_GPBCON);
|
__raw_writel(tmp, S3C2410_GPBCON);
|
||||||
|
|
||||||
mdelay(1);
|
msleep(1);
|
||||||
|
|
||||||
// Panel power on
|
// Panel power on
|
||||||
tmp = __raw_readl(S3C2410_GPBDAT);
|
tmp = __raw_readl(S3C2410_GPBDAT);
|
||||||
|
|||||||
@ -2,6 +2,42 @@
|
|||||||
// cyio.h
|
// cyio.h
|
||||||
// Copyright (C) 2008-2010 Bookeen - All rights reserved
|
// 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
|
// Key events
|
||||||
#define CYEVENT_KEY_ENTER 'e'
|
#define CYEVENT_KEY_ENTER 'e'
|
||||||
#define CYEVENT_KEY_RIGHT 'r'
|
#define CYEVENT_KEY_RIGHT 'r'
|
||||||
@ -13,40 +49,44 @@
|
|||||||
#define CYEVENT_KEY_F3 '3'
|
#define CYEVENT_KEY_F3 '3'
|
||||||
#define CYEVENT_KEY_F4 '4'
|
#define CYEVENT_KEY_F4 '4'
|
||||||
#define CYEVENT_KEY_OFF 'o'
|
#define CYEVENT_KEY_OFF 'o'
|
||||||
#define CYEVENT_KEY_DSLP 'S'
|
#define CYEVENT_KEY_DSLP 's'
|
||||||
#define CYEVENT_KEY_VOLP '+'
|
#define CYEVENT_KEY_VOLP '+'
|
||||||
#define CYEVENT_KEY_VOLN '-'
|
#define CYEVENT_KEY_VOLN '-'
|
||||||
#define CYEVENT_KEY_REPEAT_FLAG 0x80
|
#define CYEVENT_KEY_TOGGLE_ACCEL 'a'
|
||||||
#define CYEVENT_KEY_REPEAT_END '0'
|
#define CYEVENT_KEY_FACTORY_RESET 'f'
|
||||||
// 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'
|
|
||||||
|
|
||||||
// G-Sensor events
|
/* Flags definitions */
|
||||||
#define CYEVENT_ORIENTATIONCHANGED 'O'
|
/* Bit 7 to Bit 4 are event type dependent. If the event need more than 4 flags,
|
||||||
#define CYEVENT_G_ROT000 'A'
|
* it can use it's own "private" values
|
||||||
#define CYEVENT_G_ROT090 'B'
|
*/
|
||||||
#define CYEVENT_G_ROT180 'C'
|
|
||||||
#define CYEVENT_G_ROT270 'D'
|
|
||||||
#define CYEVENT_TOGGLE_GSENSOR 'G'
|
|
||||||
|
|
||||||
// Logical events
|
/* Key event flags */
|
||||||
// CYEVENT_KEY_OFF + CYEVENT_KEY_VOLN
|
#define CYEVENT_FLAG_KEY_REPEAT (1 << 7) /*** Signal that this key is repeated */
|
||||||
#define CYEVENT_FACTORY_OFF 'x'
|
#define CYEVENT_FLAG_KEY_END_OF_REPEAT (1 << 6) /*** Signal that the repeat is finished */
|
||||||
#define CYEVENT_SUSPEND_SCREEN 'y'
|
#define CYEVENT_FLAG_KEY_CONTROL_CHARS (1 << 5) /*** Signal that the current key is not a real key (ie not an ascii value) */
|
||||||
#define CYEVENT_SUSPEND_DEVICE 'z'
|
|
||||||
|
|
||||||
/* Normaly no more used... */
|
/* Touch event flags */
|
||||||
//#define CYIO_KERNEL_2_6 1
|
#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 */
|
/* Non directly CyIO related values, but used for the Accelerometer */
|
||||||
#define G_SENSOR_ON '1'
|
#define G_SENSOR_ON '1'
|
||||||
@ -67,5 +107,6 @@ enum
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
/* Exported function of CyIO */
|
/* Exported function of CyIO */
|
||||||
void Cyio_ResetTimer(void);
|
void Cyio_ResetTimer(void);
|
||||||
int Cyio_PushEvent(char eventId, char unique);
|
int __deprecated Cyio_PushEvent(char eventId, char unique); /* Old way */
|
||||||
|
int Cyio_PushCyEvent(char eventId, char unique);
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@ -414,13 +414,6 @@ void __init prepare_namespace(void)
|
|||||||
{
|
{
|
||||||
int is_floppy;
|
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) {
|
if (root_delay) {
|
||||||
printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
|
printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
|
||||||
root_delay);
|
root_delay);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user