[PATCH net-next v5 0/3] net: wwan: support DTR/RTS on AT ports via MHI IP_CTRL

Peter Hunt posted 3 patches 4 days, 5 hours ago
drivers/bus/mhi/host/pci_generic.c |   2 +
drivers/net/wwan/mhi_wwan_ctrl.c   | 190 ++++++++++++++++++++++++++++-
drivers/net/wwan/wwan_core.c       |  40 +++++-
include/linux/wwan.h               |   3 +
4 files changed, 233 insertions(+), 2 deletions(-)
[PATCH net-next v5 0/3] net: wwan: support DTR/RTS on AT ports via MHI IP_CTRL
Posted by Peter Hunt 4 days, 5 hours ago
Qualcomm/Sierra SDX55/SDX65 modems (e.g. EM9291) withhold unsolicited AT
result codes until the host asserts DTR.  The in-tree mhi_wwan_ctrl driver
exposed AT ports but never signalled DTR, so URCs never reached userspace.

Patch 1 extends the wwan core with an optional ->dtr_rts(port, mdmbits) port
op.  The TIOCM bitmask state is tracked entirely in the wwan core; drivers
receive the full bitmask so they can drive DTR and RTS independently.  The
core raises DTR/RTS on first open of any AT port whose driver implements
->dtr_rts and drops them on last close, mirroring TTY semantics.  In the
ioctl path mdmbits is re-read under data_lock inside ops_lock so the value
passed always reflects the committed state and concurrent ioctls are
correctly ordered.  wwan_remove_port() also de-asserts on hot-unplug.

Patch 2 enables the IP_CTRL MHI channel in the Sierra PCI table so that
the IP_CTRL driver (patch 3) is actually bound on those controllers.

Patch 3 adds a second mhi_driver that binds the IP_CTRL channel and
registers a ->dtr_rts op so that the wwan core's open/close DTR raise/drop
and userspace TIOCMSET calls both reach the modem.  A single recycled sink
buffer keeps the IP_CTRL DL ring live so the modem's transmit path does not
stall.  The existing AT/QMI/MBIM data path is untouched.

v4: https://lore.kernel.org/netdev/20260816121705.858013-1-peter.hunt@opengear.com/

v5:
- Change ->dtr_rts from bool to unsigned int mdmbits (patch 1 + 3): DTR and
  RTS are now driven independently; fixes RTS inversion when TIOCMBIS/BIC
  changed RTS with DTR in the opposite state
- Re-read mdmbits inside ops_lock in the ioctl path (patch 1): closes a
  concurrent-ioctl ordering race where two racing TIOCM ioctls could leave
  the modem line state inconsistent with TIOCMGET
- Add ->dtr_rts(port, 0) call in wwan_remove_port() (patch 1): ensures
  DTR/RTS are de-asserted when a port is removed while an fd is still open
- Update kernel-doc to note ->dtr_rts is AT-only and describe mdmbits (patch 1)
- Pre-queue RX sink buffer in mhi_wwan_dtr_probe(), requeue in dl_xfer_cb
  (patch 3): prevents IP_CTRL DL ring from running empty and stalling the
  modem MHI transmit path

Peter Hunt (3):
  net: wwan: core: propagate modem control signals to port drivers
  bus: mhi: host: pci_generic: enumerate IP_CTRL channel for Sierra
    EM919x/EM929x
  net: wwan: mhi_wwan_ctrl: drive DTR/RTS via the IP_CTRL channel

 drivers/bus/mhi/host/pci_generic.c |   2 +
 drivers/net/wwan/mhi_wwan_ctrl.c   | 190 ++++++++++++++++++++++++++++-
 drivers/net/wwan/wwan_core.c       |  40 +++++-
 include/linux/wwan.h               |   3 +
 4 files changed, 233 insertions(+), 2 deletions(-)

-- 
2.43.0
Re: [PATCH net-next v5 0/3] net: wwan: support DTR/RTS on AT ports via MHI IP_CTRL
Posted by Paolo Abeni 3 days, 19 hours ago
On 8/20/26 12:49 AM, Peter Hunt wrote:
> Qualcomm/Sierra SDX55/SDX65 modems (e.g. EM9291) withhold unsolicited AT
> result codes until the host asserts DTR.  The in-tree mhi_wwan_ctrl driver
> exposed AT ports but never signalled DTR, so URCs never reached userspace.
> 
> Patch 1 extends the wwan core with an optional ->dtr_rts(port, mdmbits) port
> op.  The TIOCM bitmask state is tracked entirely in the wwan core; drivers
> receive the full bitmask so they can drive DTR and RTS independently.  The
> core raises DTR/RTS on first open of any AT port whose driver implements
> ->dtr_rts and drops them on last close, mirroring TTY semantics.  In the
> ioctl path mdmbits is re-read under data_lock inside ops_lock so the value
> passed always reflects the committed state and concurrent ioctls are
> correctly ordered.  wwan_remove_port() also de-asserts on hot-unplug.
> 
> Patch 2 enables the IP_CTRL MHI channel in the Sierra PCI table so that
> the IP_CTRL driver (patch 3) is actually bound on those controllers.
> 
> Patch 3 adds a second mhi_driver that binds the IP_CTRL channel and
> registers a ->dtr_rts op so that the wwan core's open/close DTR raise/drop
> and userspace TIOCMSET calls both reach the modem.  A single recycled sink
> buffer keeps the IP_CTRL DL ring live so the modem's transmit path does not
> stall.  The existing AT/QMI/MBIM data path is untouched.
## Form letter - net-next-closed

We have already submitted our pull request with net-next material for v7.3,
and therefore net-next is closed for new drivers, features, code refactoring
and optimizations. We are currently accepting bug fixes only.

Please repost when net-next reopens after Aug 31st.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle