From: lw <lw@rock-chips.com>
Date: Wed, 14 Mar 2012 02:30:05 +0000 (+0800)
Subject: rk30:update goodix driver from rk29
X-Git-Tag: firefly_0821_release~9595^2~65
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fbfd114fc2a0084c558e5fb9a042212f8671cd96;p=firefly-linux-kernel-4.4.55.git

rk30:update goodix driver from rk29
---

diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index aaad0b0361ec..feec9ba34e5d 100755
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -116,12 +116,25 @@ config TOUCHSCREEN_ILI2102_IIC
 
 	  If unsure, say N (but it's safe to say "Y").
 config TOUCHSCREEN_GT8XX
-        tristate "Goodix touch screen gt8xx support"
+        tristate "Goodix touch screen gt801X2 support for rockchip based platform"
         help
           Say Y here if you have a touchscreen interface using the
-          goodix gt8xx  , and your board-specific initialization
+          two goodix gt801  , and your board-specific initialization
           code includes that in its table of IIC devices.
-	  If unsure, say N (but it's safe to say "Y").
+	  If unsure, say N.
+	config TOUCH_MAX_X
+                int "touch max x resolution"
+                depends on TOUCHSCREEN_GT8XX
+                default 1280
+                help
+                  goodix  touch max X resolution
+
+        config TOUCH_MAX_Y
+                int "touch max y resolution"
+                depends on TOUCHSCREEN_GT8XX
+                default 800
+                help
+                  goodix touch max y resolution
 
 config RK28_I2C_TS_NTP070
 	tristate "NTP070 based touchscreens: NTP070 Interface"
diff --git a/drivers/input/touchscreen/rk29_i2c_goodix.c b/drivers/input/touchscreen/rk29_i2c_goodix.c
index eb14dbb305e7..b4a43e71f9e0 100755
--- a/drivers/input/touchscreen/rk29_i2c_goodix.c
+++ b/drivers/input/touchscreen/rk29_i2c_goodix.c
@@ -150,27 +150,35 @@ static int goodix_init_panel(struct rk_ts_data *ts)
 	int ret=-1;
 	uint8_t rd_cfg_buf[7] = {0x66,};
 
-#ifdef GOODIX_1024X768			//for malata 10.1
-             uint8_t config_info[] = {
-		  0x65,0x02,0x04,0x00,0x03,0x00,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
-		  0x41,0x41,0x20,0x09,0x00,0xA0,0xA0,0x3C,0x64,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,
-		  0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,0x1B,0x1A,0x19,0x18,
-		  0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
-		  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-		  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
-		};
+#if (TS_MAX_X == 1024)&&(TS_MAX_Y == 768)			//for malata 10.1
+	uint8_t config_info[] = {
+		0x65,0x02,0x04,0x00,0x03,0x00,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
+		0x41,0x41,0x20,0x09,0x00,0xA0,0xA0,0x3C,0x64,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,
+		0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,0x1B,0x1A,0x19,0x18,
+		0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
+		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+	};
              
+#elif (TS_MAX_X == 1280)&&(TS_MAX_Y == 800)	
+	uint8_t config_info[] = {
+		0x65,0x02,0x05,0x00,0x03,0x20,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
+		0x41,0x41,0x20,0x07,0x00,0xA0,0xA0,0x46,0x64,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,
+		0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,0x1B,0x1A,0x19,0x18,
+		0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
+		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+	};
 #else
-		};*/
-	  uint8_t config_info[] = {
-                  0x65,0x02,0x05,0x00,0x03,0x20,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
-				  	0x42,0x42,0x20,0x00,0x00,0x89,0x89,0x3C,0x64,0x0E,0x0D,0x0C,0x0B,
-				  	0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,
-				  	0x1B,0x1A,0x19,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,
-				  	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-				  	0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-				  	0x00,0x00,0x00,0x00
-		};
+	uint8_t config_info[] = {
+		0x65,0x02,0x05,0x00,0x03,0x20,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
+		0x42,0x42,0x20,0x00,0x00,0x89,0x89,0x3C,0x64,0x0E,0x0D,0x0C,0x0B,
+		0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,
+		0x1B,0x1A,0x19,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,
+		0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+		0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+		0x00,0x00,0x00,0x00
+	};
 #endif
 	ret=goodix_i2c_write_bytes(ts->client,config_info, (sizeof(config_info)/sizeof(config_info[0])));
 	if (ret < 0) {
diff --git a/drivers/input/touchscreen/rk29_i2c_goodix.h b/drivers/input/touchscreen/rk29_i2c_goodix.h
index 950888cce88e..338aaa961eb2 100755
--- a/drivers/input/touchscreen/rk29_i2c_goodix.h
+++ b/drivers/input/touchscreen/rk29_i2c_goodix.h
@@ -26,10 +26,8 @@
 //*************************TouchScreen Work Part*****************************
 
 #define GOODIX_I2C_NAME "Goodix-TS"
-#define GOODIX_1024X768	 1
-
-#define TS_MAX_X 	1024			
-#define TS_MAX_Y		768
+#define TS_MAX_X 	CONFIG_TOUCH_MAX_X
+#define TS_MAX_Y	CONFIG_TOUCH_MAX_Y
 
 #if 1
 #define INT_PORT		RK29_PIN0_PA2