RE: [PATCH v3 2/2] USB: serial: ftdi_sio: make explicit latency_timer sysfs write authoritative
From: Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG)
Date: Wed Jul 22 2026 - 01:29:36 EST
Hi Johan,
Thanks for the clarification. I'll drop this and leave the existing precedence unchanged - I checked, and nothing on our side was actually setting ASYNC_LOW_LATENCY.
Regards,
Naveen
-----Original Message-----
From: Johan Hovold <johan@xxxxxxxxxx>
Sent: Tuesday, 21 July 2026 4:04 pm
To: Chinna Mopurigari Naveen Kumar Reddy (FTDI-SG) <naveen.reddy@xxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>; linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; Arun Pappan (FTDI-SG) <arun.pappan@xxxxxxxxxxxx>
Subject: Re: [PATCH v3 2/2] USB: serial: ftdi_sio: make explicit latency_timer sysfs write authoritative
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