summaryrefslogtreecommitdiff
path: root/tcm
diff options
context:
space:
mode:
authordavidycchen <davidycchen@google.com>2021-12-20 17:13:30 +0800
committerdavidycchen <davidycchen@google.com>2021-12-21 18:25:59 +0800
commitf2bfef998a7497e947a4381f96abe9e789d781d1 (patch)
tree378131f0b4e1f29f4aef1ef0695722d5109d23b3 /tcm
parent96d884a4c6120e4a8e837f02f27079f0d993521d (diff)
downloadsynaptics_touch-f2bfef998a7497e947a4381f96abe9e789d781d1.tar.gz
synaptics: synaptics: update driver version to 0118
Support two more testing - PID$12: Abs. Raw - PID$16: Trans Cap. Raw Correct the sequence of suspend-reset especially RESET_ON_RESUME enabled. Sample code to parse the custom gesture data. Enable RESET_ON_RESUME in default. Bug: 211379827 Signed-off-by: davidycchen <davidycchen@google.com> Change-Id: I888d0c68aa53020eb0e153105920b0fed133d8cb
Diffstat (limited to 'tcm')
-rw-r--r--tcm/synaptics_touchcom_core_dev.h5
-rw-r--r--tcm/synaptics_touchcom_core_v1.c4
-rw-r--r--tcm/synaptics_touchcom_func_reflash.c12
-rw-r--r--tcm/synaptics_touchcom_func_romboot.c54
-rw-r--r--tcm/synaptics_touchcom_func_touch.c7
5 files changed, 63 insertions, 19 deletions
diff --git a/tcm/synaptics_touchcom_core_dev.h b/tcm/synaptics_touchcom_core_dev.h
index 1b0eb2c..1728830 100644
--- a/tcm/synaptics_touchcom_core_dev.h
+++ b/tcm/synaptics_touchcom_core_dev.h
@@ -44,7 +44,7 @@
#include "syna_tcm2_platform.h"
-#define SYNA_TCM_CORE_LIB_VERSION 0x0115
+#define SYNA_TCM_CORE_LIB_VERSION 0x0118
/**
@@ -335,6 +335,7 @@ enum tcm_test_code {
TEST_PID01_TRX_TRX_SHORTS = 0x01,
TEST_PID02_TRX_SENSOR_OPENS = 0x02,
TEST_PID03_TRX_GROUND_SHORTS = 0x03,
+ TEST_PID04_GPIO_SHORTS = 0x04,
TEST_PID05_FULL_RAW_CAP = 0x05,
TEST_PID06_EE_SHORT = 0x06,
TEST_PID07_DYNAMIC_RANGE = 0x07,
@@ -348,7 +349,9 @@ enum tcm_test_code {
TEST_PID16_SENSOR_SPEED = 0x10,
TEST_PID17_ADC_RANGE = 0x11,
TEST_PID18_HYBRID_ABS_RAW = 0x12,
+ TEST_PID22_TRANS_CAP_RAW = 0x16,
TEST_PID29_HYBRID_ABS_NOISE = 0x1D,
+ TEST_PID30_BSC_CALIB = 0x1E,
TEST_PID_MAX,
};
diff --git a/tcm/synaptics_touchcom_core_v1.c b/tcm/synaptics_touchcom_core_v1.c
index 75d4c4a..17a7ca4 100644
--- a/tcm/synaptics_touchcom_core_v1.c
+++ b/tcm/synaptics_touchcom_core_v1.c
@@ -190,13 +190,15 @@ static void syna_tcm_v1_dispatch_report(struct tcm_dev *tcm_dev)
syna_pal_completion_complete(cmd_completion);
goto exit;
default:
- LOGN("Device has been reset\n");
+ LOGN("Get unexpected 0x%02X report at command 0x%02X\n",
+ REPORT_IDENTIFY, tcm_msg->command);
ATOMIC_SET(tcm_msg->command_status,
CMD_STATE_ERROR);
syna_pal_completion_complete(cmd_completion);
goto exit;
}
} else {
+ LOGN("Device has been reset\n");
/* invoke callback to handle unexpected reset if doesn't
* result from command
*/
diff --git a/tcm/synaptics_touchcom_func_reflash.c b/tcm/synaptics_touchcom_func_reflash.c
index dff17cc..5115b73 100644
--- a/tcm/synaptics_touchcom_func_reflash.c
+++ b/tcm/synaptics_touchcom_func_reflash.c
@@ -1978,6 +1978,7 @@ int syna_tcm_do_fw_update(struct tcm_dev *tcm_dev,
int retval;
enum update_area type = UPDATE_NONE;
struct tcm_reflash_data_blob reflash_data;
+ int app_status;
if (!tcm_dev) {
LOGE("Invalid tcm device handle\n");
@@ -2008,6 +2009,17 @@ int syna_tcm_do_fw_update(struct tcm_dev *tcm_dev,
ATOMIC_SET(tcm_dev->firmware_flashing, 1);
+ app_status = syna_pal_le2_to_uint(tcm_dev->app_info.status);
+
+ /* to forcedly update the firmware and config
+ * - flag of 'force_reflash' has been set
+ * - device stays in bootloader
+ * - app firmware doesn't run properly
+ */
+ force_reflash = force_reflash ||
+ (IS_BOOTLOADER_MODE(tcm_dev->dev_mode)) ||
+ (IS_APP_FW_MODE(tcm_dev->dev_mode) && (app_status != APP_STATUS_OK));
+
if (force_reflash) {
type = UPDATE_FIRMWARE_CONFIG;
goto reflash;
diff --git a/tcm/synaptics_touchcom_func_romboot.c b/tcm/synaptics_touchcom_func_romboot.c
index 9ad30ad..782bb0f 100644
--- a/tcm/synaptics_touchcom_func_romboot.c
+++ b/tcm/synaptics_touchcom_func_romboot.c
@@ -1189,15 +1189,17 @@ int syna_tcm_romboot_do_ihex_update(struct tcm_dev *tcm_dev,
return _EINVAL;
}
- romboot_data = syna_pal_mem_alloc(1, sizeof(*romboot_data));
+ if (flash_size == 0)
+ flash_size = ihex_size + 4096;
+
+ romboot_data = syna_pal_mem_alloc(1,
+ sizeof(struct tcm_romboot_data_blob));
if (!romboot_data) {
- LOGE("Fail to allocate buffer for romboot_data\n");
+ LOGE("Fail to allocate romboot data blob\n");
+
return _ENOMEM;
}
- if (flash_size == 0)
- flash_size = ihex_size + 4096;
-
romboot_data->bdata = ihex;
romboot_data->bdata_size = ihex_size;
syna_pal_mem_set(&romboot_data->ihex_info, 0x00,
@@ -1210,6 +1212,7 @@ int syna_tcm_romboot_do_ihex_update(struct tcm_dev *tcm_dev,
if (!ihex_info->bin) {
LOGE("Fail to allocate buffer for ihex data\n");
syna_pal_mem_free((void *)romboot_data);
+
return _ENOMEM;
}
@@ -1358,9 +1361,12 @@ int syna_tcm_romboot_do_multichip_reflash(struct tcm_dev *tcm_dev,
struct block_data *block;
struct app_config_header *header;
unsigned int image_fw_id;
+ unsigned char *image_config_id;
+ unsigned char *device_config_id;
unsigned int erase_delay_ms = (wait_delay_ms >> 16) & 0xFFFF;
unsigned int wr_delay_ms = wait_delay_ms & 0xFFFF;
bool has_tool_boot_cfg = false;
+ bool reflash_required = false;
if (!tcm_dev) {
LOGE("Invalid tcm device handle\n");
@@ -1372,16 +1378,15 @@ int syna_tcm_romboot_do_multichip_reflash(struct tcm_dev *tcm_dev,
return _EINVAL;
}
- LOGN("Prepare to do reflash\n");
-
- romboot_data = syna_pal_mem_alloc(1, sizeof(*romboot_data));
+ romboot_data = syna_pal_mem_alloc(1,
+ sizeof(struct tcm_romboot_data_blob));
if (!romboot_data) {
- LOGE("Fail to allocate buffer for romboot_data\n");
+ LOGE("Fail to allocate romboot data blob\n");
+
return _ENOMEM;
}
- syna_pal_mem_set(romboot_data, 0x00,
- sizeof(struct tcm_romboot_data_blob));
+ LOGN("Prepare to do reflash\n");
syna_tcm_buf_init(&romboot_data->out);
@@ -1410,7 +1415,30 @@ int syna_tcm_romboot_do_multichip_reflash(struct tcm_dev *tcm_dev,
LOGN("Device firmware ID: %d, image build id: %d\n",
tcm_dev->packrat_number, image_fw_id);
- if ((image_fw_id <= tcm_dev->packrat_number) && !force_reflash) {
+ if (image_fw_id != tcm_dev->packrat_number) {
+ LOGN("Image build ID and device fw ID mismatched\n");
+ reflash_required = true;
+ }
+
+ image_config_id = header->customer_config_id;
+ device_config_id = tcm_dev->app_info.customer_config_id;
+
+ for (idx = 0; idx < MAX_SIZE_CONFIG_ID; idx++) {
+ if (image_config_id[idx] != device_config_id[idx]) {
+ LOGN("Different Config ID\n");
+ reflash_required = true;
+ }
+ }
+ /* to start the process of firmware update
+ * - fw ID or config ID is mismatched
+ * - device stays in rom-bootloader
+ * - flag of 'force_reflash' has been set
+ */
+ reflash_required = reflash_required ||
+ (IS_ROM_BOOTLOADER_MODE(tcm_dev->dev_mode)) ||
+ force_reflash;
+
+ if (!reflash_required) {
LOGN("No need to do reflash\n");
retval = 0;
goto exit;
@@ -1534,7 +1562,7 @@ exit:
syna_tcm_buf_release(&romboot_data->out);
- syna_pal_mem_free((void *)romboot_data);
+ syna_pal_mem_free(romboot_data);
return retval;
}
diff --git a/tcm/synaptics_touchcom_func_touch.c b/tcm/synaptics_touchcom_func_touch.c
index 8639fbc..d4fd617 100644
--- a/tcm/synaptics_touchcom_func_touch.c
+++ b/tcm/synaptics_touchcom_func_touch.c
@@ -178,7 +178,7 @@ static int syna_tcm_get_gesture_data(const unsigned char *report,
syna_pal_le2_to_uint(gesture_data->tap_y));
break;
default:
- LOGW("Unknown gesture_id:%d\n", gesture_id);
+ LOGD("Unknown gesture_id:%d\n", gesture_id);
break;
}
@@ -437,10 +437,9 @@ int syna_tcm_parse_touch_report(struct tcm_dev *tcm_dev,
touch_data->num_of_active_objects = data;
offset += bits;
if (touch_data->num_of_active_objects == 0) {
- if (end_of_foreach == 0) {
- LOGE("Invalid end_foreach\n");
+ if (end_of_foreach == 0)
return 0;
- }
+
idx = end_of_foreach;
}
break;