newton: add goodix tp support and support goodix and focal detect

1. add goodix touchscreen support
2. modify focal touchscreen driver to support goodix and focal detect
This commit is contained in:
jyk
2011-07-06 20:02:37 +08:00
parent 5cec02a6d5
commit f6f7748176
7 changed files with 2156 additions and 9 deletions

View File

@@ -571,7 +571,7 @@ struct platform_device rk29_device_newton = {
}
};
#endif
#if defined (CONFIG_TOUCHSCREEN_FT5406)
#if defined (CONFIG_TOUCHSCREEN_FT5406)|| defined (CONFIG_TOUCHSCREEN_GOODIX_NEWTON)
#define TOUCH_RESET_PIN RK29_PIN6_PC3
#define TOUCH_INT_PIN RK29_PIN0_PA2
@@ -621,7 +621,9 @@ int ft5406_init_platform_hw(void)
return 0;
}
#endif
#if defined (CONFIG_TOUCHSCREEN_FT5406)
struct ft5406_platform_data ft5406_info = {
@@ -630,6 +632,15 @@ struct ft5406_platform_data ft5406_info = {
};
#endif
#if defined(CONFIG_TOUCHSCREEN_GOODIX_NEWTON)
struct goodix_platform_data goodix_info = {
.init_platform_hw= ft5406_init_platform_hw,
};
#endif
#if defined (CONFIG_SND_SOC_CS42L52)
void cs42l52_init_platform_hw()
@@ -951,12 +962,26 @@ static struct i2c_board_info __initdata board_i2c2_devices[] = {
.platform_data = &eeti_egalax_info,
},
#endif
#if defined (CONFIG_TOUCHSCREEN_GOODIX_NEWTON)
{
.type = "Goodix-TS",
.addr = 0x55,
.flags =0,
//.irq =RK29_PIN0_PA2,
.platform_data = &goodix_info,
},
#endif
#if defined (CONFIG_TOUCHSCREEN_FT5406)
{
.type ="ft5x0x_ts",
.addr = 0x38, //0x70,
.flags =0,
.irq =RK29_PIN0_PA2,
//.irq =RK29_PIN0_PA2, // support goodix tp detect, 20110706
.platform_data = &ft5406_info,
},
//added by koffu

View File

@@ -229,6 +229,14 @@ struct ft5406_platform_data {
void (*exit_platform_hw)(void);
};
struct goodix_platform_data {
int (*get_pendown_state)(void);
int (*init_platform_hw)(void);
int (*ft5406_platform_sleep)(void);
int (*ft5406_platform_wakeup)(void);
void (*exit_platform_hw)(void);
};
struct cs42l52_platform_data {
int (*get_pendown_state)(void);
int (*init_platform_hw)(void);

View File

@@ -758,6 +758,9 @@ config TOUCHSCREEN_GT818_IIC
config D70_L3188A
tristate "D70-L3188A based touchscreens"
depends on I2C2_RK29
config TOUCHSCREEN_GOODIX_NEWTON
tristate "GOODIX based touchscreens"
depends on I2C2_RK29
config TOUCHSCREEN_FT5406
tristate "FT5406 based touchscreens: FT5406 Interface"
depends on I2C2_RK29

View File

@@ -58,4 +58,4 @@ obj-$(CONFIG_TOUCHSCREEN_GT818_IIC) += gt818_ts.o
obj-$(CONFIG_TOUCHSCREEN_ILI2102_IIC) += ili2102_ts.o
obj-$(CONFIG_D70_L3188A) += goodix_touch.o
obj-$(CONFIG_TOUCHSCREEN_FT5406) += ft5406_ts.o
obj-$(CONFIG_TOUCHSCREEN_GOODIX_NEWTON) += goodix_touch_newton.o

View File

@@ -495,8 +495,8 @@ static void ft5x0x_report_value(struct ft5x0x_ts_data *data )
input_report_abs(data->input_dev, ABS_Y, event->y1);
input_report_abs(data->input_dev, ABS_PRESSURE, event->pressure);
//}
printk("x = %d,y = %d\n",event->x1,event->y1);
//input_report_key(data->input_dev, BTN_TOUCH, 1);
//printk("x = %d,y = %d\n",event->x1,event->y1);
input_report_key(data->input_dev, BTN_TOUCH, 1);
#endif /* CONFIG_FT5X0X_MULTITOUCH*/
input_sync(data->input_dev);
@@ -1081,8 +1081,10 @@ static int ft5406_probe(struct i2c_client *client ,const struct i2c_device_id *
int err = 0;
int ret = 0;
int retry = 0;
u8 buf_w[1];
u8 buf_r[1];
const u8 buf_test[1] = {0};
unsigned char reg_value;
unsigned char reg_version;
@@ -1092,7 +1094,10 @@ static int ft5406_probe(struct i2c_client *client ,const struct i2c_device_id *
if (!pdata) {
dev_err(&client->dev, "platform data is required!\n");
return -EINVAL;
}
}
if (pdata->init_platform_hw)
pdata->init_platform_hw();
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -EIO;
@@ -1146,6 +1151,18 @@ static int ft5406_probe(struct i2c_client *client ,const struct i2c_device_id *
}
this_client = client;
while(retry < 5)
{
ret=ft5406_set_regs(this_client,FT5X0X_REG_PMODE, buf_test,1);
if(ret > 0)break;
retry++;
}
if(ret <= 0)
{
printk("FT5406 I2C TEST ERROR!\n");
goto exit_err_i2c_test;
}
ft5x0x_ts->client = client;
ft5x0x_ts->irq = client->irq;
ft5x0x_ts->input_dev = input_dev;
@@ -1196,9 +1213,8 @@ static int ft5406_probe(struct i2c_client *client ,const struct i2c_device_id *
}
// printk("==probe over =\n");
if (pdata->init_platform_hw)
pdata->init_platform_hw();
ft5x0x_ts->irq = RK29_PIN0_PA2;
if (!ft5x0x_ts->irq) {
dev_dbg(&ft5x0x_ts->client->dev, "no IRQ?\n");
return -ENODEV;
@@ -1254,7 +1270,6 @@ static int ft5406_probe(struct i2c_client *client ,const struct i2c_device_id *
//printk("client->dev.driver->name %s ,%d \n",client->dev.driver->name,ft5x0x_ts->irq);
ret = request_irq(ft5x0x_ts->irq, ft5x0x_ts_interrupt, /*IRQF_TRIGGER_LOW*/IRQF_TRIGGER_FALLING, //IRQF_DISABLED|IRQF_TRIGGER_FALLING,
client->dev.driver->name, ft5x0x_ts);
@@ -1308,6 +1323,7 @@ exit_platform_data_null:
cancel_work_sync(&ft5x0x_ts->pen_event_work);
destroy_workqueue(ft5x0x_ts->ts_workqueue);
exit_create_singlethread:
exit_err_i2c_test:
printk("==singlethread error =\n");
kfree(ft5x0x_ts);
exit_alloc_data_failed:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,190 @@
/*
* include/linux/goodix_touch.h
*
* Copyright (C) 2010 - 2011 Goodix, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
*/
#ifndef _LINUX_GOODIX_TOUCH_H
#define _LINUX_GOODIX_TOUCH_H
#include <linux/earlysuspend.h>
#include <linux/hrtimer.h>
#include <linux/i2c.h>
#include <linux/input.h>
//*************************TouchScreen Work Part*****************************
#define GOODIX_I2C_NAME "Goodix-TS"
//define default resolution of the touchscreen
#define TOUCH_MAX_HEIGHT 4096
#define TOUCH_MAX_WIDTH 4096
#define INT_PORT RK29_PIN0_PA2// S3C64XX_GPN(15) //Int IO port S3C64XX_GPL(10)
#ifdef INT_PORT
#define TS_INT gpio_to_irq(INT_PORT) //Interrupt Number,EINT18(119)
#define INT_CFG S3C_GPIO_SFN(3) //IO configer as EINT
#else
#define TS_INT 0
#endif
//whether need send cfg?
//#define DRIVER_SEND_CFG
//set trigger mode
#define INT_TRIGGER 0
#define POLL_TIME 10 //actual query spacing interval:POLL_TIME+6
#define GOODIX_MULTI_TOUCH
#ifdef GOODIX_MULTI_TOUCH
#define MAX_FINGER_NUM 10
#else
#define MAX_FINGER_NUM 1
#endif
//#define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0)
struct goodix_ts_data {
uint16_t addr;
uint8_t bad_data;
struct i2c_client *client;
struct input_dev *input_dev;
int use_reset; //use RESET flag
int use_irq; //use EINT flag
int read_mode; //read moudle mode,20110221 by andrew
struct hrtimer timer;
struct work_struct work;
char phys[32];
int retry;
struct early_suspend early_suspend;
int (*power)(struct goodix_ts_data * ts, int on);
uint16_t abs_x_max;
uint16_t abs_y_max;
uint8_t max_touch_num;
uint8_t int_trigger_type;
uint8_t green_wake_mode;
};
static const char *goodix_ts_name = "Goodix Capacitive TouchScreen";
static struct workqueue_struct *goodix_wq;
struct i2c_client * i2c_connect_client = NULL;
static struct proc_dir_entry *goodix_proc_entry;
static struct kobject *goodix_debug_kobj;
int ts_irq = 0;
int int_gpio = 0;
#ifdef CONFIG_HAS_EARLYSUSPEND
static void goodix_ts_early_suspend(struct early_suspend *h);
static void goodix_ts_late_resume(struct early_suspend *h);
#endif
//*****************************End of Part I *********************************
//*************************Touchkey Surpport Part*****************************
//#define HAVE_TOUCH_KEY
#ifdef HAVE_TOUCH_KEY
#define READ_COOR_ADDR 0x00
const uint16_t touch_key_array[]={
KEY_MENU, //MENU
KEY_HOME, //HOME
KEY_SEND //CALL
};
#define MAX_KEY_NUM (sizeof(touch_key_array)/sizeof(touch_key_array[0]))
#else
#define READ_COOR_ADDR 0x01
#endif
//*****************************End of Part II*********************************
//*************************Firmware Update part*******************************
#define CONFIG_TOUCHSCREEN_GOODIX_IAP
#ifdef CONFIG_TOUCHSCREEN_GOODIX_IAP
#define UPDATE_NEW_PROTOCOL
unsigned int oldcrc32 = 0xFFFFFFFF;
unsigned int crc32_table[256];
unsigned int ulPolynomial = 0x04c11db7;
unsigned char rd_cfg_addr;
unsigned char rd_cfg_len;
unsigned char g_enter_isp = 0;
static int goodix_update_write(struct file *filp, const char __user *buff, unsigned long len, void *data);
static int goodix_update_read( char *page, char **start, off_t off, int count, int *eof, void *data );
#define PACK_SIZE 64 //update file package size
#define MAX_TIMEOUT 60000 //update time out conut
#define MAX_I2C_RETRIES 20 //i2c retry times
//I2C buf address
#define ADDR_CMD 80
#define ADDR_STA 81
#ifdef UPDATE_NEW_PROTOCOL
#define ADDR_DAT 0
#else
#define ADDR_DAT 82
#endif
//moudle state
#define NEW_UPDATE_START 0x01
#define UPDATE_START 0x02
#define SLAVE_READY 0x08
#define UNKNOWN_ERROR 0x00
#define FRAME_ERROR 0x10
#define CHECKSUM_ERROR 0x20
#define TRANSLATE_ERROR 0x40
#define FLASH_ERROR 0X80
//error no
#define ERROR_NO_FILE 2 //ENOENT
#define ERROR_FILE_READ 23 //ENFILE
#define ERROR_FILE_TYPE 21 //EISDIR
#define ERROR_GPIO_REQUEST 4 //EINTR
#define ERROR_I2C_TRANSFER 5 //EIO
#define ERROR_NO_RESPONSE 16 //EBUSY
#define ERROR_TIMEOUT 110 //ETIMEDOUT
//update steps
#define STEP_SET_PATH 1
#define STEP_CHECK_FILE 2
#define STEP_WRITE_SYN 3
#define STEP_WAIT_SYN 4
#define STEP_WRITE_LENGTH 5
#define STEP_WAIT_READY 6
#define STEP_WRITE_DATA 7
#define STEP_READ_STATUS 8
#define FUN_CLR_VAL 9
#define FUN_CMD 10
#define FUN_WRITE_CONFIG 11
//fun cmd
#define CMD_DISABLE_TP 0
#define CMD_ENABLE_TP 1
#define CMD_READ_VER 2
#define CMD_READ_RAW 3
#define CMD_READ_DIF 4
#define CMD_READ_CFG 5
#define CMD_SYS_REBOOT 101
//read mode
#define MODE_RD_VER 1
#define MODE_RD_RAW 2
#define MODE_RD_DIF 3
#define MODE_RD_CFG 4
#endif
//*****************************End of Part III********************************
#endif /* _LINUX_GOODIX_TOUCH_H */