From: sakura Date: Mon, 6 Dec 2010 04:06:35 +0000 (+0800) Subject: porting touch driver form rk28 to rk29sdk X-Git-Tag: firefly_0821_release~10985^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5367aa0ab84691b020575341906bf253ea569815;p=firefly-linux-kernel-4.4.55.git porting touch driver form rk28 to rk29sdk --- diff --git a/arch/arm/mach-rk29/board-rk29sdk.c b/arch/arm/mach-rk29/board-rk29sdk.c index 934626a29c92..d7cd239e042c 100755 --- a/arch/arm/mach-rk29/board-rk29sdk.c +++ b/arch/arm/mach-rk29/board-rk29sdk.c @@ -226,6 +226,53 @@ static struct platform_device rk29_vpu_mem_device = { }, }; + +/*HANNSTAR_P1003 touch*/ +#if defined (CONFIG_HANNSTAR_P1003) +#define TOUCH_POWER_PIN RK29_PIN6_PD2 +#define TOUCH_RESET_PIN RK29_PIN6_PC3 +#define TOUCH_INT_PIN RK29_PIN0_PA2 + +int p1003_init_platform_hw(void) +{ + if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){ + gpio_free(TOUCH_RESET_PIN); + printk("p1003_init_platform_hw gpio_request error\n"); + return -EIO; + } + + if(gpio_request(TOUCH_POWER_PIN,NULL) != 0){ + gpio_free(TOUCH_POWER_PIN); + printk("p1003_init_platform_hw gpio_request error\n"); + return -EIO; + } + + if(gpio_request(TOUCH_INT_PIN,NULL) != 0){ + gpio_free(TOUCH_INT_PIN); + printk("p1003_init_platform_hw gpio_request error\n"); + return -EIO; + } + gpio_pull_updown(TOUCH_INT_PIN, 1); + gpio_direction_output(TOUCH_RESET_PIN, 0); + gpio_direction_output(TOUCH_POWER_PIN, 1); + gpio_set_value(TOUCH_POWER_PIN,GPIO_HIGH); + mdelay(500); + gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW); + mdelay(500); + gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH); + + return 0; +} + + +struct p1003_platform_data p1003_info = { + .model= 1003, + .init_platform_hw= p1003_init_platform_hw, + +}; +#endif + + /***************************************************************************************** * i2c devices * author: kfx@rock-chips.com @@ -371,6 +418,15 @@ static struct i2c_board_info __initdata board_i2c1_devices[] = { #ifdef CONFIG_I2C2_RK29 static struct i2c_board_info __initdata board_i2c2_devices[] = { +#if defined (CONFIG_HANNSTAR_P1003) + { + .type = "p1003_touch", + .addr = 0x04, + .flags = 0, + .irq = RK29_PIN0_PA2, + .platform_data = &p1003_info, + }, +#endif }; #endif diff --git a/arch/arm/mach-rk29/include/mach/board.h b/arch/arm/mach-rk29/include/mach/board.h index 87d598d19067..905d218fd9de 100755 --- a/arch/arm/mach-rk29/include/mach/board.h +++ b/arch/arm/mach-rk29/include/mach/board.h @@ -105,6 +105,17 @@ struct rk29_i2s_platform_data { int (*io_deinit)(void); }; +/*p1003 touch */ +struct p1003_platform_data { + u16 model; + + int (*get_pendown_state)(void); + int (*init_platform_hw)(void); + int (*p1003_platform_sleep)(void); + int (*p1003_platform_wakeup)(void); + void (*exit_platform_hw)(void); +}; + void __init rk29_map_common_io(void); void __init rk29_clock_init(void); diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 7ad72bdef7cf..6fa4319fac6f 100755 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig @@ -575,5 +575,10 @@ config TOUCHSCREEN_PCAP To compile this driver as a module, choose M here: the module will be called pcap_ts. +config HANNSTAR_P1003 + tristate "Hannstar P1003 touchscreen" + depends on I2C2_RK29 + help + RK29 hannstar touch endif diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index f9652d0c0826..0e0d3cf25b03 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile @@ -49,3 +49,4 @@ obj-$(CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI) += xpt2046_ts_320X480.o obj-$(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI) += xpt2046_cbn_ts.o calibration_ts.o largenum_ts.o calib_iface_ts.o obj-$(CONFIG_TOUCHSCREEN_IT7250) += ctp_it7250.o obj-$(CONFIG_RK28_I2C_TS_NTP070) += ntp070.o +obj-$(CONFIG_HANNSTAR_P1003) += hannstar_p1003.o \ No newline at end of file