All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Chinna Mopurigari Naveen Kumar Reddy <naveen.reddy@ftdichip.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Arun Pappan <arun.pappan@ftdichip.com>
Subject: Re: [PATCH v3 2/2] USB: serial: ftdi_sio: make explicit latency_timer sysfs write authoritative
Date: Tue, 21 Jul 2026 10:03:35 +0200	[thread overview]
Message-ID: <al8n17rIPduwjphv@hovoldconsulting.com> (raw)
In-Reply-To: <c1956d7641cd96f75cf2534b65fe9a83d0941e50.1782201674.git.naveen.reddy@ftdichip.com>

On Tue, Jun 23, 2026 at 04:03:21PM +0800, Chinna Mopurigari Naveen Kumar Reddy wrote:
> write_latency_timer() clamps the value programmed into the FT chip's
> per-channel latency_timer register to 1 whenever ASYNC_LOW_LATENCY is
> set in priv->flags.  ASYNC_LOW_LATENCY is set by userspace via
> TIOCSSERIAL, used by setserial(8), libftdi and certain tcsetattr
> paths.  The interaction with the existing sysfs latency_timer
> attribute is surprising: once any of those tools has set the flag, a
> later write of "16" (or any other value) to
> /sys/bus/usb-serial/devices/ttyUSBx/latency_timer is silently
> clamped to 1 and never reaches the chip.
> 
> The store path is the most explicit way userspace can ask for a
> particular latency_timer value; treat it as authoritative.  On an
> explicit sysfs write, clear ASYNC_LOW_LATENCY before calling
> write_latency_timer() so the requested value is what the chip
> register actually receives.  The override is logged at debug level
> (dev_dbg) for diagnostics only.
> 
> Reads continue to honour ASYNC_LOW_LATENCY (returning "1") so any
> userspace that previously inspected the attribute to confirm
> low-latency mode keeps working until it does its own explicit write.

No, I don't think we should be changing this now.

The driver has behaved this way since 2009 and commit 557aaa7ffab6
("ft232: support the ASYNC_LOW_LATENCY flag") which explicitly let the
standard setserial interface override the "obscure chip specific"
interface.

Also note that the value written to sysfs does take effect once the
low-latency flag is cleared so we can't really return an error like
-EBUSY either.

I don't know how libftdi uses the flag, but it generally would not even
be set unless you explicitly set it using setserial.

Perhaps you can send a fix to libftdi so that it uses the sysfs
interface directly and leaves the flag alone if that's the library
that's causing the flag to unknowingly be left set.

Johan

  reply	other threads:[~2026-07-21  8:03 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22  7:38 [PATCH 0/6] USB: serial: ftdi_sio: configurable read-URB defer, per-port low_latency, latency_timer reliability Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  7:38 ` [PATCH 1/6] USB: serial: ftdi_sio: add configurable inter-batch defer for read URBs Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  8:51   ` Greg Kroah-Hartman
2026-06-22  8:52   ` Greg Kroah-Hartman
2026-06-22  9:05     ` Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)
2026-06-22  9:27       ` Greg Kroah-Hartman
2026-06-22  9:43         ` Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)
2026-06-22  7:38 ` [PATCH 2/6] USB: serial: ftdi_sio: retry transient errors on chip-side control transfers Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  7:38 ` [PATCH 3/6] USB: serial: ftdi_sio: make explicit latency_timer sysfs write authoritative Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  7:38 ` [PATCH 4/6] USB: serial: ftdi_sio: add per-port low_latency sysfs attribute Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  7:38 ` [PATCH 5/6] USB: serial: ftdi_sio: serialise low_latency toggle against read_bulk_callback Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  7:38 ` [PATCH 6/6] USB: serial: ftdi_sio: pace low_latency ports with low_latency_defer_ns Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  9:43 ` [PATCH v2 0/2] USB: serial: ftdi_sio: latency_timer reliability fixes Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  9:43   ` [PATCH v2 1/2] USB: serial: ftdi_sio: retry transient errors on chip-side control transfers Chinna Mopurigari Naveen Kumar Reddy
2026-06-22  9:43   ` [PATCH v2 2/2] USB: serial: ftdi_sio: make explicit latency_timer sysfs write authoritative Chinna Mopurigari Naveen Kumar Reddy
2026-06-22 10:19     ` Greg Kroah-Hartman
2026-06-23  0:20       ` Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)
2026-06-23  8:03   ` [PATCH v3 0/2] USB: serial: ftdi_sio: latency_timer reliability fixes Chinna Mopurigari Naveen Kumar Reddy
2026-06-23  8:03     ` [PATCH v3 1/2] USB: serial: ftdi_sio: retry transient errors on chip-side control transfers Chinna Mopurigari Naveen Kumar Reddy
2026-07-21  7:33       ` Johan Hovold
2026-07-21  7:45         ` Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)
2026-06-23  8:03     ` [PATCH v3 2/2] USB: serial: ftdi_sio: make explicit latency_timer sysfs write authoritative Chinna Mopurigari Naveen Kumar Reddy
2026-07-21  8:03       ` Johan Hovold [this message]
2026-07-22  5:29         ` Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)
2026-07-17  6:39     ` [PATCH v3 0/2] USB: serial: ftdi_sio: latency_timer reliability fixes Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)

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=al8n17rIPduwjphv@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=arun.pappan@ftdichip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=naveen.reddy@ftdichip.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.