diff options
author | Tai Kuo <taikuo@google.com> | 2020-11-05 20:47:49 +0800 |
---|---|---|
committer | Tai Kuo <taikuo@google.com> | 2020-11-09 10:39:09 +0000 |
commit | 55811e84497a879b315560f10a7106017997e7ab (patch) | |
tree | 3ff0ddf2b534af9ed48ff260ad3cf870b3d65334 | |
parent | a49f1eca5b0001de64c272a940b54d49b1dd2635 (diff) | |
download | fts_touch-55811e84497a879b315560f10a7106017997e7ab.tar.gz |
touch: fts: support saving golden MS raw after PI
Bug: 171774250
Test: Tested with dtsi property to enable/disable this command.
Test: Golden MS raw was saved properly. Read out to check the contents
has changed.
Signed-off-by: Tai Kuo <taikuo@google.com>
Change-Id: Ib0d88fa80161f29ac6896987a68b169f3400a905
-rw-r--r-- | fts.c | 28 | ||||
-rw-r--r-- | fts.h | 1 |
2 files changed, 29 insertions, 0 deletions
@@ -4897,6 +4897,25 @@ static void fts_fw_update_auto(struct work_struct *work) fts_set_bus_ref(info, FTS_BUS_REF_FW_UPDATE, false); } +/** + * Save the golden MS raw data to the touch IC if firmware has separated it + * from the PI process. + */ +int save_golden_ms_raw(struct fts_ts_info *info) +{ + u8 cmd[3] = {0xC0, 0x01, 0x01}; + int ret = 0; + + ret = fts_write(cmd, 3); + if (ret < 0) + pr_err("Fail to save golden MS raw, ret = %d", ret); + else { + mdelay(150); /* Time to secure the saving process (90 ms) */ + pr_info("Golden MS raw is saved!"); + } + return ret; +} + /* TODO: define if need to do the full mp at the boot */ /** * Execute the initialization of the IC (supporting a retry mechanism), @@ -4916,6 +4935,9 @@ static int fts_chip_initialization(struct fts_ts_info *info, int init_type) for (retry = 0; retry < RETRY_INIT_BOOT; retry++) { #ifndef COMPUTE_INIT_METHOD ret2 = production_test_initialization(init_type); + if (ret2 == OK && + info->board->separate_save_golden_ms_raw_cmd) + save_golden_ms_raw(info); #else ret2 = production_test_main(limits_file, 1, init_type, &tests, MP_FLAG_BOOT); @@ -5988,6 +6010,12 @@ static int parse_dt(struct device *dev, struct fts_hw_platform_data *bdata) pr_info("Automatic firmware update disabled\n"); } + bdata->separate_save_golden_ms_raw_cmd = false; + if (of_property_read_bool(np, "st,save-golden-ms-raw")) { + bdata->separate_save_golden_ms_raw_cmd = true; + pr_info("Separate \"Save Golden MS Raw\" command from PI command.\n"); + } + #if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP) bdata->heatmap_mode_full_init = false; if (of_property_read_bool(np, "st,heatmap_mode_full")) { @@ -293,6 +293,7 @@ struct fts_hw_platform_data { int x_axis_max; int y_axis_max; bool auto_fw_update; + bool separate_save_golden_ms_raw_cmd; #if IS_ENABLED(CONFIG_TOUCHSCREEN_HEATMAP) bool heatmap_mode_full_init; #endif |