From: Peter Hunt <peter.hunt@opengear.com>
To: mani@kernel.org, loic.poulain@oss.qualcomm.com,
sergey.ryazanov@gmail.com
Cc: johannes@sipsolutions.net, netdev@vger.kernel.org,
mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org,
Peter Hunt <peter.hunt@opengear.com>
Subject: [PATCH net-next 1/3] net: wwan: core: propagate modem control signals to port drivers
Date: Tue, 4 Aug 2026 17:34:09 -0600 [thread overview]
Message-ID: <20260804233411.1953445-2-peter.hunt@opengear.com> (raw)
In-Reply-To: <20260804233411.1953445-1-peter.hunt@opengear.com>
The WWAN character device emulates the TTY modem-control ioctls
(TIOCMGET/TIOCMSET/TIOCMBIC/TIOCMBIS) for AT and QCDM ports, but the
result is only stored in port->at_data.mdmbits and never reaches the port
driver. A driver therefore cannot act on the host raising or dropping
DTR/RTS, even though some modems depend on it (e.g. they withhold
unsolicited AT result codes until the host asserts DTR).
Add optional ->tiocmget/->tiocmset operations to struct wwan_port_ops and
call them from the AT/QCDM ioctl path. ->tiocmset is passed the resolved
TIOCM_* bitmask after BIC/BIS/SET has been applied; ->tiocmget, when
provided, refreshes the cached bits from the device. Drivers that do not
implement them keep the previous store-only behaviour.
Signed-off-by: Peter Hunt <peter.hunt@opengear.com>
---
drivers/net/wwan/wwan_core.c | 12 +++++++++++-
include/linux/wwan.h | 4 ++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index ffbcf11e4e68..bf83eb5790fe 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -1018,7 +1018,15 @@ static long wwan_port_fops_at_ioctl(struct wwan_port *port, unsigned int cmd,
#endif
case TIOCMGET:
- ret = put_user(port->at_data.mdmbits, (int __user *)arg);
+ if (port->ops->tiocmget) {
+ ret = port->ops->tiocmget(port);
+ if (ret >= 0) {
+ port->at_data.mdmbits = ret;
+ ret = 0;
+ }
+ }
+ if (!ret)
+ ret = put_user(port->at_data.mdmbits, (int __user *)arg);
break;
case TIOCMSET:
@@ -1036,6 +1044,8 @@ static long wwan_port_fops_at_ioctl(struct wwan_port *port, unsigned int cmd,
port->at_data.mdmbits |= mdmbits;
else
port->at_data.mdmbits = mdmbits;
+ if (port->ops->tiocmset)
+ ret = port->ops->tiocmset(port, port->at_data.mdmbits);
break;
}
diff --git a/include/linux/wwan.h b/include/linux/wwan.h
index 1e0e2cb53579..bac02521e274 100644
--- a/include/linux/wwan.h
+++ b/include/linux/wwan.h
@@ -57,6 +57,8 @@ struct wwan_port;
* @tx_blocking: Optional blocking routine that sends WWAN port protocol data
* to the device.
* @tx_poll: Optional routine that sets additional TX poll flags.
+ * @tiocmget: Optional routine that reads the modem control lines.
+ * @tiocmset: Optional routine that sets the modem control lines.
*
* The wwan_port_ops structure contains a list of low-level operations
* that control a WWAN port device. All functions are mandatory unless specified.
@@ -70,6 +72,8 @@ struct wwan_port_ops {
int (*tx_blocking)(struct wwan_port *port, struct sk_buff *skb);
__poll_t (*tx_poll)(struct wwan_port *port, struct file *filp,
poll_table *wait);
+ int (*tiocmget)(struct wwan_port *port);
+ int (*tiocmset)(struct wwan_port *port, unsigned int mdmbits);
};
/** struct wwan_port_caps - The WWAN port capbilities
--
2.43.0
next prev parent reply other threads:[~2026-08-05 0:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 23:34 [PATCH net-next 0/3] net: wwan: support DTR/RTS on AT ports via MHI IP_CTRL Peter Hunt
2026-08-04 23:34 ` Peter Hunt [this message]
2026-08-04 23:34 ` [PATCH net-next 2/3] bus: mhi: host: pci_generic: enumerate IP_CTRL channel for Sierra EM919x/EM929x Peter Hunt
2026-08-04 23:34 ` [PATCH net-next 3/3] net: wwan: mhi_wwan_ctrl: drive DTR/RTS via the IP_CTRL channel Peter Hunt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804233411.1953445-2-peter.hunt@opengear.com \
--to=peter.hunt@opengear.com \
--cc=johannes@sipsolutions.net \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=mani@kernel.org \
--cc=mhi@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=sergey.ryazanov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox