From 7b9a0eb2374884d9625f8a901fea119e129c8fb2 Mon Sep 17 00:00:00 2001 From: Ryan Erickson Date: Thu, 13 Jun 2024 10:35:40 -0500 Subject: [PATCH] modem: hl7800: stay awake for firmware update Ensure the HL7800 stays awake for the entire firmware update. Signed-off-by: Ryan Erickson --- drivers/modem/hl7800.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index dbfeff75ed4..dc1ce690839 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -476,6 +476,7 @@ struct hl7800_iface_ctx { int file_pos; struct k_work finish_fw_update_work; bool fw_updated; + bool fw_updating; #endif /* modem info */ @@ -815,6 +816,11 @@ static struct hl7800_socket *socket_from_id(int socket_id) static inline void set_busy(bool busy) { +#ifdef CONFIG_MODEM_HL7800_FW_UPDATE + if (iface_ctx.fw_updating && !busy) { + return; + } +#endif iface_ctx.busy = busy; } @@ -2636,6 +2642,7 @@ static bool on_cmd_startup_report(struct net_buf **buf, uint16_t len) #ifdef CONFIG_MODEM_HL7800_FW_UPDATE if (iface_ctx.fw_updated) { iface_ctx.fw_updated = false; + iface_ctx.fw_updating = false; set_fota_state(HL7800_FOTA_REBOOT_AND_RECONFIGURE); /* issue reset after a firmware update to reconfigure modem state */ k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.mdm_reset_work, @@ -6314,6 +6321,7 @@ int32_t mdm_hl7800_update_fw(char *file_path) if (ret < 0) { goto err; } + iface_ctx.fw_updating = true; notify_all_tcp_sockets_closed(); hl7800_stop_rssi_work(); @@ -6407,6 +6415,7 @@ static int hl7800_init(const struct device *dev) k_work_init(&iface_ctx.finish_fw_update_work, finish_fw_update_work_callback); iface_ctx.fw_updated = false; + iface_ctx.fw_updating = false; #endif /* setup port devices and pin directions */