Re: [PATCH v9 0/2] i2c: Add dynamic transfer timeout based on message length and frequency

From: Andi Shyti

Date: Wed Sep 16 2026 - 06:26:25 EST


Hi Aniket,

On Fri, Sep 11, 2026 at 12:29:50PM +0530, Aniket Randive wrote:
> The I2C core and many controller drivers currently rely on a fixed
> timeout value that does not account for transfer characteristics such as
> message length or bus frequency. This can make the timeout unnecessarily
> large for short transfers, while longer transfers at lower bus
> frequencies may require a timeout that better matches the expected
> transfer duration.
>
> Introduce a generic helper API in the I2C core to calculate a
> transfer-specific timeout from the expected wire time of a transaction.
> Store the computed value in adap->timeout so that both the I2C core retry
> logic and controller drivers use a timeout value that reflects the
> current transfer.
>
> Keep timeout policy decisions within individual controller drivers. Let
> drivers provide their own safety margins and minimum timeout floors, and
> avoid exposing those driver-specific policy values as part of the
> generic API.
>
> Convert the Qualcomm GENI I2C driver to use the helper while preserving
> its existing timeout policy. Preserve the static timeout behaviour when
> CONFIG_I2C_DYNAMIC_TIMEOUT is disabled, and let a userspace-configured
> I2C_TIMEOUT value take precedence over the computed timeout.
>
> Suggested-by: Dmitry Guzman <Dmitry.Guzman@xxxxxxxxxxxx>

Pushed to i2c/i2c.

Thanks,
Andi