qcom-soc: Add support for WWAN subsystem instead of RPMSG
Recent Linux kernel versions have introduced a generic WWAN subsystem that provides various char devices for QMI, AT etc, similar to the subsystem-specific char devices for USB or RPMSG.
The RPMSG char device for Qualcomm SoCs (e.g. MSM8916/MSM8974) are particularly complicated to work with because they need to be explicitly created from userspace with rpmsgexport and don't show up automatically.
However, it turns out it's fairly simple to wrap the RPMSG subsystem in a simple driver for the WWAN subsystem. This has several advantages:
- We can drop support for the special RPMSG char devices entirely at some point.
- The WWAN char devices show up automatically, without having to export them explicitly, making ModemManager work out of the box on these devices.
For now, just support using the WWAN subsystem alternatively for the qcom-soc plugin. Later we can consider dropping the old RPMSG code.
Related RFC on the Linux mailing lists: https://lore.kernel.org/linux-arm-msm/YLfL9Q+4860uqS8f@gerhold.net/
My WIP driver is available at: https://github.com/msm8916-mainline/linux/commits/wwan-rpmsg
There are still some open problems/questions I need to investigate, for example the problem that a write()
will likely fail instead of blocking when the TX queue for the RPMSG channel is full (this is discussed in the RFC above). It didn't cause any problems for me yet but I feel like this is going to explode for someone at some point.
I'm opening this mainly as a "FYI" and to get some comments (particularly about the FIXME comment in mm_port_subsys_to_qmi_endpoint_type()
). I don't think we should merge this until the driver is done and merged upstream. This one is really simple (just a bit more than 100 lines), so it should be quite straightforward. (After debugging some more issues I'm no longer sure. Fixing the bugs might require quite some more discussion upstream...)
Current state: Everything seems working :)
System | device: qcom-soc
| drivers: qcom-q6v5-mss, bam-dmux
| plugin: qcom-soc
| primary port: wwan0qmi0
| ports: rmnet0 (net), rmnet1 (net), rmnet2 (net), rmnet3 (net),
| rmnet4 (net), rmnet5 (net), rmnet6 (net), rmnet7 (net),
| rmnet_usb0 (ignored), wwan0at0 (at), wwan0qmi0 (qmi)
Cc: @loicpoulain