add auto TScalibration in raho
authorsrt <srt@rock-chips.com>
Wed, 29 Sep 2010 01:29:46 +0000 (09:29 +0800)
committersrt <srt@rock-chips.com>
Wed, 29 Sep 2010 01:29:46 +0000 (09:29 +0800)
arch/arm/configs/rk2818_raho_defconfig
drivers/input/touchscreen/Kconfig
drivers/input/touchscreen/Makefile
drivers/input/touchscreen/calib_iface_ts.c
drivers/input/touchscreen/xpt2046_cbn_ts.c
drivers/input/touchscreen/xpt2046_ts_320X480.c

index e5e272bbc08ef5c88bb2754553156f408b7b5cc4..ee54793c7eebc3dafbd89338d375b39b4df2de12 100755 (executable)
@@ -709,8 +709,8 @@ CONFIG_INPUT_TOUCHSCREEN=y
 # CONFIG_TOUCHSCREEN_AD7877 is not set
 # CONFIG_TOUCHSCREEN_XPT2046_SPI is not set
 # CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI is not set
-CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI=y
-# CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI is not set
+# CONFIG_TOUCHSCREEN_XPT2046_320X480_SPI is not set
+CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI=y
 # CONFIG_TOUCHSCREEN_IT7250 is not set
 # CONFIG_TOUCHSCREEN_AD7879_I2C is not set
 # CONFIG_TOUCHSCREEN_AD7879_SPI is not set
index ca38b951ac85e42d4333333e555c328dfc9a2ffb..b2857fefd0adc3904a4da8a97cc5b9aaa070dc3c 100644 (file)
@@ -11,6 +11,30 @@ menuconfig INPUT_TOUCHSCREEN
 
 if INPUT_TOUCHSCREEN
 
+choice 
+  prompt "XPT2046 based touchscreens: SPI Interface"
+  default TOUCHSCREEN_XPT2046_CBN_SPI
+         
+       config TOUCHSCREEN_XPT2046_SPI_NOCHOOSE
+  bool "DO NOT CHOOSE TOUCHSCREEN_XPT2046"
+  
+  config TOUCHSCREEN_XPT2046_SPI
+  bool "800X480 TOUCHSCREEN"
+       depends on SPIM_RK2818
+
+  config TOUCHSCREEN_XPT2046_CBN_SPI
+  bool "800X480 CALIBRATION TOUCHSCREEN"
+  depends on SPIM_RK2818
+  
+  config TOUCHSCREEN_XPT2046_320X480_SPI
+  bool "320X480 TOUCHSCREEN"
+  depends on SPIM_RK2818
+  
+  config TOUCHSCREEN_XPT2046_320X480_CBN_SPI
+       bool "320X480 CALIBRATION TOUCHSCREEN"
+       depends on SPIM_RK2818
+       
+endchoice
 config TOUCHSCREEN_ADS7846
        tristate "ADS7846/TSC2046 and ADS7843 based touchscreens"
        depends on SPI_MASTER
@@ -42,57 +66,7 @@ config TOUCHSCREEN_AD7877
          To compile this driver as a module, choose M here: the
          module will be called ad7877.
          
-config TOUCHSCREEN_XPT2046_SPI
-       tristate "XPT2046 based touchscreens: XPT2046 SPI Interface"
-       depends on SPIM_RK2818 && TOUCHSCREEN_XPT2046_CBN_SPI = n
-       help
-         Say Y here if you have a touchscreen interface using the
-         xpt2046 controller, and your board-specific initialization
-         code includes that in its table of SPI devices.
-
-         If unsure, say N (but it's safe to say "Y").
-
-         To compile this driver as a module, choose M here: the
-         module will be called xpt2046_ts.
-         
-config TOUCHSCREEN_XPT2046_CBN_SPI
-       tristate "XPT2046 CALIBRATION based touchscreens: XPT2046 SPI Interface"
-       depends on SPIM_RK2818
-       help
-         Say Y here if you have a touchscreen interface using the
-         xpt2046 controller, and your board-specific initialization
-         code includes that in its table of SPI devices.
-
-         If unsure, say N (but it's safe to say "Y").
 
-         To compile this driver as a module, choose M here: the
-         module will be called xpt2046_cbn_ts.
-         
-config TOUCHSCREEN_XPT2046_320X480_SPI
-       tristate "XPT2046 320X480 based touchscreens: XPT2046 SPI Interface"
-       depends on SPIM_RK2818 && TOUCHSCREEN_XPT2046_320X480_CBN_SPI = n
-       help
-         Say Y here if you have a touchscreen interface using the
-         xpt2046 controller, and your board-specific initialization
-         code includes that in its table of SPI devices.
-
-         If unsure, say N (but it's safe to say "Y").
-
-         To compile this driver as a module, choose M here: the
-         module will be called xpt2046_ts.
-         
-config TOUCHSCREEN_XPT2046_320X480_CBN_SPI
-       tristate "XPT2046 320X480 CALIBRATION based touchscreens: XPT2046 SPI Interface"
-       depends on SPIM_RK2818
-       help
-         Say Y here if you have a touchscreen interface using the
-         xpt2046 controller, and your board-specific initialization
-         code includes that in its table of SPI devices.
-
-         If unsure, say N (but it's safe to say "Y").
-
-         To compile this driver as a module, choose M here: the
-         module will be called xpt2046_cbn_ts. 
       
 config TOUCHSCREEN_IT7250
        tristate "IT7250 based touchscreens: IT7250 Interface"
@@ -598,15 +572,4 @@ config TOUCHSCREEN_PCAP
          To compile this driver as a module, choose M here: the
          module will be called pcap_ts.
          
-choice 
-  prompt "Touch panel resolution"
-  default TP_800x480
-
-  config TP_800x480
-  bool "800x480"
-
-  config TP_1024x600
-  bool "1024x600"
-
-endchoice
 endif
index d2c95118dde5ac3fdb172ef97e980a27a7d92718..2362f6a338f1f164696de9d3865f11d2322894c1 100644 (file)
@@ -46,5 +46,5 @@ obj-$(CONFIG_TOUCHSCREEN_PCAP)                += pcap_ts.o
 obj-$(CONFIG_TOUCHSCREEN_XPT2046_SPI)          += xpt2046_ts.o
 obj-$(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)              += xpt2046_cbn_ts.o calibration_ts.o largenum_ts.o calib_iface_ts.o
 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
+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
index 14b9c5332c57d987287a5d078dd9d2d53b1890ed..6494d266ba63834a74d876bd93cc5bf8a6368552 100644 (file)
@@ -32,29 +32,36 @@ extern volatile struct adc_point gADPoint;
 #ifdef TS_PRESSURE\r
 extern volatile int gZvalue[3];\r
 #endif\r
-#ifdef CONFIG_TP_1024x600\r
-int screen_x[5] = {50, 974,  50, 974, 512};\r
-int screen_y[5] = {50,  50, 550, 550, 300};\r
-#endif\r
 \r
-#ifdef CONFIG_TP_800x480\r
-int screen_x[5] = { 50, 750,  50, 750, 400};\r
-int screen_y[5] = { 40,  40, 440, 440, 240};\r
+\r
+#if defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\r
+       int screen_x[5] = { 50, 270,  50, 270, 160}; \r
+       int screen_y[5] = { 40,  40, 440, 440, 240}; \r
+#elif defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI) \r
+  int screen_x[5] = { 50, 750,  50, 750, 400};\r
+  int screen_y[5] = { 40,  40, 440, 440, 240};\r
+#elif defined(CONFIG_TOUCHSCREEN_XPT2046_1024X600_CBN_SPI) \r
+  int screen_x[5] = {50, 974,  50, 974, 512};\r
+  int screen_y[5] = {50,  50, 550, 550, 300};\r
 #endif\r
 \r
-int uncali_x[5] = { 0 };\r
-int uncali_y[5] = { 0 };\r
 \r
-#ifdef CONFIG_MACH_RK2818INFO_IT50\r
-int uncali_x_default[5] = { 3735,  301, 3754,  290, 1993 };\r
-int uncali_y_default[5] = {  3442,  3497, 413, 459, 1880 };\r
-#endif\r
 \r
-#ifdef CONFIG_MACH_RK2818INFO \r
-int uncali_x_default[5] = { 438,  565, 3507,  3631, 2105 };\r
-int uncali_y_default[5] = {  3756,  489, 3792, 534, 2159 };\r
+\r
+#if defined(CONFIG_MACH_RK2818INFO_IT50) && defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI)\r
+       int uncali_x_default[5] = { 3735,  301, 3754,  290, 1993 };\r
+       int uncali_y_default[5] = {  3442,  3497, 413, 459, 1880 };\r
+#elif defined(CONFIG_MACH_RK2818INFO) && defined(CONFIG_TOUCHSCREEN_XPT2046_CBN_SPI) \r
+       int uncali_x_default[5] = { 438,  565, 3507,  3631, 2105 };\r
+       int uncali_y_default[5] = {  3756,  489, 3792, 534, 2159 };\r
+#elif (defined(CONFIG_MACH_RAHO) || defined(CONFIG_MACH_RK2818INFO))&& defined(CONFIG_TOUCHSCREEN_XPT2046_320X480_CBN_SPI)\r
+       int uncali_x_default[5] = { 812,  3341, 851,  3371, 2183 };\r
+       int uncali_y_default[5] = {  442,  435, 3193, 3195, 2004 };\r
 #endif\r
 \r
+int uncali_x[5] = { 0 };\r
+int uncali_y[5] = { 0 };\r
+\r
 static ssize_t touch_mode_show(struct class *cls, char *_buf)\r
 {\r
     int count;\r
index ca1bd122a7e347f0d20457c99987690580d399e4..d0c4eccc985f5f8ccc17871e07e002541eb3dd96 100644 (file)
@@ -46,7 +46,7 @@
  * note. The strength of filtering can be set in the board-* specific
  * files.
  */
-#define XPT2046_DEBUG                  0
+#define XPT2046_DEBUG           0
 #if XPT2046_DEBUG
        #define xpt2046printk(msg...)   printk(msg);
 #else
@@ -671,10 +671,20 @@ static int __devinit setup_pendown(struct spi_device *spi, struct xpt2046 *ts)
                return err;
        }
 
+    err = gpio_direction_input(pdata->gpio_pendown);
+    if (err) {
+               dev_err(&spi->dev, "failed to switch GPIO to input%d\n",
+                               pdata->gpio_pendown);
+               return err;
+    }
+    
+    gpio_pull_updown(pdata->gpio_pendown,GPIOPullUp);
+
        ts->gpio_pendown = pdata->gpio_pendown;
        return 0;
 }
 
+
 static int __devinit xpt2046_probe(struct spi_device *spi)
 {
        struct xpt2046                  *ts;
@@ -862,6 +872,8 @@ static int __devinit xpt2046_probe(struct spi_device *spi)
                        goto err_free_gpio;
                }
        }
+
+       
        xpt2046printk("***>%s:touchscreen irq %d\n",__FUNCTION__,spi->irq);
        
        /* take a first sample, leaving nPENIRQ active and vREF off; avoid
index 0f3de2fcf5c6790c465dc4fd707b58e66f1c6063..565a8b0e73b2a7547104375ce388b1a32110d032 100755 (executable)
@@ -201,22 +201,6 @@ struct dfr_req {
        struct spi_transfer     xfer[4];
 };
 
-static struct xpt2046_platform_data xpt2046_info = {
-       .model                  = 2046,
-       .keep_vref_on   = 1,
-       .swap_xy                = 0,
-       .x_min                  = 0,
-       .x_max                  = 320,
-       .y_min                  = 0,
-       .y_max                  = 480,
-       .debounce_max           = 7,
-       .debounce_rep           = DEBOUNCE_REPTIME,
-       .debounce_tol           = 20,
-       .gpio_pendown           = RK2818_PIN_PE1,//RK2818_PIN_PE3, //modify by zhao
-       .penirq_recheck_delay_usecs = 1,
-
-};
-
 //add by zhao
 #define LEN_TO_PIX(x)  (unsigned int)( 320 * (x) / 47 )
 #define KEY1_X                 6.3