diff --git a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_cfg_bin.c b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_cfg_bin.c index 53540d4f8e22..a2cbdd26c768 100644 --- a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_cfg_bin.c +++ b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_cfg_bin.c @@ -526,14 +526,22 @@ static int goodix_later_init_thread(void *data) ts_err("failed get valid config data, retry after fwupdate"); if (!ts_core->do_fw_update) { ts_err("fw update handler not ready."); +#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI + goto update_fw_later; +#else goto release_core; +#endif } ret = ts_core->do_fw_update(UPDATE_MODE_BLOCK|UPDATE_MODE_FORCE| UPDATE_MODE_FLASH_CFG| UPDATE_MODE_SRC_REQUEST); if (ret) { ts_err("fw update failed, %d", ret); +#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI + goto update_fw_later; +#else goto release_core; +#endif } ts_info("fw update success retry parse cfg bin"); ret = goodix_cfg_bin_proc(ts_core); @@ -541,6 +549,9 @@ static int goodix_later_init_thread(void *data) ts_err("failed parse cfg bin after fw update"); goto release_core; } +#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI + goto stage2_init; +#endif } else { ts_info("success parse config bin"); if (ts_core->do_fw_update) { @@ -548,11 +559,19 @@ static int goodix_later_init_thread(void *data) UPDATE_MODE_FLASH_CFG| UPDATE_MODE_SRC_REQUEST); if (ret) { - ts_err("fw update failed, %d[ignore]", ret); + ts_info("fw update failed, %d[ignore]", ret); ret = 0; } } +#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI + goto stage2_init; +#endif } +#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI +update_fw_later: + ts_core->ts_mmi_info.need_reflash = 1; +stage2_init: +#endif ret = goodix_ts_stage2_init(ts_core); if (!ret) { ts_info("stage2 init success"); diff --git a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_gtx8_update.c b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_gtx8_update.c index 35cb56ef69f3..97d3037c0ef0 100644 --- a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_gtx8_update.c +++ b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_gtx8_update.c @@ -1533,11 +1533,13 @@ static int goodix_fw_update_init(struct goodix_ts_core *core_data, goodix_fw_update_ctrl.initialized = 1; err_out: mutex_unlock(&goodix_fw_update_ctrl.mutex); +#ifndef CONFIG_INPUT_TOUCHSCREEN_MMI if (!ret) { goodix_do_fw_update(UPDATE_MODE_SRC_REQUEST); if (ret) ts_err("fw update failed, %d", ret); } +#endif return ret; } diff --git a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_core.h b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_core.h index 2d4e309ffcc2..e5c5378b3e64 100644 --- a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_core.h +++ b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_core.h @@ -417,6 +417,7 @@ struct goodix_ts_esd { struct goodix_ts_mmi { struct notifier_block mmi_notifier; int update_status; + int need_reflash; }; #endif diff --git a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_i2c.c b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_i2c.c index f0b308935ffa..6d0aeecf5f5e 100644 --- a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_i2c.c +++ b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_i2c.c @@ -1337,10 +1337,23 @@ static int goodix_request_handler(struct goodix_ts_device *dev) break; case REQUEST_RELOADFW: ts_info("HW request reload fw"); +#ifdef CONFIG_INPUT_TOUCHSCREEN_MMI + if (core_data && core_data->do_fw_update) { + r = core_data->do_fw_update(UPDATE_MODE_FORCE|UPDATE_MODE_SRC_REQUEST); + if (r) { + ts_err("fw update failed, %d[try later]", r); + core_data->ts_mmi_info.need_reflash = 1; + } + } else { + ts_err("fw update handler not ready [try later]."); + core_data->ts_mmi_info.need_reflash = 1; + } +#else if (core_data && core_data->do_fw_update) core_data->do_fw_update(UPDATE_MODE_FORCE|UPDATE_MODE_SRC_REQUEST); else ts_err("fw update handler not ready."); +#endif break; case REQUEST_IDLE: ts_info("HW request idle"); diff --git a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_mmi.c b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_mmi.c index 8613efa1cdb5..4857adc26753 100644 --- a/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_mmi.c +++ b/drivers/input/touchscreen/goodix_gtx8_v1430_mmi/goodix_ts_mmi.c @@ -110,7 +110,10 @@ static int goodix_ts_mmi_methods_get_flashprog(struct device *dev, void *idata) ts_err("Failed to get driver data"); return -ENODEV; } - TO_INT(idata) = core_data->ts_mmi_info.update_status; + if (core_data->ts_mmi_info.need_reflash) + TO_INT(idata) = 1; + else + TO_INT(idata) = core_data->ts_mmi_info.update_status; return 0; } static int goodix_ts_mmi_methods_drv_irq(struct device *dev, int state) { @@ -168,6 +171,7 @@ static int goodix_ts_firmware_update(struct device *dev, char *fwname) { ts_err("fw update handler not ready."); return -EFAULT; } + core_data->ts_mmi_info.need_reflash = 0; return 0; }