summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Chung <nickchung@google.com>2020-05-28 15:56:21 +0800
committerNick Chung <nickchung@google.com>2020-05-28 15:56:21 +0800
commitf4050a7238a21aebf9a98f4928bc8e04e7b135f5 (patch)
treec344d142ce764886e1d78cabafe6e23c1bec25ea
parenta4bf41a8a03d68a9f88a8c6040f62f85a05c1c7f (diff)
downloadcamera-kernel-f4050a7238a21aebf9a98f4928bc8e04e7b135f5.tar.gz
techpack: camera: add recovery mechanism to enforce fw update
If the firmware is broken or in unexpected status due to the power drop or other reason, it will make the module breakage. To reduce the firmware update failure risk, add recovery mechanism that can enforce FW update again after reboot. Bug: 157103802 Test: build pass, recovery mechanism is workable. Signed-off-by: Nick Chung <nickchung@google.com> Change-Id: I687f3e42c26173b79199087081ed1558ea9a85f2
-rw-r--r--drivers/cam_sensor_module/cam_fw_update/fw_update.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/cam_sensor_module/cam_fw_update/fw_update.c b/drivers/cam_sensor_module/cam_fw_update/fw_update.c
index 2412211..f68bbc7 100644
--- a/drivers/cam_sensor_module/cam_fw_update/fw_update.c
+++ b/drivers/cam_sensor_module/cam_fw_update/fw_update.c
@@ -141,6 +141,12 @@ int doFWupdate(UINT_16 CAL_ID, UINT_32 MODULE_MAKER)
if (module_angle == MA_WIDE && CAL_ID == 0x3)
code_header = 0x01;
+ // If fw update failure, use recovery mechanism to enforce fw update.
+ if(CAL_ID == 0x0 && module_vendor == 0x0) {
+ code_vendor = 9;
+ code_header = 0x01;
+ }
+
if (code_vendor != 0 && code_header != 0) {
BootMode();
CAM_INFO(CAM_SENSOR,
@@ -194,7 +200,7 @@ bool checkOISFWversion(UINT_16 *cal_id, UINT_32 *module_maker)
"[OISFW]:%s CAL_ID = 0x%04x, MODULE_MAKER = 0x%x\n",
__func__, *cal_id, *module_maker);
- if (FW_version >= OIS_CUR_FW_VERSION) {
+ if (FW_version >= OIS_CUR_FW_VERSION && FW_version != 0x00) {
CAM_INFO(CAM_SENSOR,
"[OISFW]%s: No need to update.\n", __func__);
} else {