[PATCH 1/2] Added config option to disable multitouch for ft5x touchscreen and fix to honor XY Swap setting

482 views
Skip to first unread message

Neal Peacock

unread,
Sep 21, 2012, 8:50:57 PM9/21/12
to linux...@googlegroups.com, Neal Peacock
---
drivers/input/touchscreen/Kconfig | 11 +++++++++++
drivers/input/touchscreen/ft5x_ts.c | 11 +++++++++++
drivers/input/touchscreen/ft5x_ts.h | 4 ++++
3 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 42439a9..da003c7 100755
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -747,6 +747,17 @@ config TOUCHSCREEN_FT5X_TS
help
byd0x7ets touchscreen driver

+config TOUCHSCREEN_FT5X_TS_MULTI
+ bool "Use multi-touch with the FT5X touch screen driver"
+ depends on TOUCHSCREEN_FT5X_TS
+ default n
+ help
+
+ If building for Android, this is needed to enable multitouch. If
+ building for any other system, this disables touch function.
+
+ If unsure, say N.
+
config TOUCHSCREEN_ZT8031
tristate "ZT8031 touchscreen driver"
help
diff --git a/drivers/input/touchscreen/ft5x_ts.c b/drivers/input/touchscreen/ft5x_ts.c
index d73926b..81f054b 100644
--- a/drivers/input/touchscreen/ft5x_ts.c
+++ b/drivers/input/touchscreen/ft5x_ts.c
@@ -1374,6 +1374,17 @@ static int ft5x_read_data(void)
event->x1 = (s16)(buf[3] & 0x0F)<<8 | (s16)buf[4];
event->y1 = (s16)(buf[5] & 0x0F)<<8 | (s16)buf[6];
}
+
+ if(1 == revert_x_flag){
+ event->x1 = SCREEN_MAX_X - event->x1;
+ }
+ if(1 == revert_y_flag){
+ event->y1 = SCREEN_MAX_Y - event->y1;
+ }
+ //pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);
+ if(1 == exchange_x_y_flag){
+ swap(event->x1, event->y1);
+ }
#endif
event->pressure = 200;

diff --git a/drivers/input/touchscreen/ft5x_ts.h b/drivers/input/touchscreen/ft5x_ts.h
index 80f3cf4..a368127 100755
--- a/drivers/input/touchscreen/ft5x_ts.h
+++ b/drivers/input/touchscreen/ft5x_ts.h
@@ -24,7 +24,11 @@
#define __LINUX_FT5X_TS_H__

// gpio base address
+#ifndef TOUCHSCREEN_FT5X_TS_MULTI
+#undef CONFIG_FT5X0X_MULTITOUCH
+#else
#define CONFIG_FT5X0X_MULTITOUCH (1)
+#endif
#define CALIBRATION (1)
#define UPGRADE (5)
//#define CALIBRATION _IO(CALIBRATION_FLAG,0)
--
1.7.5.4

Neal Peacock

unread,
Sep 21, 2012, 8:50:58 PM9/21/12
to linux...@googlegroups.com, Neal Peacock
---
drivers/input/touchscreen/ft5x_ts.c | 240 +++++++++++++++++-----------------
drivers/input/touchscreen/ft5x_ts.h | 14 +-
2 files changed, 127 insertions(+), 127 deletions(-)

diff --git a/drivers/input/touchscreen/ft5x_ts.c b/drivers/input/touchscreen/ft5x_ts.c
index 81f054b..33d533c 100644
--- a/drivers/input/touchscreen/ft5x_ts.c
+++ b/drivers/input/touchscreen/ft5x_ts.c
@@ -49,14 +49,14 @@
#include "ctp_platform_ops.h"

#define FOR_TSLIB_TEST
-//#define PRINT_INT_INFO
-//#define PRINT_POINT_INFO
-//#define DEBUG
-//#define TOUCH_KEY_SUPPORT
+/*#define PRINT_INT_INFO */
+/*#define PRINT_POINT_INFO */
+/*#define DEBUG */
+/*#define TOUCH_KEY_SUPPORT */
#ifdef TOUCH_KEY_SUPPORT
-//#define TOUCH_KEY_LIGHT_SUPPORT
-//#define TOUCH_KEY_FOR_EVB13
-//#define TOUCH_KEY_FOR_ANGDA
+/*#define TOUCH_KEY_LIGHT_SUPPORT */
+/*#define TOUCH_KEY_FOR_EVB13 */
+/*#define TOUCH_KEY_FOR_ANGDA */
#ifdef TOUCH_KEY_FOR_ANGDA
#define TOUCH_KEY_X_LIMIT (60000)
#define TOUCH_KEY_NUMBER (4)
@@ -68,7 +68,7 @@
#endif
#endif

-//#define CONFIG_SUPPORT_FTS_CTP_UPG
+/*#define CONFIG_SUPPORT_FTS_CTP_UPG */

struct i2c_dev{
struct list_head list;
@@ -80,7 +80,7 @@ static struct class *i2c_dev_class;
static LIST_HEAD (i2c_dev_list);
static DEFINE_SPINLOCK(i2c_dev_list_lock);

-#define FT5X_NAME "ft5x_ts"//"synaptics_i2c_rmi"//"synaptics-rmi-ts"//
+#define FT5X_NAME "ft5x_ts"/*"synaptics_i2c_rmi"//"synaptics-rmi-ts"// */

static struct i2c_client *this_client;
#ifdef TOUCH_KEY_LIGHT_SUPPORT
@@ -97,7 +97,7 @@ static int key_val = 0;
pr_info(fmt, ##args); \
}while(0)
#else
-#define print_point_info(fmt, args...) //
+#define print_point_info(fmt, args...) /* */
#endif

#ifdef PRINT_INT_INFO
@@ -106,10 +106,10 @@ static int key_val = 0;
pr_info(fmt, ##args); \
}while(0)
#else
-#define print_int_info(fmt, args...) //
+#define print_int_info(fmt, args...) /* */
#endif
-///////////////////////////////////////////////
-//specific tp related macro: need be configured for specific tp
+/*///////////////////////////////////////////// */
+/*specific tp related macro: need be configured for specific tp */
#ifdef CONFIG_ARCH_SUN4I
#define CTP_IRQ_NO (IRQ_EINT21)
#elif defined(CONFIG_ARCH_SUN5I)
@@ -163,13 +163,13 @@ static int ctp_get_pendown_state(void)
unsigned int reg_val;
static int state = FREE_UP;

- //get the input port state
+ /*get the input port state */
reg_val = readl(gpio_addr + PIOH_DATA);
- //pr_info("reg_val = %x\n",reg_val);
+ /*pr_info("reg_val = %x\n",reg_val); */
if(!(reg_val & (1<<CTP_IRQ_NO))){
state = PRESS_DOWN;
print_int_info("pen down. \n");
- }else{ //touch panel is free up
+ }else{ /*touch panel is free up */
state = FREE_UP;
print_int_info("free up. \n");
}
@@ -183,11 +183,11 @@ static int ctp_get_pendown_state(void)
static void ctp_clear_penirq(void)
{
int reg_val;
- //clear the IRQ_EINT29 interrupt pending
- //pr_info("clear pend irq pending\n");
+ /*clear the IRQ_EINT29 interrupt pending */
+ /*pr_info("clear pend irq pending\n"); */
reg_val = readl(gpio_addr + PIO_INT_STAT_OFFSET);
- //writel(reg_val,gpio_addr + PIO_INT_STAT_OFFSET);
- //writel(reg_val&(1<<(IRQ_EINT21)),gpio_addr + PIO_INT_STAT_OFFSET);
+ /*writel(reg_val,gpio_addr + PIO_INT_STAT_OFFSET); */
+ /*writel(reg_val&(1<<(IRQ_EINT21)),gpio_addr + PIO_INT_STAT_OFFSET); */
if((reg_val = (reg_val&(1<<(CTP_IRQ_NO))))){
print_int_info("==CTP_IRQ_NO=\n");
writel(reg_val,gpio_addr + PIO_INT_STAT_OFFSET);
@@ -208,7 +208,7 @@ static int ctp_set_irq_mode(char *major_key , char *subkey, int ext_int_num, ext
__u32 reg_num = 0;
__u32 reg_addr = 0;
__u32 reg_val = 0;
- //config gpio to int mode
+ /*config gpio to int mode */
pr_info("%s: config gpio to int mode. \n", __func__);
#ifndef SYSCONFIG_GPIO_ENABLE
#else
@@ -255,9 +255,9 @@ request_tp_int_port_failed:
*/
static int ctp_set_gpio_mode(void)
{
- //int reg_val;
+ /*int reg_val; */
int ret = 0;
- //config gpio to io mode
+ /*config gpio to io mode */
pr_info("%s: config gpio to io mode. \n", __func__);
#ifndef SYSCONFIG_GPIO_ENABLE
#else
@@ -286,7 +286,7 @@ request_tp_io_port_failed:
*/
static int ctp_judge_int_occur(void)
{
- //int reg_val[3];
+ /*int reg_val[3]; */
int reg_val;
int ret = -1;

@@ -334,12 +334,12 @@ static int ctp_init_platform_resource(void)
int ret = 0;

gpio_addr = ioremap(PIO_BASE_ADDRESS, PIO_RANGE_SIZE);
- //pr_info("%s, gpio_addr = 0x%x. \n", __func__, gpio_addr);
+ /*pr_info("%s, gpio_addr = 0x%x. \n", __func__, gpio_addr); */
if(!gpio_addr) {
ret = -EIO;
goto exit_ioremap_failed;
}
- // gpio_wakeup_enable = 1;
+ /* gpio_wakeup_enable = 1; */
gpio_wakeup_hdle = gpio_request_ex("ctp_para", "ctp_wakeup");
if(!gpio_wakeup_hdle) {
pr_warning("%s: tp_wakeup request gpio fail!\n", __func__);
@@ -372,7 +372,7 @@ static int ctp_fetch_sysconfig_para(void)
int ctp_used = -1;
char name[I2C_NAME_SIZE];
__u32 twi_addr = 0;
- //__u32 twi_id = 0;
+ /*__u32 twi_id = 0; */
script_parser_value_type_t type = SCIRPT_PARSER_VALUE_TYPE_STRING;

pr_info("%s. \n", __func__);
@@ -383,7 +383,7 @@ static int ctp_fetch_sysconfig_para(void)
}
if(1 != ctp_used){
pr_err("%s: ctp_unused. \n", __func__);
- //ret = 1;
+ /*ret = 1; */
return ret;
}

@@ -394,7 +394,7 @@ static int ctp_fetch_sysconfig_para(void)
if(strcmp(CTP_NAME, name)){
pr_err("%s: name %s does not match CTP_NAME. \n", __func__, name);
pr_err(CTP_NAME);
- //ret = 1;
+ /*ret = 1; */
return ret;
}

@@ -402,12 +402,12 @@ static int ctp_fetch_sysconfig_para(void)
pr_err("%s: script_parser_fetch err. \n", name);
goto script_parser_fetch_err;
}
- //big-endian or small-endian?
- //pr_info("%s: before: ctp_twi_addr is 0x%x, dirty_addr_buf: 0x%hx. dirty_addr_buf[1]: 0x%hx \n", __func__, twi_addr, u_i2c_addr.dirty_addr_buf[0], u_i2c_addr.dirty_addr_buf[1]);
+ /*big-endian or small-endian? */
+ /*pr_info("%s: before: ctp_twi_addr is 0x%x, dirty_addr_buf: 0x%hx. dirty_addr_buf[1]: 0x%hx \n", __func__, twi_addr, u_i2c_addr.dirty_addr_buf[0], u_i2c_addr.dirty_addr_buf[1]); */
u_i2c_addr.dirty_addr_buf[0] = twi_addr;
u_i2c_addr.dirty_addr_buf[1] = I2C_CLIENT_END;
pr_info("%s: after: ctp_twi_addr is 0x%x, dirty_addr_buf: 0x%hx. dirty_addr_buf[1]: 0x%hx \n", __func__, twi_addr, u_i2c_addr.dirty_addr_buf[0], u_i2c_addr.dirty_addr_buf[1]);
- //pr_info("%s: after: ctp_twi_addr is 0x%x, u32_dirty_addr_buf: 0x%hx. u32_dirty_addr_buf[1]: 0x%hx \n", __func__, twi_addr, u32_dirty_addr_buf[0],u32_dirty_addr_buf[1]);
+ /*pr_info("%s: after: ctp_twi_addr is 0x%x, u32_dirty_addr_buf: 0x%hx. u32_dirty_addr_buf[1]: 0x%hx \n", __func__, twi_addr, u32_dirty_addr_buf[0],u32_dirty_addr_buf[1]); */

if(SCRIPT_PARSER_OK != script_parser_fetch("ctp_para", "ctp_twi_id", &twi_id, sizeof(twi_id)/sizeof(__u32))){
pr_err("%s: script_parser_fetch err. \n", name);
@@ -512,7 +512,7 @@ static int ctp_detect(struct i2c_client *client, struct i2c_board_info *info)
return -ENODEV;
}
}
-////////////////////////////////////////////////////////////////
+/*////////////////////////////////////////////////////////////// */

static struct ctp_platform_ops ctp_ops = {
.get_pendown_state = ctp_get_pendown_state,
@@ -625,10 +625,10 @@ typedef enum
ERR_DL_VERIFY_FAIL
}E_UPGRADE_ERR_TYPE;

-typedef unsigned char FTS_BYTE; //8 bit
-typedef unsigned short FTS_WORD; //16 bit
-typedef unsigned int FTS_DWRD; //16 bit
-typedef unsigned char FTS_BOOL; //8 bit
+typedef unsigned char FTS_BYTE; /*8 bit */
+typedef unsigned short FTS_WORD; /*16 bit */
+typedef unsigned int FTS_DWRD; /*16 bit */
+typedef unsigned char FTS_BOOL; /*8 bit */

#define FTS_NULL 0x0
#define FTS_TRUE 0x01
@@ -638,7 +638,7 @@ typedef unsigned char FTS_BOOL; //8 bit

void delay_ms(FTS_WORD w_ms)
{
- //platform related, please implement this function
+ /*platform related, please implement this function */
msleep( w_ms );
}

@@ -715,13 +715,13 @@ u8 fts_register_read(u8 e_reg_name, u8* pbt_buf, u8 bt_len)
cmd_len = 1;

/*call the write callback function*/
- // if(!i2c_write_interface(I2C_CTPM_ADDRESS, &read_cmd, cmd_len))
- // {
- // return FTS_FALSE;
- // }
+ /* if(!i2c_write_interface(I2C_CTPM_ADDRESS, &read_cmd, cmd_len)) */
+ /* { */
+ /* return FTS_FALSE; */
+ /* } */


- if(!i2c_write_interface(I2C_CTPM_ADDRESS, read_cmd, cmd_len)) {//change by zhengdixu
+ if(!i2c_write_interface(I2C_CTPM_ADDRESS, read_cmd, cmd_len)) {/*change by zhengdixu */
return FTS_FALSE;
}

@@ -750,8 +750,8 @@ int fts_register_write(u8 e_reg_name, u8 bt_value)
write_cmd[1] = bt_value;

/*call the write callback function*/
- //return i2c_write_interface(I2C_CTPM_ADDRESS, &write_cmd, 2);
- return i2c_write_interface(I2C_CTPM_ADDRESS, write_cmd, 2); //change by zhengdixu
+ /*return i2c_write_interface(I2C_CTPM_ADDRESS, &write_cmd, 2); */
+ return i2c_write_interface(I2C_CTPM_ADDRESS, write_cmd, 2); /*change by zhengdixu */
}

/*
@@ -775,8 +775,8 @@ int cmd_write(u8 btcmd,u8 btPara1,u8 btPara2,u8 btPara3,u8 num)
write_cmd[1] = btPara1;
write_cmd[2] = btPara2;
write_cmd[3] = btPara3;
- //return i2c_write_interface(I2C_CTPM_ADDRESS, &write_cmd, num);
- return i2c_write_interface(I2C_CTPM_ADDRESS, write_cmd, num);//change by zhengdixu
+ /*return i2c_write_interface(I2C_CTPM_ADDRESS, &write_cmd, num); */
+ return i2c_write_interface(I2C_CTPM_ADDRESS, write_cmd, num);/*change by zhengdixu */
}

/*
@@ -807,7 +807,7 @@ int byte_write(u8* pbt_buf, u16 dw_len)
int byte_read(u8* pbt_buf, u8 bt_len)
{
return i2c_read_interface(I2C_CTPM_ADDRESS, pbt_buf, bt_len);
- //ft5x_i2c_rxdata
+ /*ft5x_i2c_rxdata */
}


@@ -828,7 +828,7 @@ int byte_read(u8* pbt_buf, u8 bt_len)
*/


-#define FTS_PACKET_LENGTH 128 //2//4//8//16//32//64//128//256
+#define FTS_PACKET_LENGTH 128 /*2//4//8//16//32//64//128//256 */

static unsigned char CTPM_FW[]=
{
@@ -844,8 +844,8 @@ unsigned char fts_ctpm_get_i_file_ver(void)
}
else
{
- //TBD, error handling?
- return 0xff; //default value
+ /*TBD, error handling? */
+ return 0xff; /*default value */
}
}
E_UPGRADE_ERR_TYPE fts_ctpm_fw_upgrade(u8* pbt_buf, u16 dw_lenth)
@@ -901,7 +901,7 @@ E_UPGRADE_ERR_TYPE fts_ctpm_fw_upgrade(u8* pbt_buf, u16 dw_lenth)
i++;
delay_ms(5);
pr_info("Step 3: CTPM ID,ID1 = 0x%x,ID2 = 0x%x\n",reg_val[0],reg_val[1]);
- }while(reg_val[1] != 0x03);//while(reg_val[0] != 0x79 || reg_val[1] != 0x03);
+ }while(reg_val[1] != 0x03);/*while(reg_val[0] != 0x79 || reg_val[1] != 0x03); */

/*********Step 4:erase app*******************************/
cmd_write(0x61,0x00,0x00,0x00,1);
@@ -958,7 +958,7 @@ E_UPGRADE_ERR_TYPE fts_ctpm_fw_upgrade(u8* pbt_buf, u16 dw_lenth)
delay_ms(20);
}

- //send the last six byte
+ /*send the last six byte */
for (i = 0; i<6; i++)
{
temp = 0x6ffa + i;
@@ -976,8 +976,8 @@ E_UPGRADE_ERR_TYPE fts_ctpm_fw_upgrade(u8* pbt_buf, u16 dw_lenth)

/*********Step 6: read out checksum***********************/
/*send the opration head*/
- //cmd_write(0xcc,0x00,0x00,0x00,1);//把0xcc当作寄存器地址,去读出一个字节
- // byte_read(reg_val,1);//change by zhengdixu
+ /*cmd_write(0xcc,0x00,0x00,0x00,1);//把0xcc当作寄存器地址,去读出一个字节 */
+ /* byte_read(reg_val,1);//change by zhengdixu */

fts_register_read(0xcc, reg_val,1);

@@ -1002,13 +1002,13 @@ int fts_ctpm_auto_clb(void)
pr_info("[FTS] start auto CLB.\n");
msleep(200);
fts_register_write(0, 0x40);
- delay_ms(100); //make sure already enter factory mode
- fts_register_write(2, 0x4); //write command to start calibration
+ delay_ms(100); /*make sure already enter factory mode */
+ fts_register_write(2, 0x4); /*write command to start calibration */
delay_ms(300);
for(i=0;i<100;i++)
{
fts_register_read(0,&uc_temp,1);
- if ( ((uc_temp&0x70)>>4) == 0x0) //return to normal mode, calibration finish
+ if ( ((uc_temp&0x70)>>4) == 0x0) /*return to normal mode, calibration finish */
{
break;
}
@@ -1019,11 +1019,11 @@ int fts_ctpm_auto_clb(void)
pr_info("[FTS] calibration OK.\n");

msleep(300);
- fts_register_write(0, 0x40); //goto factory mode
- delay_ms(100); //make sure already enter factory mode
- fts_register_write(2, 0x5); //store CLB result
+ fts_register_write(0, 0x40); /*goto factory mode */
+ delay_ms(100); /*make sure already enter factory mode */
+ fts_register_write(2, 0x5); /*store CLB result */
delay_ms(300);
- fts_register_write(0, 0x0); //return to normal mode
+ fts_register_write(0, 0x0); /*return to normal mode */
msleep(300);
pr_info("[FTS] store CLB result OK.\n");
return 0;
@@ -1032,7 +1032,7 @@ void getVerNo(u8* buf, int len)
{
u8 start_reg=0x0;
int ret = -1;
- //int status = 0;
+ /*int status = 0; */
int i = 0;
start_reg = 0xa6;

@@ -1072,7 +1072,7 @@ void getVerNo(u8* buf, int len)
#endif

ret =fts_register_read(0xa6, buf, len);
- //et = ft5406_read_regs(ft5x0x_ts_data_test->client,start_reg, buf, 2);
+ /*et = ft5406_read_regs(ft5x0x_ts_data_test->client,start_reg, buf, 2); */
if (ret < 0)
{
pr_info("%s read_data i2c_rxdata failed: %d\n", __func__, ret);
@@ -1093,15 +1093,15 @@ int fts_ctpm_fw_upgrade_with_i_file(void)
int i_ret = 0;
unsigned char a;
unsigned char b;
-#define BUFFER_LEN (2) //len == 2
+#define BUFFER_LEN (2) /*len == 2 */
unsigned char buf[BUFFER_LEN] = {0};

- //=========FW upgrade========================*/
+ /*=========FW upgrade========================*/
pr_info("%s. \n", __func__);

pbt_buf = CTPM_FW;
- //msleep(200);
- // cmd_write(0x07,0x00,0x00,0x00,1);
+ /*msleep(200); */
+ /* cmd_write(0x07,0x00,0x00,0x00,1); */
msleep(100);
getVerNo(buf, BUFFER_LEN);
a = buf[0];
@@ -1119,7 +1119,7 @@ int fts_ctpm_fw_upgrade_with_i_file(void)
pr_info("[FTS] upgrade failed i_ret = %d.\n", i_ret);
} else {
pr_info("[FTS] upgrade successfully.\n");
- fts_ctpm_auto_clb(); //start auto CLB
+ fts_ctpm_auto_clb(); /*start auto CLB */
}

}
@@ -1136,8 +1136,8 @@ unsigned char fts_ctpm_get_upg_ver(void)
return CTPM_FW[0];
}
else{
- //TBD, error handling?
- return 0xff; //default value
+ /*TBD, error handling? */
+ return 0xff; /*default value */
}
}

@@ -1160,7 +1160,7 @@ static int ft5x_i2c_rxdata(char *rxdata, int length)
},
};

- //pr_info("IIC add = %x\n",this_client->addr);
+ /*pr_info("IIC add = %x\n",this_client->addr); */
ret = i2c_transfer(this_client->adapter, msgs, 2);
if (ret < 0)
pr_info("msg %s i2c read error: %d\n", __func__, ret);
@@ -1181,7 +1181,7 @@ static int ft5x_i2c_txdata(char *txdata, int length)
},
};

- //msleep(1);
+ /*msleep(1); */
ret = i2c_transfer(this_client->adapter, msg, 1);
if (ret < 0)
pr_err("%s i2c write error: %d\n", __func__, ret);
@@ -1249,7 +1249,7 @@ static int ft5x_read_data(void)

memset(event, 0, sizeof(struct ts_event));

- event->touch_point = buf[2] & 0x07;// 000 0111
+ event->touch_point = buf[2] & 0x07;/* 000 0111 */
print_point_info("touch point = %d\n",event->touch_point);

if (event->touch_point == 0) {
@@ -1268,11 +1268,11 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y5 = SCREEN_MAX_Y - event->y5;
}
- //pr_info("before swap: event->x5 = %d, event->y5 = %d. \n", event->x5, event->y5);
+ /*pr_info("before swap: event->x5 = %d, event->y5 = %d. \n", event->x5, event->y5); */
if(1 == exchange_x_y_flag){
swap(event->x5, event->y5);
}
- //pr_info("after swap: event->x5 = %d, event->y5 = %d. \n", event->x5, event->y5);
+ /*pr_info("after swap: event->x5 = %d, event->y5 = %d. \n", event->x5, event->y5); */
event->touch_ID5=(s16)(buf[0x1D] & 0xF0)>>4;
case 4:
event->x4 = (s16)(buf[0x15] & 0x0F)<<8 | (s16)buf[0x16];
@@ -1283,11 +1283,11 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y4 = SCREEN_MAX_Y - event->y4;
}
- //pr_info("before swap: event->x4 = %d, event->y4 = %d. \n", event->x4, event->y4);
+ /*pr_info("before swap: event->x4 = %d, event->y4 = %d. \n", event->x4, event->y4); */
if(1 == exchange_x_y_flag){
swap(event->x4, event->y4);
}
- //pr_info("after swap: event->x4 = %d, event->y4 = %d. \n", event->x4, event->y4);
+ /*pr_info("after swap: event->x4 = %d, event->y4 = %d. \n", event->x4, event->y4); */
event->touch_ID4=(s16)(buf[0x17] & 0xF0)>>4;
case 3:
event->x3 = (s16)(buf[0x0f] & 0x0F)<<8 | (s16)buf[0x10];
@@ -1298,11 +1298,11 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y3 = SCREEN_MAX_Y - event->y3;
}
- //pr_info("before swap: event->x3 = %d, event->y3 = %d. \n", event->x3, event->y3);
+ /*pr_info("before swap: event->x3 = %d, event->y3 = %d. \n", event->x3, event->y3); */
if(1 == exchange_x_y_flag){
swap(event->x3, event->y3);
}
- //pr_info("after swap: event->x3 = %d, event->y3 = %d. \n", event->x3, event->y3);
+ /*pr_info("after swap: event->x3 = %d, event->y3 = %d. \n", event->x3, event->y3); */
event->touch_ID3=(s16)(buf[0x11] & 0xF0)>>4;
case 2:
event->x2 = (s16)(buf[9] & 0x0F)<<8 | (s16)buf[10];
@@ -1313,11 +1313,11 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y2 = SCREEN_MAX_Y - event->y2;
}
- //pr_info("before swap: event->x2 = %d, event->y2 = %d. \n", event->x2, event->y2);
+ /*pr_info("before swap: event->x2 = %d, event->y2 = %d. \n", event->x2, event->y2); */
if(1 == exchange_x_y_flag){
swap(event->x2, event->y2);
}
- //pr_info("after swap: event->x2 = %d, event->y2 = %d. \n", event->x2, event->y2);
+ /*pr_info("after swap: event->x2 = %d, event->y2 = %d. \n", event->x2, event->y2); */
event->touch_ID2=(s16)(buf[0x0b] & 0xF0)>>4;
case 1:
event->x1 = (s16)(buf[3] & 0x0F)<<8 | (s16)buf[4];
@@ -1331,7 +1331,7 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y1 = SCREEN_MAX_Y - event->y1;
}
- //pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);
+ /*pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1); */
if(1 == exchange_x_y_flag){
swap(event->x1, event->y1);
}
@@ -1345,7 +1345,7 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y1 = SCREEN_MAX_Y - event->y1;
}
- //pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);
+ /*pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1); */
if(1 == exchange_x_y_flag){
swap(event->x1, event->y1);
}
@@ -1357,13 +1357,13 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y1 = SCREEN_MAX_Y - event->y1;
}
- //pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);
+ /*pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1); */
if(1 == exchange_x_y_flag){
swap(event->x1, event->y1);
}
#endif

- //pr_info("after swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);
+ /*pr_info("after swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1); */
event->touch_ID1=(s16)(buf[0x05] & 0xF0)>>4;
break;
default:
@@ -1381,7 +1381,7 @@ static int ft5x_read_data(void)
if(1 == revert_y_flag){
event->y1 = SCREEN_MAX_Y - event->y1;
}
- //pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);
+ /* pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1); */
if(1 == exchange_x_y_flag){
swap(event->x1, event->y1);
}
@@ -1499,7 +1499,7 @@ static void ft5x_report_touchkey(void)
{
struct ft5x_ts_data *data = i2c_get_clientdata(this_client);
struct ts_event *event = &data->event;
- //print_point_info("x=%d===Y=%d\n",event->x1,event->y1);
+ /*print_point_info("x=%d===Y=%d\n",event->x1,event->y1); */

#ifdef TOUCH_KEY_FOR_ANGDA
if((1==event->touch_point)&&(event->x1 > TOUCH_KEY_X_LIMIT)){
@@ -1563,7 +1563,7 @@ static void ft5x_report_touchkey(void)
static void ft5x_report_value(void)
{

- //pr_info("==ft5x_report_value =\n");
+ /*pr_info("==ft5x_report_value =\n"); */
#ifdef TOUCH_KEY_SUPPORT
ft5x_report_touchkey();
#endif
@@ -1579,12 +1579,12 @@ static void ft5x_report_value(void)
static void ft5x_ts_pen_irq_work(struct work_struct *work)
{
int ret = -1;
- //pr_info("==work 1=\n");
+ /*pr_info("==work 1=\n"); */
ret = ft5x_read_data();
if (ret == 0) {
ft5x_report_value();
}
- //enable_irq(SW_INT_IRQNO_PIO);
+ /*enable_irq(SW_INT_IRQNO_PIO); */

}

@@ -1613,25 +1613,25 @@ static irqreturn_t ft5x_ts_interrupt(int irq, void *dev_id)

static void ft5x_ts_suspend(struct early_suspend *handler)
{
-// struct ft5x_ts_data *ts;
-// ts = container_of(handler, struct ft5x_ts_data, early_suspend);
+/* struct ft5x_ts_data *ts; */
+/* ts = container_of(handler, struct ft5x_ts_data, early_suspend); */

pr_info("==ft5x_ts_suspend=\n");
-// disable_irq(this_client->irq);
-// disable_irq(IRQ_EINT(6));
-// cancel_work_sync(&ts->pen_event_work);
-// flush_workqueue(ts->ts_workqueue);
- // ==set mode ==,
-// ft5x_set_reg(FT5X0X_REG_PMODE, PMODE_HIBERNATE);
-
- /* //gpio i28 output low
+/* disable_irq(this_client->irq); */
+/* disable_irq(IRQ_EINT(6)); */
+/* cancel_work_sync(&ts->pen_event_work); */
+/* flush_workqueue(ts->ts_workqueue); */
+ /* ==set mode ==, */
+/* ft5x_set_reg(FT5X0X_REG_PMODE, PMODE_HIBERNATE); */
+
+ /* / * gpio i28 output low * /
pr_info("==ft5x_ts_suspend=\n");
- //enter HIBERNATE mode
+ / * enter HIBERNATE mode * /
ft5x_set_reg(0x3a,PMODE_HIBERNATE);
*/
- //suspend
- //gpio_write_one_pin_value(gpio_wakeup_hdle, 0, "ctp_wakeup");
- // ==set mode ==,
+ /*suspend */
+ /*gpio_write_one_pin_value(gpio_wakeup_hdle, 0, "ctp_wakeup"); */
+ /* ==set mode ==, */
pr_info("ft5x_ts_suspend: write FT5X0X_REG_PMODE .\n");
ft5x_set_reg(FT5X0X_REG_PMODE, PMODE_HIBERNATE);
}
@@ -1639,12 +1639,12 @@ static void ft5x_ts_suspend(struct early_suspend *handler)
static void ft5x_ts_resume(struct early_suspend *handler)
{
pr_info("==ft5x_ts_resume== \n");
- //reset
+ /*reset */
ctp_ops.ts_reset();
- //wakeup
+ /*wakeup */
ctp_ops.ts_wakeup();
}
-#endif //CONFIG_HAS_EARLYSUSPEND
+#endif /*CONFIG_HAS_EARLYSUSPEND */

static int
ft5x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
@@ -1672,12 +1672,12 @@ ft5x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
goto exit_alloc_data_failed;
}

- //pr_info("touch panel gpio addr: = 0x%x", gpio_addr);
+ /*pr_info("touch panel gpio addr: = 0x%x", gpio_addr); */
this_client = client;

- //pr_info("ft5x_ts_probe : client->addr = %d. \n", client->addr);
+ /*pr_info("ft5x_ts_probe : client->addr = %d. \n", client->addr); */
this_client->addr = client->addr;
- //pr_info("ft5x_ts_probe : client->addr = %d. \n", client->addr);
+ /*pr_info("ft5x_ts_probe : client->addr = %d. \n", client->addr); */
i2c_set_clientdata(client, ft5x_ts);

#ifdef TOUCH_KEY_LIGHT_SUPPORT
@@ -1689,7 +1689,7 @@ ft5x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
#endif


-// pr_info("==INIT_WORK=\n");
+/* pr_info("==INIT_WORK=\n"); */
INIT_WORK(&ft5x_ts->pen_event_work, ft5x_ts_pen_irq_work);
ft5x_ts->ts_workqueue = create_singlethread_workqueue(dev_name(&client->dev));
if (!ft5x_ts->ts_workqueue) {
@@ -1744,7 +1744,7 @@ ft5x_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
set_bit(EV_ABS, input_dev->evbit);
set_bit(EV_KEY, input_dev->evbit);

- input_dev->name = CTP_NAME; //dev_name(&client->dev)
+ input_dev->name = CTP_NAME; /*dev_name(&client->dev) */
err = input_register_device(input_dev);
if (err) {
dev_err(&client->dev,
@@ -1871,7 +1871,7 @@ static int aw_open(struct inode *inode, struct file *file)
pr_info("subminor=%d\n",subminor);
#endif

- //lock_kernel();
+ /*lock_kernel(); */
i2c_dev = i2c_dev_get_by_minor(2);
if (!i2c_dev) {
pr_info("error i2c_dev\n");
@@ -1899,7 +1899,7 @@ static int aw_open(struct inode *inode, struct file *file)

static long aw_ioctl(struct file *file, unsigned int cmd,unsigned long arg )
{
- //struct i2c_client *client = (struct i2c_client *) file->private_data;
+ /*struct i2c_client *client = (struct i2c_client *) file->private_data; */

pr_info("====%s====.\n",__func__);

@@ -1911,7 +1911,7 @@ static long aw_ioctl(struct file *file, unsigned int cmd,unsigned long arg )
case UPGRADE:
pr_info("==UPGRADE_WORK=\n");
fts_ctpm_fw_upgrade_with_i_file();
- // calibrate();
+ /* calibrate(); */

break;

@@ -1938,8 +1938,8 @@ static int aw_release (struct inode *inode, struct file *file)

static const struct file_operations aw_i2c_ts_fops ={
.owner = THIS_MODULE,
- //.read = aw_read,
- //.write = aw_write,
+ /*.read = aw_read, */
+ /*.write = aw_write, */
.open = aw_open,
.unlocked_ioctl = aw_ioctl,
.release = aw_release,
@@ -1967,9 +1967,9 @@ static int __init ft5x_ts_init(void)
pr_info("%s:ctp_ops.init_platform_resource err. \n", __func__);
}

- //reset
+ /*reset */
ctp_ops.ts_reset();
- //wakeup
+ /*wakeup */
ctp_ops.ts_wakeup();

ft5x_ts_driver.detect = ctp_ops.ts_detect;
diff --git a/drivers/input/touchscreen/ft5x_ts.h b/drivers/input/touchscreen/ft5x_ts.h
index a368127..43a3041 100755
--- a/drivers/input/touchscreen/ft5x_ts.h
+++ b/drivers/input/touchscreen/ft5x_ts.h
@@ -23,7 +23,7 @@
#ifndef __LINUX_FT5X_TS_H__
#define __LINUX_FT5X_TS_H__

-// gpio base address
+/* gpio base address */
#ifndef TOUCHSCREEN_FT5X_TS_MULTI
#undef CONFIG_FT5X0X_MULTITOUCH
#else
@@ -31,19 +31,19 @@
#endif
#define CALIBRATION (1)
#define UPGRADE (5)
-//#define CALIBRATION _IO(CALIBRATION_FLAG,0)
-//#define UPDRAGE _IO(UPDRAGE_FLAG,0)
+/*#define CALIBRATION _IO(CALIBRATION_FLAG,0) */
+/*#define UPDRAGE _IO(UPDRAGE_FLAG,0) */
#define I2C_MINORS 256
#define I2C_MAJOR 125

#undef AW_GPIO_INT_API_ENABLE
-//#define AW_FPGA_SIM
+/*#define AW_FPGA_SIM */
#ifdef AW_FPGA_SIM
#endif

#define AW_GPIO_API_ENABLE
-//#undef CONFIG_HAS_EARLYSUSPEND
-//#define CONFIG_HAS_EARLYSUSPEND
+/*#undef CONFIG_HAS_EARLYSUSPEND */
+/*#define CONFIG_HAS_EARLYSUSPEND */
struct ft5x_ts_platform_data{
u16 intr; /* irq number */
};
@@ -52,7 +52,7 @@ enum ft5x_ts_regs {
FT5X0X_REG_PMODE = 0xA5, /* Power Consume Mode */
};

-//FT5X0X_REG_PMODE
+/*FT5X0X_REG_PMODE */
#define PMODE_ACTIVE 0x00
#define PMODE_MONITOR 0x01
#define PMODE_STANDBY 0x02
--
1.7.5.4

Aliaksei Katovich

unread,
Sep 22, 2012, 3:57:26 AM9/22/12
to linux...@googlegroups.com, Neal Peacock
hi Neal;

thanks for your patch!

Since I cannot give technical review for this particular patch let me
whimper about cosmetics here ;)

Keep subject line short but informative, so one can easily detect
which subsystem is affected, e.g.:

touchscreen: disable multitouch for ft5x

Longer description should go in to commit message where you explain what
is done and why.

Also, if you feel that changes are independent on each other try to
split patch into even smaller chunks to ease troubleshooting if any.

Some other cosmetic comments are inlined.
Extra space is needed around parentheses.

> + event->x1 = SCREEN_MAX_X - event->x1;
> + }
> + if(1 == revert_y_flag){

Same here.

> + event->y1 = SCREEN_MAX_Y - event->y1;
> + }
> + //pr_info("before swap: event->x1 = %d, event->y1 = %d. \n", event->x1, event->y1);

Please avoid using C++ comments.

> + if(1 == exchange_x_y_flag){

Space here.

> + swap(event->x1, event->y1);
> + }

Curly brackets are not obligatory for one line if statement.

> #endif
> event->pressure = 200;
>
> diff --git a/drivers/input/touchscreen/ft5x_ts.h b/drivers/input/touchscreen/ft5x_ts.h
> index 80f3cf4..a368127 100755
> --- a/drivers/input/touchscreen/ft5x_ts.h
> +++ b/drivers/input/touchscreen/ft5x_ts.h
> @@ -24,7 +24,11 @@
> #define __LINUX_FT5X_TS_H__
>
> // gpio base address
> +#ifndef TOUCHSCREEN_FT5X_TS_MULTI
> +#undef CONFIG_FT5X0X_MULTITOUCH
> +#else
> #define CONFIG_FT5X0X_MULTITOUCH (1)
> +#endif
> #define CALIBRATION (1)
> #define UPGRADE (5)
> //#define CALIBRATION _IO(CALIBRATION_FLAG,0)
> --

In general it is always a good idea to run patch through
./scripts/checkpatch.pl before sending it for review.

--
Aliaksei

> 1.7.5.4
>
> --
>
>

Alejandro Mery

unread,
Sep 22, 2012, 6:22:10 AM9/22/12
to linux...@googlegroups.com, Neal Peacock
Hi,

On 22 September 2012 02:50, Neal Peacock <kuliman...@gmail.com> wrote:
> ---
> drivers/input/touchscreen/ft5x_ts.c | 240 +++++++++++++++++-----------------
> drivers/input/touchscreen/ft5x_ts.h | 14 +-
> 2 files changed, 127 insertions(+), 127 deletions(-)

even if nothing in this commit is intrinsically wrong I believe many
of those should be #if 0 .. #endif instead of /* */ and the commented
out pr_info() should be turned into pr_debug() instead

also, please try to add some commit text too :-)

Neal Peacock

unread,
Jan 2, 2013, 9:15:05 AM1/2/13
to linux...@googlegroups.com
So it sounds like you haven't installed the patch? If so you probably
just need to modify your script.bin to put in the XY swap

http://linux-sunxi.org/Fex_Guide#9._capacitive_screen_.28capacitor_tp.29

revert_x_flag and revert_y_flag.

On 01/01/2013 07:58 AM, alin...@gmail.com wrote:
> hi ---
> i am using A10 ---800*480----- momo9 (tablet)....touch screen is reversed...when i touch top left corner --click happens to right down corner.vice versa.
>
> plz help me...tell me simple way to solve this isssue...as i am medical doctor....dont have much knowledge....it usses ft5x driver....but i dnt knw how to install ...plz help me....waiting for ur help
>
> Ali
>

venkat

unread,
Sep 12, 2013, 3:48:25 AM9/12/13
to linux...@googlegroups.com
Hi npeacock,
           
I applied patch and its working fine , but the coordinate are away from touch,
if i touch (1,1)  it is senceing in (45,40) this values are not correct the behaviour i am explaining
please tell me  the way to sort this problem
and multi touch is also not working only single touch is working


thanks
venkat
Reply all
Reply to author
Forward
0 new messages