From: Muhammad Nuzaihan <zaihan@unrealasia.net>
To: Slark Xiao <slark_xiao@163.com>
Cc: Loic Poulain <loic.poulain@linaro.org>,
Sergey Ryazanov <ryazanov.s.a@gmail.com>,
Johannes Berg <johannes@sipsolutions.net>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re:Re: [PATCH net-next v4] wwan dev: Add port for NMEA channel for WWAN devices
Date: Wed, 08 Jan 2025 04:19:05 +0800 [thread overview]
Message-ID: <T3JQPS.DLBZIVAM0L9Q2@unrealasia.net> (raw)
In-Reply-To: <3c7d38cb.5336.1943f5e66de.Coremail.slark_xiao@163.com>
[-- Attachment #1: Type: text/plain, Size: 3355 bytes --]
Hi Everyone, Sorry for the last (HTML) email.
Seemed i forgot Gmail sends HTML email by default and Geary client was
broken.
Slark - I've got some vague idea on how it can be implemented with GNSS
according to your helpful last email which helps clear some things.
But the patch i'm giving does not work. (NULL deference err,
possibly due to gdev being NULL).
Just sharing on some progress i've made.
I'm still looking at it and trying to figure out though.
On Tue, Jan 7 2025 at 02:05:38 PM +0800, Slark Xiao
<slark_xiao@163.com> wrote:
>
> At 2025-01-07 03:44:35, "Loic Poulain" <loic.poulain@linaro.org>
> wrote:
>> Hi Muhammad,
>>
>> + Slark
>>
>> On Sun, 5 Jan 2025 at 13:53, Muhammad Nuzaihan
>> <zaihan@unrealasia.net> wrote:
>>>
>>> Based on the code: drivers/bus/mhi/host/pci_generic.c
>>> which already has NMEA channel (mhi_quectel_em1xx_channels)
>>> support in recent kernels but it is never exposed
>>> as a port.
>>>
>>> This commit exposes that NMEA channel to a port
>>> to allow tty/gpsd programs to read through
>>> the /dev/wwan0nmea0 port.
>>>
>>> Tested this change on a new kernel and module
>>> built and now NMEA (mhi0_NMEA) statements are
>>> available (attached) through /dev/wwan0nmea0 port on bootup.
>>>
>>> Signed-off-by: Muhammad Nuzaihan Bin Kamal Luddin
>>> <zaihan@unrealasia.net>
>>
>> This works for sure but I'm not entirely convinced NMEA should be
>> exposed as a modem control port. In your previous patch version
>> Sergey
>> pointed to a discussion we had regarding exposing that port as WWAN
>> child device through the regular GNSS subsystem, which would require
>> some generic bridge in the WWAN subsystem.
>>
>> Slark, did you have an opportunity to look at the GNSS solution?
>>
>> Regards,
>> Loic
>
> Hi Loic,
> This solution same as what I did in last time. We got a wwan0nmea0
> device but this
> device can't support flow control.
> Also, this is not the solution what Sergey expected, I think.
> Please refer to the target we talked last time:
> /////////////////////
>>>> Basically, components should interact like this:
>>>>
>>>> Modem PCIe driver <-> WWAN core <-> GNSS core <-> /dev/gnss0
>>>>
>>>> We need the GNSS core to export the modem NMEA port as instance of
>>>> 'gnss' class.
>>>>
>>>> We need WWAN core between the modem driver and the GSNN core
>>>> because we
>>>> need a common parent for GNSS port and modem control port (e.g.
>>>> AT,
>>>> MBIM). Since we are already exporting control ports via the WWAN
>>>> subsystem, the GNSS port should also be exported through the WWAN
>>>> subsystem. To keep devices hierarchy like this:
>>>>
>>>> .--> AT port
>>>> PCIe dev -> WWAN dev -|
>>>> '--> GNSS port
>>>>
>>>> Back to the implementation. Probably we should introduce a new
>>>> port
>>>> type, e.g. WWAN_PORT_NMEA. And this port type should have a
>>>> special
>>>> handling in the WWAN core.
>>>>
>>> Similar like what I did in my local. I named it as WWAN_PORT_GNSS
>>> and
>>> put it as same level with AT port.
>>>
>>>> wwan_create_port() function should not directly create a char
>>>> device.
>>>> Instead, it should call gnss_allocate_device() and
>>>> gnss_register_device() to register the port with GNSS subsystem.
> ////////////////////
>
> Thanks
>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: expose-nmea-to-gnss.patch --]
[-- Type: text/x-patch, Size: 1155 bytes --]
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index ebf574f2b126..abd76ef097bc 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -6,6 +6,7 @@
#include <linux/errno.h>
#include <linux/debugfs.h>
#include <linux/fs.h>
+#include <linux/gnss.h>
#include <linux/init.h>
#include <linux/idr.h>
#include <linux/kernel.h>
@@ -342,10 +343,6 @@ static const struct {
.name = "MIPC",
.devsuf = "mipc",
},
- [WWAN_PORT_NMEA] = {
- .name = "NMEA",
- .devsuf = "nmea",
- },
};
static ssize_t type_show(struct device *dev, struct device_attribute *attr,
@@ -460,6 +457,14 @@ struct wwan_port *wwan_create_port(struct device *parent,
if (type > WWAN_PORT_MAX || !ops)
return ERR_PTR(-EINVAL);
+ /* NMEA check to attach GNSS port */
+ if (type == WWAN_PORT_NMEA) {
+ struct gnss_device *gdev = gnss_allocate_device(parent);
+
+ if (gdev)
+ gnss_register_device(gdev);
+ }
+
/* A port is always a child of a WWAN device, retrieve (allocate or
* pick) the WWAN device based on the provided parent device.
*/
next prev parent reply other threads:[~2025-01-07 20:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-05 12:48 Muhammad Nuzaihan
2025-01-06 19:44 ` Loic Poulain
2025-01-07 6:05 ` Slark Xiao
2025-01-07 20:19 ` Muhammad Nuzaihan [this message]
2025-01-07 23:42 ` Sergey Ryazanov
2025-01-08 8:59 ` [RFC " Muhammad Nuzaihan
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=T3JQPS.DLBZIVAM0L9Q2@unrealasia.net \
--to=zaihan@unrealasia.net \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=loic.poulain@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ryazanov.s.a@gmail.com \
--cc=slark_xiao@163.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
all inboxes | Powered by JetHome®