Skip to contentSkip to conversation

How to add RTS support for wwan0at0 port

DISCUSSION Loic Poulain 4 participants 13 messages Nov 19, 2024 – Dec 6, 2024 3 messages not in the archive MHI bus

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAOZjjh=Vre7Xn9-qjZ38eoAtD5AsiJM7hU+iGFjUqt+ZopTBxA@mail.gmail.com

#2 lore raw

Hi

+ Sergey,

Quoted 8 lines
Quoted 8 lines

Hi Loic,
I tried to add RTS signal support for our AT port of wwan device. Now we can know that we are using wwan_port_fops_at_ioctl() for this configuration.
Actually, there are 2 cmd will be ignored by default: TIOCGRS485 and TIOCSRS485 when you tried to use "minicom -D /dev/wwan0at0". Then I added it into that switch statement. May I know if the "mdmbits" corresponding to the defination in termios.h?

Yes, so the initial goal was to support 'legacy' terminal emulators, adding no-op stubs for usual termios ioctls.

If I understand correctly, you don't only want stubs, but you need them to implement flow control on top of MHI? If so, I think you can access the port at_data->mbmbits from the mhi_ctrl port driver under data->lock. You may also need a way to forward ioctl 'events' to the driver... Wondering if this flow control could simply be supported generically at wwan-core level?

Quoted 43 lines
Quoted 32 lines

Below are some test results in wwan_port_fops_at_ioctl():

//sudo minicom -D /dev/wwan0at0:

[ 1773.390038] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390062] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 93936443291456
[ 1773.390069] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389408
[ 1773.390078] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389392
[ 1773.390082] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389344
[ 1773.390087] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389344
[ 1773.390092] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 140726000389500
[ 1773.390097] wwan wwan0: ##shawn debug## cmd is 0x5418, arg is 140726000389500
[ 1773.390101] wwan wwan0: ##shawn debug1## mdmbits is 4
[ 1773.390106] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389408
[ 1773.390112] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389392
[ 1773.390116] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389344
[ 1773.390120] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389344
[ 1773.390126] wwan wwan0: ##shawn debug## cmd is 0x542e, arg is 140726000389568
[ 1773.390131] wwan wwan0: ##shawn debug## cmd is 0x542f, arg is 140726000389568
[ 1773.390135] wwan wwan0: ##shawn debug1## mdmbits is 0
[ 1773.390153] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390158] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389632
[ 1773.390163] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389584
[ 1773.390167] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389584
[ 1773.390172] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390177] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389632
[ 1773.390181] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389584
[ 1773.390185] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389584
[ 1773.390191] wwan wwan0: ##shawn debug## cmd is 0x540b, arg is 2
[ 1773.393848] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 140726000390084
[ 1773.393861] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000390064
Quoted 7 lines

I checked the old architecture of Qualcomm PCIE driver, and I found that they support these signal like RTS,DTR and so on.
Please see: https://git.codelinaro.org/clo/le/platform/mhi-host
file: drivers/net/wwan/mhi_dtr.c

Thanks

--
மணிவண்ணன் சதாசிவம்

#3 lore raw

Hi Loic, Slark,

nice to see you, please find a small note below.

Quoted 10 lines · Loic Poulain
Quoted 7 lines
Quoted 7 lines

I tried to add RTS signal support for our AT port of wwan device. Now we can know that we are using wwan_port_fops_at_ioctl() for this configuration.
Actually, there are 2 cmd will be ignored by default: TIOCGRS485 and TIOCSRS485 when you tried to use "minicom -D /dev/wwan0at0". Then I added it into that switch statement. May I know if the "mdmbits" corresponding to the defination in termios.h?

Yes, so the initial goal was to support 'legacy' terminal emulators, adding no-op stubs for usual termios ioctls.

Exactly! IOCTL support is just a stub. You can find all the details in the commit c230035c2f2f ("net: wwan: core: implement terminal ioctls for AT port").

Regarding the 'mdmbits' field, it contains so called 'modem bits', see tty_ioctl(4). Bits are handled by the core in an opaque way. Core saves bits from a user's TIOCMSET command and returns bits back in the TIOCMGET request. Copying is done without checking any of these bits, just copy sizeof(int) bytes to/from userspace and that's it.

Quoted 6 lines

If I understand correctly, you don't only want stubs, but you need them to implement flow control on top of MHI? If so, I think you can access the port at_data->mbmbits from the mhi_ctrl port driver under data->lock. You may also need a way to forward ioctl 'events' to the driver... Wondering if this flow control could simply be supported generically at wwan-core level?

Suddenly the 'at_data' field belongs to the port structure private to the WWAN core. And a flow control implementation could be tricky. Ultimately, it's a nice option to have the flow control implemented in the core. Depending on a number of users.

For a single driver, I believe, the most convenient option is to implement everything in the driver. E.g. introduce an 'ioctl' operation to the wwan_port_ops. And, if core sees the 'ioctl' operation implemented, then it will forward all the IOCTLs to the driver bypassing internal stub implementation.

In some moment in the future, we can implement a generic flow control in the core. In case there are will be more than one driver requiring it. Is it make sense?

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

Below are some test results in wwan_port_fops_at_ioctl():

//sudo minicom -D /dev/wwan0at0:

[ 1773.390038] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390062] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 93936443291456
[ 1773.390069] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389408
[ 1773.390078] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389392
[ 1773.390082] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389344
[ 1773.390087] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389344
[ 1773.390092] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 140726000389500
[ 1773.390097] wwan wwan0: ##shawn debug## cmd is 0x5418, arg is 140726000389500
[ 1773.390101] wwan wwan0: ##shawn debug1## mdmbits is 4
[ 1773.390106] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389408
[ 1773.390112] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389392
[ 1773.390116] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389344
[ 1773.390120] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389344
[ 1773.390126] wwan wwan0: ##shawn debug## cmd is 0x542e, arg is 140726000389568
[ 1773.390131] wwan wwan0: ##shawn debug## cmd is 0x542f, arg is 140726000389568
[ 1773.390135] wwan wwan0: ##shawn debug1## mdmbits is 0
[ 1773.390153] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390158] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389632
[ 1773.390163] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389584
[ 1773.390167] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389584
[ 1773.390172] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390177] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389632
[ 1773.390181] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389584
[ 1773.390185] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389584
[ 1773.390191] wwan wwan0: ##shawn debug## cmd is 0x540b, arg is 2
[ 1773.393848] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 140726000390084
[ 1773.393861] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000390064
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I checked the old architecture of Qualcomm PCIE driver, and I found that they support these signal like RTS,DTR and so on.
Please see: https://git.codelinaro.org/clo/le/platform/mhi-host
file: drivers/net/wwan/mhi_dtr.c

Slark, I cannot find this file. Shall I check a specific branch of the repository?

--
Sergey

#4 lore raw

Hi Loic, Sergey,

Please see my response as below.

Quoted 20 lines · Sergey Ryazanov

Hi Loic, Slark,

nice to see you, please find a small note below.

Quoted 10 lines · Loic Poulain
Quoted 7 lines
Quoted 7 lines

I tried to add RTS signal support for our AT port of wwan device. Now we can know that we are using wwan_port_fops_at_ioctl() for this configuration.
Actually, there are 2 cmd will be ignored by default: TIOCGRS485 and TIOCSRS485 when you tried to use "minicom -D /dev/wwan0at0". Then I added it into that switch statement. May I know if the "mdmbits" corresponding to the defination in termios.h?

Yes, so the initial goal was to support 'legacy' terminal emulators, adding no-op stubs for usual termios ioctls.

Exactly! IOCTL support is just a stub. You can find all the details in the commit c230035c2f2f ("net: wwan: core: implement terminal ioctls for AT port").

Quoted 5 lines

Regarding the 'mdmbits' field, it contains so called 'modem bits', see tty_ioctl(4). Bits are handled by the core in an opaque way. Core saves bits from a user's TIOCMSET command and returns bits back in the TIOCMGET request. Copying is done without checking any of these bits, just copy sizeof(int) bytes to/from userspace and that's it.

May I know if these bits (copy from user) has been sent to device over the driver? So far it seems that we didn't receive these bits in device side.

Quoted 8 lines
Quoted 7 lines

If I understand correctly, you don't only want stubs, but you need them to implement flow control on top of MHI? If so, I think you can access the port at_data->mbmbits from the mhi_ctrl port driver under data->lock. You may also need a way to forward ioctl 'events' to the driver... Wondering if this flow control could simply be supported generically at wwan-core level?

Quoted 5 lines

Suddenly the 'at_data' field belongs to the port structure private to the WWAN core. And a flow control implementation could be tricky. Ultimately, it's a nice option to have the flow control implemented in the core. Depending on a number of users.

Yes, we need that flow control for these "serial" port. Currently we still don't have the NMEA support over PCIE(MHI). Device GPS daemon needs such a RTS signal from host side to start GPS.
Windows use GNSS driver(not same as Linux GNSS) to support GPS. But for MHI device this feature is none, I think.

Quoted 10 lines

For a single driver, I believe, the most convenient option is to implement everything in the driver. E.g. introduce an 'ioctl' operation to the wwan_port_ops. And, if core sees the 'ioctl' operation implemented, then it will forward all the IOCTLs to the driver bypassing internal stub implementation.

In some moment in the future, we can implement a generic flow control in the core. In case there are will be more than one driver requiring it. Is it make sense?

Exactly!

Quoted 31 lines
Quoted 31 lines
Quoted 31 lines
Quoted 31 lines

Below are some test results in wwan_port_fops_at_ioctl():

//sudo minicom -D /dev/wwan0at0:

[ 1773.390038] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390062] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 93936443291456
[ 1773.390069] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389408
[ 1773.390078] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389392
[ 1773.390082] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389344
[ 1773.390087] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389344
[ 1773.390092] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 140726000389500
[ 1773.390097] wwan wwan0: ##shawn debug## cmd is 0x5418, arg is 140726000389500
[ 1773.390101] wwan wwan0: ##shawn debug1## mdmbits is 4
[ 1773.390106] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389408
[ 1773.390112] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389392
[ 1773.390116] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389344
[ 1773.390120] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389344
[ 1773.390126] wwan wwan0: ##shawn debug## cmd is 0x542e, arg is 140726000389568
[ 1773.390131] wwan wwan0: ##shawn debug## cmd is 0x542f, arg is 140726000389568
[ 1773.390135] wwan wwan0: ##shawn debug1## mdmbits is 0
[ 1773.390153] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390158] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389632
[ 1773.390163] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389584
[ 1773.390167] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389584
[ 1773.390172] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389648
[ 1773.390177] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389632
[ 1773.390181] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is 140726000389584
[ 1773.390185] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000389584
[ 1773.390191] wwan wwan0: ##shawn debug## cmd is 0x540b, arg is 2
[ 1773.393848] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is 140726000390084
[ 1773.393861] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is 140726000390064
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

I checked the old architecture of Qualcomm PCIE driver, and I found that they support these signal like RTS,DTR and so on.
Please see: https://git.codelinaro.org/clo/le/platform/mhi-host
file: drivers/net/wwan/mhi_dtr.c

Slark, I cannot find this file. Shall I check a specific branch of the repository?

Please choose these latest tags which updated 2 months ago. Like "LE.LNXHOSTSW2.0-33300-LNXHOSTSW.0"

Quoted 2 lines

--
Sergey

#5 lore raw
Quoted 17 lines · Slark Xiao
Quoted 16 lines · Sergey Ryazanov
Quoted 10 lines · Loic Poulain
Quoted 7 lines
Quoted 7 lines

I tried to add RTS signal support for our AT port of wwan device. Now we can know that we are using wwan_port_fops_at_ioctl() for this configuration.
Actually, there are 2 cmd will be ignored by default: TIOCGRS485 and TIOCSRS485 when you tried to use "minicom -D /dev/wwan0at0". Then I added it into that switch statement. May I know if the "mdmbits" corresponding to the defination in termios.h?

Yes, so the initial goal was to support 'legacy' terminal emulators, adding no-op stubs for usual termios ioctls.

Exactly! IOCTL support is just a stub. You can find all the details in the commit c230035c2f2f ("net: wwan: core: implement terminal ioctls for AT port").

Quoted 8 lines
Quoted 5 lines

Regarding the 'mdmbits' field, it contains so called 'modem bits', see tty_ioctl(4). Bits are handled by the core in an opaque way. Core saves bits from a user's TIOCMSET command and returns bits back in the TIOCMGET request. Copying is done without checking any of these bits, just copy sizeof(int) bytes to/from userspace and that's it.

May I know if these bits (copy from user) has been sent to device over the driver? So far it seems that we didn't receive these bits in device side.

You are right. The modem bits are not sent to the driver. If driver needs this information the core should be updated this way or another. See below.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

If I understand correctly, you don't only want stubs, but you need them to implement flow control on top of MHI? If so, I think you can access the port at_data->mbmbits from the mhi_ctrl port driver under data->lock. You may also need a way to forward ioctl 'events' to the driver... Wondering if this flow control could simply be supported generically at wwan-core level?

Quoted 8 lines
Quoted 5 lines

Suddenly the 'at_data' field belongs to the port structure private to the WWAN core. And a flow control implementation could be tricky. Ultimately, it's a nice option to have the flow control implemented in the core. Depending on a number of users.

Yes, we need that flow control for these "serial" port. Currently we still don't have the NMEA support over PCIE(MHI). Device GPS daemon needs such a RTS signal from host side to start GPS.

Thank you for clarifying the use case. In this specific case, you don't need all these IOCTL stuff.

If the device needs only DTR (device terminal ready) indication then it could be done way simple. DTR in fact is an indication of the host readiness to receive data. The WWAN port ops already has port open and port close callbacks. I believe, the driver can use them to indicate the host readiness as soon as user opens a GPS (NMEA) port. And clear the signal as soon as user have closed the port.

This were good news. See below for so so news about GPS ports.

Quoted 2 lines

Windows use GNSS driver(not same as Linux GNSS) to support GPS. But for MHI device this feature is none, I think.

You are right here as well. The WWAN subsystem doesn't supports GPS ports exporting. There was an attempt to implement it for t7xx chipset, if I remember correctly. But the author have not finished it.

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Quoted 12 lines
Quoted 10 lines

For a single driver, I believe, the most convenient option is to implement everything in the driver. E.g. introduce an 'ioctl' operation to the wwan_port_ops. And, if core sees the 'ioctl' operation implemented, then it will forward all the IOCTLs to the driver bypassing internal stub implementation.

In some moment in the future, we can implement a generic flow control in the core. In case there are will be more than one driver requiring it. Is it make sense?

Exactly!

#6 lore raw

Hello,

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 7 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Regards,
Loic

#7 lore raw
Quoted 7 lines · Loic Poulain

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 4 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

Quoted 8 lines
Quoted 3 lines

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Ouch. Make sense. I've forgot that some (most?) modems utilize control port to activate the navigation receiver. Thank you for reminding.

Then, the NMEA port should be exported as a child of WWAN device for sure.

Quoted 4 lines

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Also make sense. Personally, I'm voting for exporting through the GNSS subsystem. This way a userspace application will be easy to find the receiver.

--
Sergey

#8 lore raw
Quoted 22 lines · Sergey Ryazanov
Quoted 7 lines · Loic Poulain

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 4 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

Quoted 8 lines
Quoted 3 lines

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Ouch. Make sense. I've forgot that some (most?) modems utilize control port to activate the navigation receiver. Thank you for reminding.

Then, the NMEA port should be exported as a child of WWAN device for sure.

Quoted 9 lines
Quoted 4 lines

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Also make sense. Personally, I'm voting for exporting through the GNSS subsystem. This way a userspace application will be easy to find the receiver.

Do you mean the GNSS driver in driver/gnss ?
And what's the next plan? Anybody will responsible for this requirement?

#9 lore raw

+Johan

Quoted 28 lines · Slark Xiao
Quoted 27 lines · Sergey Ryazanov
Quoted 7 lines · Loic Poulain

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 4 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

Quoted 8 lines
Quoted 3 lines

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Ouch. Make sense. I've forgot that some (most?) modems utilize control port to activate the navigation receiver. Thank you for reminding.

Then, the NMEA port should be exported as a child of WWAN device for sure.

Quoted 4 lines

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Quoted 5 lines
Quoted 4 lines

Also make sense. Personally, I'm voting for exporting through the GNSS subsystem. This way a userspace application will be easy to find the receiver.

Do you mean the GNSS driver in driver/gnss ?

Not exactly. drivers/gnss is for pure GNSS receivers. Exporting through GNSS subsystem means using gnss_register_device() to make the port available to user space.

Quoted 1 line

And what's the next plan?

I could not say somebody has a plan. I can propose a high level design of a future implementation.

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.

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.

Quoted 1 line

Anybody will responsible for this requirement?

Can not follow you. Could you elaborate, what was this question about?

--
Sergey

#10 lore raw
Quoted 59 lines · Sergey Ryazanov

+Johan

Quoted 28 lines · Slark Xiao
Quoted 27 lines · Sergey Ryazanov
Quoted 7 lines · Loic Poulain

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 4 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

Quoted 8 lines
Quoted 3 lines

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Ouch. Make sense. I've forgot that some (most?) modems utilize control port to activate the navigation receiver. Thank you for reminding.

Then, the NMEA port should be exported as a child of WWAN device for sure.

Quoted 4 lines

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Quoted 5 lines
Quoted 4 lines

Also make sense. Personally, I'm voting for exporting through the GNSS subsystem. This way a userspace application will be easy to find the receiver.

Do you mean the GNSS driver in driver/gnss ?

Not exactly. drivers/gnss is for pure GNSS receivers. Exporting through GNSS subsystem means using gnss_register_device() to make the port available to user space.

Quoted 1 line

And what's the next plan?

I could not say somebody has a plan. I can propose a high level design of a future implementation.

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:

Quoted 8 lines
                      .--> 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.

Quoted 4 lines

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.

If so, the flow control is maintained in wwan_core or the gnss core?

Quoted 4 lines
Quoted 1 line

Anybody will responsible for this requirement?

Can not follow you. Could you elaborate, what was this question about?

I mean, both you and Loic noticed that modems support the GPS function but there is no such support in current WWAN design.
So who will be the key role of designer of this new feature? This would be great help if there is someone putting this feature into practice.

#11 lore raw

Hi Slark,

Quoted 68 lines · Slark Xiao
Quoted 59 lines · Sergey Ryazanov

+Johan

Quoted 28 lines · Slark Xiao
Quoted 27 lines · Sergey Ryazanov
Quoted 7 lines · Loic Poulain

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 4 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

Quoted 8 lines
Quoted 3 lines

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Ouch. Make sense. I've forgot that some (most?) modems utilize control port to activate the navigation receiver. Thank you for reminding.

Then, the NMEA port should be exported as a child of WWAN device for sure.

Quoted 4 lines

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Quoted 5 lines
Quoted 4 lines

Also make sense. Personally, I'm voting for exporting through the GNSS subsystem. This way a userspace application will be easy to find the receiver.

Do you mean the GNSS driver in driver/gnss ?

Not exactly. drivers/gnss is for pure GNSS receivers. Exporting through GNSS subsystem means using gnss_register_device() to make the port available to user space.

Quoted 1 line

And what's the next plan?

I could not say somebody has a plan. I can propose a high level design of a future implementation.

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:

Quoted 8 lines
                       .--> 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.

Quoted 8 lines

Similar like what I did in my local. I named it as WWAN_PORT_GNSS and put it as same level with AT port.

Quoted 4 lines

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.

If so, the flow control is maintained in wwan_core or the gnss core?

Lets specify the problem more precisely, since I'm a bit lost. Do you want:
a) some uses pace application *really* control the flow?
b) fool a user space with mock-up IOCTLs, so the user-space application believes that it capable to control the flow?
c) some "signal" to the driver, so driver can command the modem to activate the GNSS receiver and start producing navigation information?

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Anybody will responsible for this requirement?

Can not follow you. Could you elaborate, what was this question about?

I mean, both you and Loic noticed that modems support the GPS function but there is no such support in current WWAN design.

Ok. Thank you for the clarification. You are right, there are no GNSS/NMEA port support in the WWAN core now. The reason is simple. There were no "users", so nobody have bothered himself to implement an used API :)

Quoted 2 lines

So who will be the key role of designer of this new feature? This would be great help if there is someone putting this feature into practice.

I would like to say, feel free to implement the GNSS port support for the WWAN core. Patches are always welcomed!

If you don't feel confident to implement it then give me some time and I'll create some prototype. I believe, it can be done a week or so. It's not a big work, just need to find a time to do it.

Tell me, what the option is more convenient for you and will move into that direction.

--
Sergey

#12 lore raw
Quoted 78 lines · Sergey Ryazanov

Hi Slark,

Quoted 75 lines · Slark Xiao
Quoted 59 lines · Sergey Ryazanov

+Johan

Quoted 28 lines · Slark Xiao
Quoted 27 lines · Sergey Ryazanov
Quoted 7 lines · Loic Poulain

On Wed, 20 Nov 2024 at 08:49, Sergey Ryazanov <[email protected]> wrote:
[...]

Quoted 4 lines

There two tricky topics. First, a GPS port is not an arbitrary serial (char) device for the kernel. In Linux, there is a dedicated subsystem for GPS/EMEA devices and the port should be registered with it.

Second, strictly speaking, a GPS port is not a part of WWAN device. Yes, navigation receiver can be implemented as a block of a modem chip. On another hand, GPS port have nothing common with cellular network. It doesn't reveal connection status, and cannot be user to configure the modem.

Quoted 8 lines
Quoted 3 lines

So, the first big question is: should we export GPS port via the WWAN subsystem or a modem driver should do it by its own?

Loic, do you have any thoughts?

Many modems have (Assisted) GPS capabilities, and the GPS engine is usually controlled via the Modem control interface (AT, mbim...). So it would make sense for the GPS interface to stay under its WWAN parent, and the interface to be a WWAN internal port type (NMEA ).

Ouch. Make sense. I've forgot that some (most?) modems utilize control port to activate the navigation receiver. Thank you for reminding.

Then, the NMEA port should be exported as a child of WWAN device for sure.

Quoted 4 lines

Now... we could either expose the NMEA port to user like other control ports (wwan cdev solution), or have a shim layer to the GNSS subsystem.The former solution is probably the easiest, the latter solution the most appropriate.

Quoted 5 lines
Quoted 4 lines

Also make sense. Personally, I'm voting for exporting through the GNSS subsystem. This way a userspace application will be easy to find the receiver.

Do you mean the GNSS driver in driver/gnss ?

Not exactly. drivers/gnss is for pure GNSS receivers. Exporting through GNSS subsystem means using gnss_register_device() to make the port available to user space.

Quoted 1 line

And what's the next plan?

I could not say somebody has a plan. I can propose a high level design of a future implementation.

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:

Quoted 8 lines
                       .--> 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.

Quoted 4 lines

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.

Quoted 9 lines
Quoted 1 line

If so, the flow control is maintained in wwan_core or the gnss core?

Lets specify the problem more precisely, since I'm a bit lost. Do you want:
a) some uses pace application *really* control the flow?
b) fool a user space with mock-up IOCTLs, so the user-space application believes that it capable to control the flow?
c) some "signal" to the driver, so driver can command the modem to activate the GNSS receiver and start producing navigation information?

Actually for our modems, we just need a RTS signal from driver side. This signal may be generated by driver or user space. It's better to align with the behavior of serial driver for AT and NMEA port of PCIe WWAN device. Not sure for other vendor's requirement.

Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Anybody will responsible for this requirement?

Can not follow you. Could you elaborate, what was this question about?

I mean, both you and Loic noticed that modems support the GPS function but there is no such support in current WWAN design.

Ok. Thank you for the clarification. You are right, there are no GNSS/NMEA port support in the WWAN core now. The reason is simple. There were no "users", so nobody have bothered himself to implement an used API :)

Here we come~~

Quoted 6 lines
Quoted 2 lines

So who will be the key role of designer of this new feature? This would be great help if there is someone putting this feature into practice.

I would like to say, feel free to implement the GNSS port support for the WWAN core. Patches are always welcomed!

Quoted 7 lines

If you don't feel confident to implement it then give me some time and I'll create some prototype. I believe, it can be done a week or so. It's not a big work, just need to find a time to do it.

Tell me, what the option is more convenient for you and will move into that direction.

This may need your help to achieve it. You can let me do the verification test once you have the test patch.

Thanks!

#13 lore raw
In reply to a message not in the archive

+ Mayank

Quoted 69 lines · Manivannan Sadhasivam

+ MHI list, Qiang

On Tue, 19 Nov 2024 at 09:25, Slark Xiao <[email protected]> wrote:

    Hi Loic,
    I tried to add RTS signal support for our AT port of wwan device.
    Now we can know that we are using wwan_port_fops_at_ioctl() for
    this configuration.
    Actually, there are 2 cmd will be ignored by default: TIOCGRS485
    and TIOCSRS485 when you tried to use "minicom -D /dev/wwan0at0".
    Then I added it into that switch statement. May I know if the
    "mdmbits"
    corresponding to the defination in termios.h?

    Below are some test results in wwan_port_fops_at_ioctl():

    //sudo minicom -D /dev/wwan0at0:
    [ 1773.390038] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389648
    [ 1773.390062] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is
    93936443291456
    [ 1773.390069] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389408
    [ 1773.390078] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389392
    [ 1773.390082] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389344
    [ 1773.390087] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389344
    [ 1773.390092] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is
    140726000389500
    [ 1773.390097] wwan wwan0: ##shawn debug## cmd is 0x5418, arg is
    140726000389500
    [ 1773.390101] wwan wwan0: ##shawn debug1## mdmbits is 4
    [ 1773.390106] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389408
    [ 1773.390112] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389392
    [ 1773.390116] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389344
    [ 1773.390120] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389344
    [ 1773.390126] wwan wwan0: ##shawn debug## cmd is 0x542e, arg is
    140726000389568
    [ 1773.390131] wwan wwan0: ##shawn debug## cmd is 0x542f, arg is
    140726000389568
    [ 1773.390135] wwan wwan0: ##shawn debug1## mdmbits is 0
    [ 1773.390153] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389648
    [ 1773.390158] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389632
    [ 1773.390163] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389584
    [ 1773.390167] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389584
    [ 1773.390172] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389648
    [ 1773.390177] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389632
    [ 1773.390181] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389584
    [ 1773.390185] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389584
    [ 1773.390191] wwan wwan0: ##shawn debug## cmd is 0x540b, arg is 2
    [ 1773.393848] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is
    140726000390084
    [ 1773.393861] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000390064
Quoted 8 lines
    I checked the old architecture of Qualcomm PCIE driver, and I
    found that they support
    these signal like RTS,DTR and so on.
    Please see: https://git.codelinaro.org/clo/le/platform/mhi-host
    file: drivers/net/wwan/mhi_dtr.c

    Thanks

To add RTS support, I think IP_CTRL channel and corresponding client driver(mhi_dtr.c) are required. We also need to change the switch statement in wwan_port_fops_at_ioctl() to send data over IP_CTRL channel.

Thanks,
Qiang Yu

Quoted 5 lines
Signature · 2 lines
-- 
மணிவண்ணன் சதாசிவம்

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw
Quoted 82 lines · Slark Xiao
Quoted 78 lines · Qiang Yu

+ Mayank

Quoted 75 lines · Manivannan Sadhasivam

+ MHI list, Qiang

On Tue, 19 Nov 2024 at 09:25, Slark Xiao <[email protected]> wrote:

    Hi Loic,
    I tried to add RTS signal support for our AT port of wwan device.
    Now we can know that we are using wwan_port_fops_at_ioctl() for
    this configuration.
    Actually, there are 2 cmd will be ignored by default: TIOCGRS485
    and TIOCSRS485 when you tried to use "minicom -D /dev/wwan0at0".
    Then I added it into that switch statement. May I know if the
    "mdmbits"
    corresponding to the defination in termios.h?

    Below are some test results in wwan_port_fops_at_ioctl():

    //sudo minicom -D /dev/wwan0at0:
    [ 1773.390038] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389648
    [ 1773.390062] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is
    93936443291456
    [ 1773.390069] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389408
    [ 1773.390078] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389392
    [ 1773.390082] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389344
    [ 1773.390087] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389344
    [ 1773.390092] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is
    140726000389500
    [ 1773.390097] wwan wwan0: ##shawn debug## cmd is 0x5418, arg is
    140726000389500
    [ 1773.390101] wwan wwan0: ##shawn debug1## mdmbits is 4
    [ 1773.390106] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389408
    [ 1773.390112] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389392
    [ 1773.390116] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389344
    [ 1773.390120] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389344
    [ 1773.390126] wwan wwan0: ##shawn debug## cmd is 0x542e, arg is
    140726000389568
    [ 1773.390131] wwan wwan0: ##shawn debug## cmd is 0x542f, arg is
    140726000389568
    [ 1773.390135] wwan wwan0: ##shawn debug1## mdmbits is 0
    [ 1773.390153] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389648
    [ 1773.390158] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389632
    [ 1773.390163] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389584
    [ 1773.390167] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389584
    [ 1773.390172] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389648
    [ 1773.390177] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389632
    [ 1773.390181] wwan wwan0: ##shawn debug## cmd is 0x5402, arg is
    140726000389584
    [ 1773.390185] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000389584
    [ 1773.390191] wwan wwan0: ##shawn debug## cmd is 0x540b, arg is 2
    [ 1773.393848] wwan wwan0: ##shawn debug## cmd is 0x5415, arg is
    140726000390084
    [ 1773.393861] wwan wwan0: ##shawn debug## cmd is 0x5401, arg is
    140726000390064

    I checked the old architecture of Qualcomm PCIE driver, and I
    found that they support
    these signal like RTS,DTR and so on.
    Please see: https://git.codelinaro.org/clo/le/platform/mhi-host
    file: drivers/net/wwan/mhi_dtr.c
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Thanks

To add RTS support, I think IP_CTRL channel and corresponding client driver(mhi_dtr.c) are required. We also need to change the switch statement in wwan_port_fops_at_ioctl() to send data over IP_CTRL channel.

Hi Qiang,
Is there any plan to commit this? I saw this solution in QC themselves project.

Hi Slark,

Sorry for replying late, I discussed with internal team. We have no plans to commit it as of now.

Thanks,
Qiang Yu

Quoted 7 lines
Quoted 7 lines

Thanks,
Qiang Yu

Quoted 5 lines
Signature · 2 lines
-- 
மணிவண்ணன் சதாசிவம்