From ab9715031cc00cc87e7f9c2717ef79bf1c7538e5 Mon Sep 17 00:00:00 2001 From: Ryan Erickson Date: Tue, 3 May 2022 10:52:15 -0500 Subject: [PATCH] modem: hl7800: fix UART shutdown Allow CTS line to determine UART shutdown for any sleep mode. This allows lower average current consumption for LITE HIBERNATE mode. Signed-off-by: Ryan Erickson --- drivers/modem/hl7800.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/modem/hl7800.c b/drivers/modem/hl7800.c index 9b5c8a59fbb..350717cb4fc 100644 --- a/drivers/modem/hl7800.c +++ b/drivers/modem/hl7800.c @@ -4698,8 +4698,6 @@ static void mdm_vgpio_work_cb(struct k_work *item) ictx.desired_sleep_level == HL7800_SLEEP_LITE_HIBERNATE) { if (ictx.sleep_state != ictx.desired_sleep_level) { set_sleep_state(ictx.desired_sleep_level); - } else { - LOG_WRN("Unexpected sleep condition"); } } if (ictx.iface && ictx.initialized && net_if_is_up(ictx.iface) && @@ -4842,15 +4840,15 @@ void mdm_uart_cts_callback(const struct device *port, struct gpio_callback *cb, } #ifdef CONFIG_MODEM_HL7800_LOW_POWER_MODE - if (ictx.desired_sleep_level == HL7800_SLEEP_SLEEP) { - if (ictx.cts_state) { - /* HL7800 is not awake, shut down UART to save power */ + if (ictx.cts_state) { + /* HL7800 is not awake, shut down UART to save power */ + if (ictx.allow_sleep) { shutdown_uart(); - } else { - power_on_uart(); - if (ictx.sleep_state == HL7800_SLEEP_SLEEP) { - allow_sleep(false); - } + } + } else { + power_on_uart(); + if (ictx.sleep_state == HL7800_SLEEP_SLEEP) { + allow_sleep(false); } } #endif