From a764296b7fd859a7926316299614de49d5b701c4 Mon Sep 17 00:00:00 2001 From: lw Date: Tue, 6 Mar 2012 11:16:10 +0800 Subject: [PATCH] rk30:add goodix touch screen support --- arch/arm/mach-rk30/board-rk30-sdk.c | 49 +++++++++++++++++++++ arch/arm/plat-rk/include/plat/board.h | 11 +++++ drivers/input/touchscreen/Kconfig | 2 +- drivers/input/touchscreen/rk29_i2c_goodix.c | 8 ++-- 4 files changed, 65 insertions(+), 5 deletions(-) mode change 100644 => 100755 arch/arm/plat-rk/include/plat/board.h mode change 100644 => 100755 drivers/input/touchscreen/Kconfig diff --git a/arch/arm/mach-rk30/board-rk30-sdk.c b/arch/arm/mach-rk30/board-rk30-sdk.c index c87edce5d575..f13505f054ae 100755 --- a/arch/arm/mach-rk30/board-rk30-sdk.c +++ b/arch/arm/mach-rk30/board-rk30-sdk.c @@ -52,6 +52,45 @@ #define RK30_FB0_MEM_SIZE 8*SZ_1M +#if defined(CONFIG_TOUCHSCREEN_GT8XX) +#define TOUCH_RESET_PIN RK30_PIN4_PD0 +#define TOUCH_PWR_PIN INVALID_GPIO +int goodix_init_platform_hw(void) +{ + int ret; + printk("goodix_init_platform_hw\n"); + ret = gpio_request(TOUCH_PWR_PIN, "goodix power pin"); + if(ret != 0){ + gpio_free(TOUCH_PWR_PIN); + printk("goodix power error\n"); + return -EIO; + } + gpio_direction_output(TOUCH_PWR_PIN, 0); + gpio_set_value(TOUCH_PWR_PIN,GPIO_LOW); + msleep(100); + ret = gpio_request(TOUCH_RESET_PIN, "goodix reset pin"); + if(ret != 0){ + gpio_free(TOUCH_RESET_PIN); + printk("goodix gpio_request error\n"); + return -EIO; + } + gpio_direction_output(TOUCH_RESET_PIN, 0); + gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW); + msleep(10); + gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH); + msleep(500); + return 0; +} + +struct goodix_platform_data goodix_info = { + .model= 8105, + .irq_pin = RK30_PIN4_PC2, + .rest_pin = TOUCH_RESET_PIN, + .init_platform_hw = goodix_init_platform_hw, +}; +#endif + + /***************************************************************************************** * xpt2046 touch panel * author: hhb@rock-chips.com @@ -450,6 +489,16 @@ static struct i2c_board_info __initdata i2c1_info[] = { #ifdef CONFIG_I2C2_RK30 static struct i2c_board_info __initdata i2c2_info[] = { +#if defined (CONFIG_TOUCHSCREEN_GT8XX) + { + .type = "Goodix-TS", + .addr = 0x55, + .flags =0, + .irq =RK30_PIN4_PC2, + .platform_data = &goodix_info, + }, +#endif + }; #endif diff --git a/arch/arm/plat-rk/include/plat/board.h b/arch/arm/plat-rk/include/plat/board.h old mode 100644 new mode 100755 index 7fca0a4ab1ac..7e6aeb697cea --- a/arch/arm/plat-rk/include/plat/board.h +++ b/arch/arm/plat-rk/include/plat/board.h @@ -94,6 +94,17 @@ struct akm8975_platform_data { int gpio_DRDY; }; +struct goodix_platform_data { + int model ; + int rest_pin; + int irq_pin ; + int (*get_pendown_state)(void); + int (*init_platform_hw)(void); + int (*platform_sleep)(void); + int (*platform_wakeup)(void); + void (*exit_platform_hw)(void); +}; + #define BOOT_MODE_NORMAL 0 diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig old mode 100644 new mode 100755 index a3b870c54fec..aaad0b0361ec --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -116,7 +116,7 @@ config TOUCHSCREEN_ILI2102_IIC If unsure, say N (but it's safe to say "Y"). config TOUCHSCREEN_GT8XX - tristate "Goodix touch screen gt8xx support for rk29" + tristate "Goodix touch screen gt8xx support" help Say Y here if you have a touchscreen interface using the goodix gt8xx , and your board-specific initialization diff --git a/drivers/input/touchscreen/rk29_i2c_goodix.c b/drivers/input/touchscreen/rk29_i2c_goodix.c index 40f649cde589..16a1c1f9f3db 100755 --- a/drivers/input/touchscreen/rk29_i2c_goodix.c +++ b/drivers/input/touchscreen/rk29_i2c_goodix.c @@ -804,7 +804,7 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id ret = request_irq(ts->irq, rk_ts_irq_handler ,IRQ_TYPE_LEVEL_LOW,client->name, ts); if (ret != 0) { printk(KERN_ALERT "Cannot allocate ts INT!ERRNO:%d\n", ret); - gpio_free(INT_PORT); + gpio_free(irq_to_gpio(ts->irq)); goto err_input_register_device_failed; } } @@ -1383,13 +1383,13 @@ rewrite: { printk(KERN_INFO"Disable TS int!\n"); g_enter_isp = 1; - disable_irq(TS_INT); + disable_irq(gpio_to_irq(ts->irq)); } else if(cmd[1] == CMD_ENABLE_TP) { printk(KERN_INFO"Enable TS int!\n"); g_enter_isp = 0; - enable_irq(TS_INT); + enable_irq(gpio_to_irq(ts->irq)); } else if(cmd[1] == CMD_READ_VER) { @@ -1512,7 +1512,7 @@ static int goodix_update_read( char *page, char **start, off_t off, int count, i struct rk_ts_data *ts; int len = 0; char *version_info = NULL; - unsigned char read_data[1201] = {80, }; + static unsigned char read_data[1201] = {80, }; ts = i2c_get_clientdata(i2c_connect_client); if(ts==NULL) -- 2.34.1