goodix_gtx8_v1430_mmi: Add update firmware code

TP:
Add update firmware code

Change-Id: I2837a2b80dfaf11d265756eb07872fb9e9ce7721
Signed-off-by: haojl2 <haojl2@motorola.com>
Reviewed-on: https://gerrit.mot.com/1426318
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Tao Sun <suntao2@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
haojl2 2019-09-23 17:10:18 +08:00 • committed by Jialei Hao
commit 0ab2ef53fd
7 changed files with 1650 additions and 18 deletions

View file

@ -7,4 +7,10 @@ LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
include $(CLEAR_VARS)
LOCAL_MODULE := goodix_v1430_update_mmi.ko
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
include $(DLKM_DIR)/AndroidKernelModule.mk
include $(call first-makefiles-under,$(LOCAL_PATH))

View file

@ -7,3 +7,6 @@ EXTRA_CFLAGS += \
obj-m := goodix_v1430_mmi.o
goodix_v1430_mmi-objs = goodix_ts_i2c.o goodix_ts_core.o goodix_cfg_bin.o
obj-m += goodix_v1430_update_mmi.o
goodix_v1430_update_mmi-objs = goodix_gtx8_update.o

View file

@ -524,7 +524,11 @@ static int goodix_later_init_thread(void *data)
if (ts_dev->cfg_bin_state == CFG_BIN_STATE_TEMP) {
ts_err("failed get valid config data, retry after fwupdate");
ret = goodix_do_fw_update(UPDATE_MODE_BLOCK|UPDATE_MODE_FORCE|
if (!ts_core->do_fw_update) {
ts_err("fw update handler not ready.");
goto release_core;
}
ret = ts_core->do_fw_update(UPDATE_MODE_BLOCK|UPDATE_MODE_FORCE|
UPDATE_MODE_FLASH_CFG|
UPDATE_MODE_SRC_REQUEST);
if (ret) {
@ -539,12 +543,14 @@ static int goodix_later_init_thread(void *data)
}
} else {
ts_info("success parse config bin");
ret = goodix_do_fw_update(UPDATE_MODE_BLOCK|
UPDATE_MODE_FLASH_CFG|
UPDATE_MODE_SRC_REQUEST);
if (ret) {
ts_err("fw update failed, %d[ignore]", ret);
ret = 0;
if (ts_core->do_fw_update) {
ret = ts_core->do_fw_update(UPDATE_MODE_BLOCK|
UPDATE_MODE_FLASH_CFG|
UPDATE_MODE_SRC_REQUEST);
if (ret) {
ts_err("fw update failed, %d[ignore]", ret);
ret = 0;
}
}
}
ret = goodix_ts_stage2_init(ts_core);

View file

@ -0,0 +1,6 @@
#ifndef _GOODIX_FIRMWARE_FW_H_
#define _GOODIX_FIRMWARE_FW_H_
u8 goodix_default_fw[] = { 0x00};
#endif

File diff suppressed because it is too large Load diff

View file

@ -456,6 +456,8 @@ struct goodix_ts_core {
#elif defined(CONFIG_HAS_EARLYSUSPEND)
struct early_suspend early_suspend;
#endif
int (*do_fw_update)(int mode);
};
/* external module structures */
@ -744,13 +746,5 @@ int goodix_ts_fb_notifier_callback(struct notifier_block *self,
unsigned long event, void *data);
void goodix_msg_printf(const char *fmt, ...);
#ifndef CONFIG_TOUCHSCREEN_GOODIX_GTX8_UPDATE
static inline int goodix_do_fw_update(int mode)
{
return -1111;
}
#else
int goodix_do_fw_update(int mode);
#endif
#endif

View file

@ -87,6 +87,8 @@ enum TS_SEND_CFG_REPLY {
#define IRQ_HEAD_LEN_YS 8
#define IRQ_HEAD_LEN_NOR 2
static struct platform_device *goodix_pdev;
int goodix_ts_core_init(void);
#ifdef CONFIG_OF
/**
@ -1303,6 +1305,7 @@ int goodix_hw_reset(struct goodix_ts_device *dev)
*/
static int goodix_request_handler(struct goodix_ts_device *dev)
{
struct goodix_ts_core *core_data = platform_get_drvdata(goodix_pdev);
unsigned char buffer[1];
int r;
@ -1328,7 +1331,10 @@ static int goodix_request_handler(struct goodix_ts_device *dev)
break;
case REQUEST_RELOADFW:
ts_info("HW request reload fw");
goodix_do_fw_update(UPDATE_MODE_FORCE|UPDATE_MODE_SRC_REQUEST);
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.");
break;
case REQUEST_IDLE:
ts_info("HW request idle");
@ -1795,8 +1801,6 @@ static const struct goodix_ts_hw_ops hw_i2c_ops = {
.check_hw = goodix_esd_check,
};
static struct platform_device *goodix_pdev;
static void goodix_pdev_release(struct device *dev)
{
ts_info("goodix pdev released");