Browse Source

touch: focaltech: add support for ft8726 boot up

This change adds support for ft8726 touch IC boot up for panels
having firmware already flashed and updates power on sequence
to perform delayed probe operations as part of first resume.

Change-Id: Ib9f5d1b961a80c3e884ef0cb22577bf295c1d4cb
Signed-off-by: Ritesh Kumar <[email protected]>
Signed-off-by: Jyothi bommidi <[email protected]>
Jyothi bommidi 1 year ago
parent
commit
df8c1c7d1f

+ 4 - 3
focaltech_touch/focaltech_config.h

@@ -57,6 +57,7 @@
 #define _FT7250             0x7250081A
 #define _FT7120             0x7120081B
 #define _FT8720             0x8720081C
+#define _FT8726             0x8726081C
 #define _FT8016             0x8016081D
 
 
@@ -228,7 +229,7 @@
 /*
  * Numbers of modules support
  */
-#define FTS_GET_MODULE_NUM                      0
+#define FTS_GET_MODULE_NUM                      2
 
 /*
  * module_id: mean vendor_id generally, also maybe gpio or lcm_id...
@@ -238,7 +239,7 @@
  * FTS_GET_MODULE_NUM >= 3, compatible with FTS_MODULE3_ID
  */
 #define FTS_MODULE_ID                          0x0000
-#define FTS_MODULE2_ID                         0x0000
+#define FTS_MODULE2_ID                         0xd566
 #define FTS_MODULE3_ID                         0x0000
 
 /*
@@ -250,7 +251,7 @@
  * etc/firmware or by customers
  */
 #define FTS_MODULE_NAME                        "gvo"
-#define FTS_MODULE2_NAME                       ""
+#define FTS_MODULE2_NAME                       "jdi"
 #define FTS_MODULE3_NAME                       ""
 
 /*

+ 28 - 3
focaltech_touch/focaltech_core.c

@@ -97,6 +97,7 @@ static void fts_ts_panel_notifier_callback(enum panel_event_notifier_tag tag,
 static struct ft_chip_t ctype[] = {
 	{0x88, 0x56, 0x52, 0x00, 0x00, 0x00, 0x00, 0x56, 0xB2},
 	{0x81, 0x54, 0x52, 0x54, 0x52, 0x00, 0x00, 0x54, 0x5C},
+	{0x1C, 0x87, 0x26, 0x87, 0x20, 0x87, 0xA0, 0x00, 0x00},
 };
 
 /*****************************************************************************
@@ -2716,9 +2717,7 @@ static int fts_ts_probe_delayed(struct fts_ts_data *fts_data)
 		goto err_power_init;
 	}
 #endif
-
-	if (!FTS_CHIP_IDC(fts_data->pdata->type))
-		fts_reset_proc(200);
+	fts_reset_proc(200);
 
 	ret = fts_get_ic_information(fts_data);
 	if (ret) {
@@ -2855,11 +2854,25 @@ static int fts_ts_probe_entry(struct fts_ts_data *ts_data)
 	fts_ts_trusted_touch_init(ts_data);
 	mutex_init(&(ts_data->fts_clk_io_ctrl_mutex));
 #endif
+
+#ifndef CONFIG_ARCH_QTI_VM
+	if (ts_data->pdata->type == _FT8726) {
+		atomic_set(&ts_data->delayed_vm_probe_pending, 1);
+		ts_data->suspended = true;
+	} else {
+		ret = fts_ts_probe_delayed(ts_data);
+		if (ret) {
+			FTS_ERROR("Failed to enable resources\n");
+			goto err_probe_delayed;
+		}
+	}
+#else
 	ret = fts_ts_probe_delayed(ts_data);
 	if (ret) {
 		FTS_ERROR("Failed to enable resources\n");
 		goto err_probe_delayed;
 	}
+#endif
 
 #if defined(CONFIG_DRM)
 	if (ts_data->ts_workqueue)
@@ -3026,6 +3039,7 @@ static int fts_ts_suspend(struct device *dev)
 static int fts_ts_resume(struct device *dev)
 {
 	struct fts_ts_data *ts_data = fts_data;
+	int ret = 0;
 
 	FTS_FUNC_ENTER();
 	if (!ts_data->suspended) {
@@ -3039,6 +3053,17 @@ static int fts_ts_resume(struct device *dev)
 		wait_for_completion_interruptible(
 			&ts_data->trusted_touch_powerdown);
 #endif
+	if (ts_data->pdata->type == _FT8726 &&
+			atomic_read(&ts_data->delayed_vm_probe_pending)) {
+		ret = fts_ts_probe_delayed(ts_data);
+		if (ret) {
+			FTS_ERROR("Failed to enable resources\n");
+			return ret;
+		}
+		ts_data->suspended = false;
+		atomic_set(&ts_data->delayed_vm_probe_pending, 0);
+		return ret;
+	}
 
 	mutex_lock(&ts_data->transition_lock);
 

+ 1 - 1
focaltech_touch/focaltech_core.h

@@ -299,9 +299,9 @@ struct fts_ts_data {
 	atomic_t trusted_touch_transition;
 	atomic_t trusted_touch_event;
 	atomic_t trusted_touch_abort_status;
-	atomic_t delayed_vm_probe_pending;
 	atomic_t trusted_touch_mode;
 #endif
+	atomic_t delayed_vm_probe_pending;
 };
 
 enum _FTS_BUS_TYPE {

+ 16 - 2
focaltech_touch/focaltech_flash.c

@@ -51,11 +51,25 @@ u8 fw_file[1] = {
 
 struct upgrade_module module_list[] = {
 	{FTS_MODULE_ID, FTS_MODULE_NAME, fw_file, sizeof(fw_file)},
+	{FTS_MODULE2_ID, FTS_MODULE2_NAME, fw_file, sizeof(fw_file)},
+};
+
+struct upgrade_func upgrade_func_ft8720 = {
+	.ctype = {0x1C},
+	.fwveroff = 0x210E,
+	.fwcfgoff = 0x1000,
+	.appoff = 0x2000,
+	.licoff = 0x0000,
+	.appoff_handle_in_ic = true,
+	.pramboot_supported = false,
+	.new_return_value_from_ic = true,
+	.hid_supported = false,
 };
 
 struct upgrade_func *upgrade_func_list[] = {
 	&upgrade_func_ft5452,
 	&upgrade_func_ft5652,
+	&upgrade_func_ft8720,
 };
 
 struct fts_upgrade *fwupgrade;
@@ -1825,8 +1839,8 @@ static int fts_fwupg_get_module_info(struct fts_upgrade *upg)
 			}
 		}
 		if (i >= FTS_GET_MODULE_NUM) {
-			FTS_ERROR("no module id match, don't get file");
-			return -ENODATA;
+			info = &module_list[0];
+			FTS_ERROR("no module id match, default to use first module");
 		}
 	}