From 729d851d88a93434ad314352e09babe283736d42 Mon Sep 17 00:00:00 2001 From: Eric Holmberg Date: Fri, 15 Jun 2012 09:58:46 -0600 Subject: [PATCH] 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 --- drivers/tty/n_smux.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_smux.c b/drivers/tty/n_smux.c index e0f8af7a5f8c..0c6e353d780d 100644 --- a/drivers/tty/n_smux.c +++ b/drivers/tty/n_smux.c @@ -3124,11 +3124,22 @@ static int ssr_notifier_cb(struct notifier_block *this, 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 @@ static int ssr_notifier_cb(struct notifier_block *this, 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 @@ static void smuxld_close(struct tty_struct *tty) 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)