linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Brian Kloppenborg <bkloppenborg@gmail.com>
Cc: linux-usb@vger.kernel.org, Brian Kloppenborg <brian@kloppenborg.net>
Subject: Re: [PATCH 0/2] Enable modem line status events on cp210x, add support for PPS on RI pin
Date: Fri, 15 Dec 2023 14:02:31 +0100	[thread overview]
Message-ID: <ZXxOZ4xTKeA7_X3b@hovoldconsulting.com> (raw)
In-Reply-To: <20231009023425.366783-1-brian@kloppenborg.net>

Hi Brian,

and sorry about the late reply. I was also waiting to see if you'd
address the issues pointed out by Greg.

On Sun, Oct 08, 2023 at 08:34:23PM -0600, Brian Kloppenborg wrote:

> This is my first patch to the Linux kernel.

There are some form issues as Greg's bot mentioned, like there being no
commit message, missing Subject prefix, missing Signed-off by, and
some coding style issues (space after if keyword, brackets around single
line statements, etc).

Make sure you have read

	Documentation/process/submitting-patches.rst

and you should run scripts/checkpatch.pl on your patches before posting
as it would find some of these issues.

Just looking at the git log for this driver may also give you an idea of
the expected patch format.

> Patch 1 enables support for modem line status changes to the cp210x
> driver. This is required to receive pulse-per-second (PPS) signals
> from GPS receivers. Support for this feature exists in the FTDI
> driver, but is not present in cp210x. The patch is implemented through
> (1) enabling the device's event mode by default when the port is
> opened or closed, and (2) registering the CTS, DSR, RI, and DCD
> changes with the kernel through conventional means.

So there are a few issues with this.

First, as I mentioned in the commit message when adding support for the
event mode, on at least some of the cp210x devices modem events appeared
to be buffered until the next character was received:

	https://lore.kernel.org/r/all/20200713105517.27796-3-johan@kernel.org/

Second, the event mode comes at a cost since all received characters
needs to be processed one-by-one instead of simply being copied to the
tty buffers.

For those reasons, I left modem-event support unimplemented and only
enabled event-mode when the user specifically requested input-parity
checking.

Perhaps some of these issues only affect some device types, and perhaps
we can allow users to avoid the processing cost by only enabling event
mode when, for example, CLOCAL is not set.

Hmm, scratch that last bit, usb_serial_handle_dcd_change() would hang up
the port when the CD is deasserted with !CLOCAL.

> Patch 2 enables support for GPS PPS signals on the RI pin. While most
> GPS devices typically expose this signal on the DCD pin, the Adafruit
> Ultimate GPS with USB-C placed it on the RI pin instead. So this patch
> is highly focused on that specific device. From what I can tell, the
> usb_serial_handle_dcd_change function is used exclusively to register
> PPS signals with the kernel, so calling it from the RI block shouldn't
> result in unexpected behavior.

So I'm afraid this is not going to work. First of all, serial drivers
need to work with all types of devices and can't have hacks for quirky
connected hardware like this.

Second, the usb_serial_handle_dcd_change() also handles waiting for a
modem connection on open and hangups using the carrier-detect line,
which would break if called on RI instead of CD events.

You also generally should not be using a slow USB device for things like
PPS as I imagine latency and jitter would make it practically useless.

Johan

  parent reply	other threads:[~2023-12-15 13:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09  2:34 [PATCH 0/2] Enable modem line status events on cp210x, add support for PPS on RI pin Brian Kloppenborg
2023-10-09  2:34 ` [PATCH 1/2] Make cp210x respond to modem status changes (CTS, DSR, RI, DCD) by default Brian Kloppenborg
2023-10-09  8:59   ` Greg KH
2023-10-09  9:00   ` Greg KH
2023-10-09  2:34 ` [PATCH 2/2] Make cp210x register GPS PPS signals on the RI pin Brian Kloppenborg
2023-10-09  9:00   ` Greg KH
2023-12-15 13:02 ` Johan Hovold [this message]
2023-12-16  1:40   ` [PATCH 0/2] Enable modem line status events on cp210x, add support for PPS on " Brian Kloppenborg

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=ZXxOZ4xTKeA7_X3b@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=bkloppenborg@gmail.com \
    --cc=brian@kloppenborg.net \
    --cc=linux-usb@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).