tty: n_smux: Reset Power Collapse Enabled Flag
Reset the power-collapse-enabled flag to allow renegotiation when the
remote modem restarts.
Without this change, the external modem will boot assuming that power
collapse is disabled, but the Apps will have the previous state cached
and may not send the proper power-collapse-enabled handshaking.
Change-Id: I58acbfa51b60fde23d328239fd6b330bf0bcc63f
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
diff --git a/drivers/tty/n_smux.c b/drivers/tty/n_smux.c
index a59e47e..d03b4b4 100644
--- a/drivers/tty/n_smux.c
+++ b/drivers/tty/n_smux.c
@@ -3124,11 +3124,22 @@
unsigned long flags;
int power_off_uart = 0;
- if (code != SUBSYS_AFTER_SHUTDOWN)
+ if (code == SUBSYS_BEFORE_SHUTDOWN) {
+ SMUX_DBG("%s: ssr - before shutdown\n", __func__);
+ mutex_lock(&smux.mutex_lha0);
+ smux.in_reset = 1;
+ mutex_unlock(&smux.mutex_lha0);
return NOTIFY_DONE;
+ } else if (code != SUBSYS_AFTER_SHUTDOWN) {
+ return NOTIFY_DONE;
+ }
+ SMUX_DBG("%s: ssr - after shutdown\n", __func__);
/* Cleanup channels */
+ mutex_lock(&smux.mutex_lha0);
smux_lch_purge();
+ if (smux.tty)
+ tty_driver_flush_buffer(smux.tty);
/* Power-down UART */
spin_lock_irqsave(&smux.tx_lock_lha2, flags);
@@ -3137,11 +3148,15 @@
smux.power_state = SMUX_PWR_OFF;
power_off_uart = 1;
}
+ smux.powerdown_enabled = 0;
spin_unlock_irqrestore(&smux.tx_lock_lha2, flags);
if (power_off_uart)
smux_uart_power_off();
+ smux.in_reset = 0;
+ mutex_unlock(&smux.mutex_lha0);
+
return NOTIFY_DONE;
}
@@ -3245,6 +3260,7 @@
if (smux.power_state == SMUX_PWR_OFF)
power_up_uart = 1;
smux.power_state = SMUX_PWR_OFF;
+ smux.powerdown_enabled = 0;
spin_unlock_irqrestore(&smux.tx_lock_lha2, flags);
if (power_up_uart)