mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
net: wwan: mhi_wwan_ctrl: send a DTR drop before it can be coalesced
DTR/RTS changes are sent from a work item that only sends the latest
state, so a drop followed quickly by a raise, for example TIOCMBIC then
TIOCMBIS or a quick close and reopen, can reach the modem as just the
raise. A drop matters on its own, a modem set to AT&D2 hangs up on it.
Flush the work when DTR goes low so the drop is sent before ->dtr_rts()
returns, and flush it in stop() so any pending state is sent before the
channel is stopped. A drop that hits a full UL ring is still retried
with whatever state is latest by then.
Fixes: d509edf90b ("net: wwan: mhi_wwan_ctrl: drive DTR/RTS via the IP_CTRL channel")
Suggested-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Peter Hunt <peter.hunt@opengear.com>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>
This commit is contained in:
parent
c4ba171685
commit
10f51f4fb9
|
|
@ -209,9 +209,17 @@ static void mhi_wwan_ctrl_dtr_work(struct work_struct *work)
|
|||
static void mhi_wwan_ctrl_dtr_rts(struct wwan_port *port, unsigned int mdmbits)
|
||||
{
|
||||
struct mhi_wwan_dev *mhiwwan = wwan_port_get_drvdata(port);
|
||||
bool drop = (READ_ONCE(mhiwwan->dtr_mdmbits) & TIOCM_DTR) &&
|
||||
!(mdmbits & TIOCM_DTR);
|
||||
|
||||
WRITE_ONCE(mhiwwan->dtr_mdmbits, mdmbits);
|
||||
schedule_delayed_work(&mhiwwan->dtr_work, 0);
|
||||
|
||||
/* A DTR drop matters on its own, e.g. to hang up a modem set to AT&D2,
|
||||
* so send it now rather than let a following raise coalesce it away
|
||||
*/
|
||||
if (drop)
|
||||
flush_delayed_work(&mhiwwan->dtr_work);
|
||||
}
|
||||
|
||||
static int mhi_wwan_ctrl_start(struct wwan_port *port)
|
||||
|
|
@ -246,6 +254,9 @@ static void mhi_wwan_ctrl_stop(struct wwan_port *port)
|
|||
|
||||
cancel_work_sync(&mhiwwan->rx_refill);
|
||||
|
||||
/* Send any pending DTR/RTS state before the channel stops */
|
||||
flush_delayed_work(&mhiwwan->dtr_work);
|
||||
|
||||
mhi_unprepare_from_transfer(mhiwwan->mhi_dev);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user