porting touch driver form rk28 to rk29sdk
authorsakura <sakura@sakura-desktop.(none)>
Mon, 6 Dec 2010 04:06:35 +0000 (12:06 +0800)
committersakura <sakura@sakura-desktop.(none)>
Mon, 6 Dec 2010 04:06:35 +0000 (12:06 +0800)
arch/arm/mach-rk29/board-rk29sdk.c
arch/arm/mach-rk29/include/mach/board.h
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/Makefile

index 934626a29c924c5637b45ce4aa61f69c25da05b3..d7cd239e042ca20f7a0bd6a3dea01b3e156630bd 100755 (executable)
@@ -226,6 +226,53 @@ static struct platform_device rk29_vpu_mem_device = {
        },\r
 };\r
 \r
+\r
+/*HANNSTAR_P1003 touch*/\r
+#if defined (CONFIG_HANNSTAR_P1003)\r
+#define TOUCH_POWER_PIN RK29_PIN6_PD2\r
+#define TOUCH_RESET_PIN RK29_PIN6_PC3\r
+#define TOUCH_INT_PIN   RK29_PIN0_PA2\r
+\r
+int p1003_init_platform_hw(void)\r
+{\r
+    if(gpio_request(TOUCH_RESET_PIN,NULL) != 0){\r
+      gpio_free(TOUCH_RESET_PIN);\r
+      printk("p1003_init_platform_hw gpio_request error\n");\r
+      return -EIO;\r
+    }\r
+\r
+    if(gpio_request(TOUCH_POWER_PIN,NULL) != 0){\r
+      gpio_free(TOUCH_POWER_PIN);\r
+      printk("p1003_init_platform_hw gpio_request error\n");\r
+      return -EIO;\r
+    }\r
+\r
+    if(gpio_request(TOUCH_INT_PIN,NULL) != 0){\r
+      gpio_free(TOUCH_INT_PIN);\r
+      printk("p1003_init_platform_hw gpio_request error\n");\r
+      return -EIO;\r
+    }\r
+    gpio_pull_updown(TOUCH_INT_PIN, 1);\r
+    gpio_direction_output(TOUCH_RESET_PIN, 0);\r
+    gpio_direction_output(TOUCH_POWER_PIN, 1);\r
+    gpio_set_value(TOUCH_POWER_PIN,GPIO_HIGH);\r
+    mdelay(500);\r
+    gpio_set_value(TOUCH_RESET_PIN,GPIO_LOW);\r
+    mdelay(500);\r
+    gpio_set_value(TOUCH_RESET_PIN,GPIO_HIGH);\r
+  \r
+    return 0;\r
+}\r
+\r
+\r
+struct p1003_platform_data p1003_info = {\r
+  .model= 1003,\r
+  .init_platform_hw= p1003_init_platform_hw,\r
+  \r
+};\r
+#endif\r
+\r
+\r
 /*****************************************************************************************\r
  * i2c devices\r
  * author: kfx@rock-chips.com\r
@@ -371,6 +418,15 @@ static struct i2c_board_info __initdata board_i2c1_devices[] = {
 \r
 #ifdef CONFIG_I2C2_RK29\r
 static struct i2c_board_info __initdata board_i2c2_devices[] = {\r
+#if defined (CONFIG_HANNSTAR_P1003)\r
+    {\r
+      .type           = "p1003_touch",\r
+      .addr           = 0x04,\r
+      .flags          = 0,\r
+      .irq            = RK29_PIN0_PA2,\r
+      .platform_data  = &p1003_info,\r
+    },\r
+#endif\r
 };\r
 #endif\r
 \r
index 87d598d19067c55db687e8e91983c26d5ece1614..905d218fd9de244079c37cda631fe8b1c39ba9a9 100755 (executable)
@@ -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);
 
index 7ad72bdef7cf839ab216ce817615bb87685400d5..6fa4319fac6fd7ccf26a3ff7fb3a00248562a189 100755 (executable)
@@ -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
index f9652d0c08261e59bd4f44a60a30254be03626dd..0e0d3cf25b0355c9131fbb6649a45a4047fb35c2 100644 (file)
@@ -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