Skip to content

Commit

Permalink
touchscreen: import gt818, sw-ts and fixes from sun5i-import branch
Browse files Browse the repository at this point in the history
  • Loading branch information
techn committed Sep 16, 2012
1 parent cbe599e commit 9fd591f
Show file tree
Hide file tree
Showing 9 changed files with 5,404 additions and 20 deletions.
12 changes: 12 additions & 0 deletions drivers/input/touchscreen/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,23 @@ config TOUCHSCREEN_GT801
depends on I2C
help
GT801 touchscreen driver

config TOUCHSCREEN_GT818
tristate "dpt microelctronics gt818 touchscreen driver"
depends on I2C
help
GT801 touchscreen driver

config TOUCHSCREEN_SUN4I_TS
tristate "sun4i-ts touchscreen driver"
help
sun4i-ts touchscreen driver

config TOUCHSCREEN_SW_TS
tristate "softwinnner (sw-ts) touchscreen driver"
help
sw-ts touchscreen driver

config TOUCHSCREEN_FT5X_TS
tristate "ft5x touchscreen driver"
help
Expand Down
2 changes: 2 additions & 0 deletions drivers/input/touchscreen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o
obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o
obj-$(CONFIG_TOUCHSCREEN_FT5X_TS) += ft5x_ts.o
obj-$(CONFIG_TOUCHSCREEN_GT801) += goodix_touch.o
obj-$(CONFIG_TOUCHSCREEN_GT818) += gt818_ts.o
obj-$(CONFIG_TOUCHSCREEN_ZT8031) += zt8031.o
obj-$(CONFIG_TOUCHSCREEN_COASIA) += coasia_i2c.o
obj-$(CONFIG_TOUCHSCREEN_SUN4I_TS) += sun4i-ts.o
obj-$(CONFIG_TOUCHSCREEN_SW_TS) += sw-ts.o
9 changes: 8 additions & 1 deletion drivers/input/touchscreen/ctp_platform_ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,19 @@
#define IRQ_EINT30 (30)
#define IRQ_EINT31 (31)

#define PIO_INT_CFG0_OFFSET (0x200)
#define PIO_INT_CFG1_OFFSET (0x204)
#define PIO_INT_CFG2_OFFSET (0x208)
#define PIO_INT_CFG3_OFFSET (0x20c)

/*
typedef enum{
PIO_INT_CFG0_OFFSET = 0x200,
PIO_INT_CFG1_OFFSET = 0x204,
PIO_INT_CFG2_OFFSET = 0x208,
PIO_INT_CFG3_OFFSET = 0x20c
} int_cfg_offset;
*/

typedef enum{
POSITIVE_EDGE = 0x0,
Expand All @@ -107,7 +114,7 @@ struct ctp_platform_ops{
bool pendown;
int (*get_pendown_state)(void);
void (*clear_penirq)(void);
int (*set_irq_mode)(char *major_key , char *subkey, int ext_int_num, ext_int_mode int_mode);
int (*set_irq_mode)(char *major_key , char *subkey, ext_int_mode int_mode);
int (*set_gpio_mode)(void);
int (*judge_int_occur)(void);
int (*init_platform_resource)(void);
Expand Down
16 changes: 10 additions & 6 deletions drivers/input/touchscreen/ft5x_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ static int gpio_wakeup_hdle = 0;
static int gpio_reset_hdle = 0;
static int gpio_wakeup_enable = 1;
static int gpio_reset_enable = 1;
static user_gpio_set_t gpio_int_info[1];

static int screen_max_x = 0;
static int screen_max_y = 0;
Expand Down Expand Up @@ -202,7 +203,7 @@ static void ctp_clear_penirq(void)
* 0: success;
* others: fail;
*/
static int ctp_set_irq_mode(char *major_key , char *subkey, int ext_int_num, ext_int_mode int_mode)
static int ctp_set_irq_mode(char *major_key , char *subkey, ext_int_mode int_mode)
{
int ret = 0;
__u32 reg_num = 0;
Expand All @@ -221,13 +222,16 @@ static int ctp_set_irq_mode(char *major_key , char *subkey, int ext_int_num, ext
ret = -1;
goto request_tp_int_port_failed;
}
gpio_get_one_pin_status(gpio_int_hdle, gpio_int_info, subkey, 1);
pr_info("%s, %d: gpio_int_info, port = %d, port_num = %d. \n", __func__, __LINE__, \
gpio_int_info[0].port, gpio_int_info[0].port_num);
#endif

#ifdef AW_GPIO_INT_API_ENABLE
#else
pr_info(" INTERRUPT CONFIG\n");
reg_num = ext_int_num%8;
reg_addr = ext_int_num/8;
reg_num = (gpio_int_info[0].port_num)%8;
reg_addr = (gpio_int_info[0].port_num)/8;
reg_val = readl(gpio_addr + int_cfg_addr[reg_addr]);
reg_val &= (~(7 << (reg_num * 4)));
reg_val |= (int_mode << (reg_num * 4));
Expand All @@ -236,7 +240,7 @@ static int ctp_set_irq_mode(char *major_key , char *subkey, int ext_int_num, ext
ctp_clear_penirq();

reg_val = readl(gpio_addr+PIO_INT_CTRL_OFFSET);
reg_val |= (1 << ext_int_num);
reg_val |= (1 << (gpio_int_info[0].port_num));
writel(reg_val,gpio_addr+PIO_INT_CTRL_OFFSET);

udelay(1);
Expand Down Expand Up @@ -497,7 +501,7 @@ static void ctp_wakeup(void)
* = 0; success;
* < 0; err
*/
static int ctp_detect(struct i2c_client *client, struct i2c_board_info *info)
int ctp_detect(struct i2c_client *client, struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;

Expand Down Expand Up @@ -1754,7 +1758,7 @@ ft5x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
pr_info("CONFIG_FT5X0X_MULTITOUCH is defined. \n");
#endif

err = ctp_ops.set_irq_mode("ctp_para", "ctp_int_port", CTP_IRQ_NO, CTP_IRQ_MODE);
err = ctp_ops.set_irq_mode("ctp_para", "ctp_int_port", CTP_IRQ_MODE);
if(0 != err){
pr_info("%s:ctp_ops.set_irq_mode err. \n", __func__);
goto exit_set_irq_mode;
Expand Down
30 changes: 17 additions & 13 deletions drivers/input/touchscreen/goodix_touch.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static struct workqueue_struct *goodix_wq;
#endif
///////////////////////////////////////////////
//specific tp related macro: need be configured for specific tp
#define CTP_IRQ_NO (IRQ_EINT21)
#define CTP_IRQ_NO (gpio_int_info[0].port_num)
#define CTP_IRQ_MODE (NEGATIVE_EDGE)
#define CTP_NAME GOODIX_I2C_NAME
#define TS_RESET_LOW_PERIOD (15)
Expand All @@ -121,6 +121,7 @@ static int gpio_wakeup_hdle = 0;
static int gpio_reset_hdle = 0;
static int gpio_wakeup_enable = 1;
static int gpio_reset_enable = 1;
static user_gpio_set_t gpio_int_info[1];

static int screen_max_x = 0;
static int screen_max_y = 0;
Expand Down Expand Up @@ -189,32 +190,35 @@ static void ctp_clear_penirq(void)
* 0: success;
* others: fail;
*/
static int ctp_set_irq_mode(char *major_key , char *subkey, int ext_int_num, ext_int_mode int_mode)
static int ctp_set_irq_mode(char *major_key , char *subkey, ext_int_mode int_mode)
{
int ret = 0;
__u32 reg_num = 0;
__u32 reg_addr = 0;
__u32 reg_val = 0;
//config gpio to int mode
printk("%s: config gpio to int mode. \n", __func__);
pr_info("%s: config gpio to int mode. \n", __func__);
#ifndef SYSCONFIG_GPIO_ENABLE
#else
if(gpio_int_hdle){
gpio_release(gpio_int_hdle, 2);
}
gpio_int_hdle = gpio_request_ex(major_key, subkey);
if(!gpio_int_hdle){
printk("request tp_int_port failed. \n");
pr_info("request tp_int_port failed. \n");
ret = -1;
goto request_tp_int_port_failed;
}
gpio_get_one_pin_status(gpio_int_hdle, gpio_int_info, subkey, 1);
pr_info("%s, %d: gpio_int_info, port = %d, port_num = %d. \n", __func__, __LINE__, \
gpio_int_info[0].port, gpio_int_info[0].port_num);
#endif

#ifdef AW_GPIO_INT_API_ENABLE
#else
printk(" INTERRUPT CONFIG\n");
reg_num = ext_int_num%8;
reg_addr = ext_int_num/8;
pr_info(" INTERRUPT CONFIG\n");
reg_num = (gpio_int_info[0].port_num)%8;
reg_addr = (gpio_int_info[0].port_num)/8;
reg_val = readl(gpio_addr + int_cfg_addr[reg_addr]);
reg_val &= (~(7 << (reg_num * 4)));
reg_val |= (int_mode << (reg_num * 4));
Expand All @@ -223,7 +227,7 @@ static int ctp_set_irq_mode(char *major_key , char *subkey, int ext_int_num, ext
ctp_clear_penirq();

reg_val = readl(gpio_addr+PIO_INT_CTRL_OFFSET);
reg_val |= (1 << ext_int_num);
reg_val |= (1 << (gpio_int_info[0].port_num));
writel(reg_val,gpio_addr+PIO_INT_CTRL_OFFSET);

udelay(1);
Expand Down Expand Up @@ -483,7 +487,7 @@ static void ctp_wakeup(void)
* = 0; success;
* < 0; err
*/
static int ctp_detect(struct i2c_client *client, struct i2c_board_info *info)
int ctp_detect(struct i2c_client *client, struct i2c_board_info *info)
{
struct i2c_adapter *adapter = client->adapter;

Expand Down Expand Up @@ -931,10 +935,10 @@ static irqreturn_t goodix_ts_irq_handler(int irq, void *dev_id)
//clear the IRQ_EINT21 interrupt pending
reg_val = readl(gpio_addr + PIO_INT_STAT_OFFSET);

if(reg_val&(1<<(IRQ_EINT21)))
if(reg_val&(1<<(CTP_IRQ_NO)))
{
print_int_info("==IRQ_EINT21=\n");
writel(reg_val&(1<<(IRQ_EINT21)),gpio_addr + PIO_INT_STAT_OFFSET);
print_int_info("==CTP_IRQ_NO=\n");
writel(reg_val&(1<<(CTP_IRQ_NO)),gpio_addr + PIO_INT_STAT_OFFSET);
queue_work(goodix_wq, &ts->work);
}
else
Expand Down Expand Up @@ -1108,7 +1112,7 @@ static int goodix_ts_probe(struct i2c_client *client, const struct i2c_device_id
register_early_suspend(&ts->early_suspend);
#endif

err = ctp_ops.set_irq_mode("ctp_para", "ctp_int_port", CTP_IRQ_NO, CTP_IRQ_MODE);
err = ctp_ops.set_irq_mode("ctp_para", "ctp_int_port",CTP_IRQ_MODE);
if(0 != err){
printk("%s:ctp_ops.set_irq_mode err. \n", __func__);
goto exit_set_irq_mode;
Expand Down
Loading

0 comments on commit 9fd591f

Please sign in to comment.