mako: touch: disable ghost finger correction

The ghost function sets FORCE_FAST_RELAXATION and
FORCE_UPDATE registers, which cause touch abnormal function
after resume.

Also code clean up for register map initialization.

Change-Id: Ib442d4d7a2e995048fba902fe852a3851fdbf418
diff --git a/drivers/input/touchscreen/lge_touch_core.c b/drivers/input/touchscreen/lge_touch_core.c
index 58a3c4b..a0edc68 100644
--- a/drivers/input/touchscreen/lge_touch_core.c
+++ b/drivers/input/touchscreen/lge_touch_core.c
@@ -390,6 +390,8 @@
 		}
 	}
 
+//FIXME: Disable Ghost Stage due to touch mal function
+#if 0
 	if (ts->gf_ctrl.stage & GHOST_STAGE_2) {
 		ts->gf_ctrl.stage = GHOST_STAGE_2 | GHOST_STAGE_3;
 		if (touch_device_func->ic_ctrl) {
@@ -421,6 +423,7 @@
 		TOUCH_INFO_MSG("irq_pin[%d] next_work[%d] ghost_stage[0x%x]\n",
 			int_pin, next_work, ts->gf_ctrl.stage);
 	}
+#endif
 
 	ts->gf_ctrl.count = 0;
 	ts->gf_ctrl.ghost_check_count = 0;
diff --git a/drivers/input/touchscreen/touch_synaptics.c b/drivers/input/touchscreen/touch_synaptics.c
index 040d727..4a91d64 100644
--- a/drivers/input/touchscreen/touch_synaptics.c
+++ b/drivers/input/touchscreen/touch_synaptics.c
@@ -375,9 +375,7 @@
 	ts->finger_dsc.id = 0;
 	ts->button_dsc.id = 0;
 	ts->flash_dsc.id  = 0;
-#if defined(CONFIG_TOUCH_REG_MAP_TM2000) || defined(CONFIG_TOUCH_REG_MAP_TM2372)
 	ts->analog_dsc.id = 0;
-#endif
 
 	for (u_address = DESCRIPTION_TABLE_START; u_address > 10;
 			u_address -= sizeof(struct ts_function_descriptor)) {
@@ -399,6 +397,7 @@
 			break;
 		case FLASH_MEMORY_MANAGEMENT:
 			ts->flash_dsc = buffer;
+			break;
 		}
 	}
 
@@ -408,18 +407,13 @@
 		return -EIO;
 	}
 
-	u_address = DESCRIPTION_TABLE_START;
-
-	if (unlikely(touch_i2c_read(client, u_address, sizeof(buffer),
-					(unsigned char *)&buffer) < 0)) {
+	if (unlikely(touch_i2c_read(client, ANALOG_TABLE_START, sizeof(buffer), (unsigned char *)&buffer) < 0)) {
 		TOUCH_ERR_MSG("RMI4 Function Descriptor read fail\n");
 		return -EIO;
 	}
 
-	switch (buffer.id) {
-	case ANALOG_CONTROL:
+	if (buffer.id == ANALOG_CONTROL) {
 		ts->analog_dsc = buffer;
-		break;
 	}
 
 	if (unlikely(touch_i2c_write_byte(client, PAGE_SELECT_REG, 0x02) < 0)) {
@@ -427,19 +421,13 @@
 		return -EIO;
 	}
 
-	u_address -= sizeof(struct ts_function_descriptor);
-
-	if (unlikely(touch_i2c_read(ts->client, u_address, sizeof(buffer),
-						(unsigned char *)&buffer))) {
+	if (unlikely(touch_i2c_read(ts->client, BUTTON_TABLE_START, sizeof(buffer), (unsigned char *)&buffer))) {
 		TOUCH_ERR_MSG("Button ts_function_descriptor read fail\n");
 		return -EIO;
 	}
 
-	switch (buffer.id) {
-	case CAPACITIVE_BUTTON_SENSORS:
+	if (buffer.id == CAPACITIVE_BUTTON_SENSORS)
 		ts->button_dsc = buffer;
-		break;
-	}
 
 	if (unlikely(touch_i2c_write_byte(client, PAGE_SELECT_REG, 0x00) < 0)) {
 		TOUCH_ERR_MSG("PAGE_SELECT_REG write fail\n");
@@ -911,6 +899,9 @@
 	case IC_CTRL_BASELINE:
 		switch (value) {
 		case BASELINE_OPEN:
+			if (!ts->analog_dsc.id) /* If not supported, ignore */
+				break;
+
 #if defined(CONFIG_TOUCH_REG_MAP_TM2000) || defined(CONFIG_TOUCH_REG_MAP_TM2372)
 			if (unlikely(touch_i2c_write_byte(client,
 						PAGE_SELECT_REG, 0x01) < 0)) {
@@ -952,6 +943,9 @@
 #endif
 			break;
 		case BASELINE_FIX:
+			if (!ts->analog_dsc.id) /* If not supported, ignore */
+				break;
+
 #if defined(CONFIG_TOUCH_REG_MAP_TM2000) || defined(CONFIG_TOUCH_REG_MAP_TM2372)
 			if (unlikely(touch_i2c_write_byte(client,
 						PAGE_SELECT_REG, 0x01) < 0)) {
diff --git a/include/linux/input/touch_synaptics.h b/include/linux/input/touch_synaptics.h
index 396d6b5..15fd281 100644
--- a/include/linux/input/touch_synaptics.h
+++ b/include/linux/input/touch_synaptics.h
@@ -27,6 +27,8 @@
 #define MAX_NUM_OF_FINGERS                      10
 
 #define DESCRIPTION_TABLE_START                 0xe9
+#define ANALOG_TABLE_START                      0xe9
+#define BUTTON_TABLE_START                      0xe3
 
 struct ts_function_descriptor {
 	u8 	query_base;