Re: [PATCH 1/1] PCA9541: Increase I2C bus arbitration timeout
From: Wolfram Sang
Date: Mon Jul 28 2025 - 04:55:24 EST
Hi,
thanks for your patch.
> /* arbitration timeouts, in jiffies */
> -#define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */
> -#define ARB2_TIMEOUT (HZ / 4) /* 250 ms until acquisition failure */
> +#define ARB_TIMEOUT (HZ) /* 1 s until forcing bus ownership */
> +#define ARB2_TIMEOUT (2 * HZ) /* 2 s until acquisition failure */
Can't we use the timeout value of the parent struct i2c_adapter? This is
by default HZ and can be set by userspace via IOCTL depending on the
actual use case. So, we would use (pseudo-code, probably):
254 unsigned long timeout = jiffies + 2 * client->adapter->timeout;
255 /* give up after this time */
256
257 data->arb_timeout = jiffies + client->adapter->timeout;
?
> + dev_info(&client->dev, "I2C Bus Arbiter timeout, forcing take bus\n");
'dev_warn' for both?
Happy hacking,
Wolfram
Attachment:
signature.asc
Description: PGP signature