mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
To: Aniket Randive <aniket.randive@oss.qualcomm.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v6 2/2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency
Date: Wed, 22 Jul 2026 10:56:13 +0530	[thread overview]
Message-ID: <2b025902-8879-4426-bc81-484fd9553aa2@oss.qualcomm.com> (raw)
In-Reply-To: <20260720-master-v6-2-671261b05c61@oss.qualcomm.com>



On 7/20/2026 5:11 PM, Aniket Randive wrote:
[...]

> ---
>   drivers/i2c/busses/i2c-qcom-geni.c | 37 +++++++++++++++++++++++++++++--------
>   1 file changed, 29 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 96dbf04138be..d6fab3aa8468 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -74,9 +74,14 @@ enum geni_i2c_err_code {
>   #define PACKING_BYTES_PW	4
>   
>   #define ABORT_TIMEOUT		HZ
> -#define XFER_TIMEOUT		HZ
>   #define RST_TIMEOUT		HZ
>   
> +/* 9 bits per byte (8 data + 1 ACK), 10x safety margin */
> +#define I2C_TIMEOUT_SAFETY_COEFFICIENT	10
> +
> +/* 300ms floor: budget for clock stretching; slave may hold SCL low indefinitely */
> +#define I2C_TIMEOUT_MIN_USEC		300000
> +
Let other expert suggest if pass from DTSI or hardcode here. because 
this let all other controller drivers to make change. I request to 
conclude on discussion, i kept my point in earlier patch.
>   struct geni_i2c_desc {
>   	bool no_dma_support;
>   	unsigned int tx_fifo_depth;
> @@ -471,7 +476,9 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>   	}
>   
>   	cur = gi2c->cur;
> -	time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
> +	i2c_update_timeout(&gi2c->adap, gi2c->clk_freq_out, len,
> +			   I2C_TIMEOUT_SAFETY_COEFFICIENT, I2C_TIMEOUT_MIN_USEC);
> +	time_left = wait_for_completion_timeout(&gi2c->done, gi2c->adap.timeout);
>   	if (!time_left)
>   		geni_i2c_abort_xfer(gi2c);
>   
> @@ -513,7 +520,9 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg,
>   		writel_relaxed(1, se->base + SE_GENI_TX_WATERMARK_REG);
>   
>   	cur = gi2c->cur;
> -	time_left = wait_for_completion_timeout(&gi2c->done, XFER_TIMEOUT);
> +	i2c_update_timeout(&gi2c->adap, gi2c->clk_freq_out, len,
> +			   I2C_TIMEOUT_SAFETY_COEFFICIENT, I2C_TIMEOUT_MIN_USEC);
Expect some discussion or conclusion from other experts if need to hard 
code these coefficient or pass from DTSI. if core can read like existing 
i2c_parse_fw_timings(), it would become generic to every i2c adapter driver.
> +	time_left = wait_for_completion_timeout(&gi2c->done, gi2c->adap.timeout);
>   	if (!time_left)
>   		geni_i2c_abort_xfer(gi2c);
>   [...]

  reply	other threads:[~2026-07-22  5:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-20 11:41 [PATCH v6 0/2] i2c: Add dynamic transfer timeout based on message " Aniket Randive
2026-07-20 11:41 ` [PATCH v6 1/2] i2c: core: Add i2c_update_timeout() helper for dynamic transfer timeouts Aniket Randive
2026-07-22  5:25   ` Mukesh Savaliya
2026-07-24 11:46     ` Aniket RANDIVE
2026-07-26 20:11   ` Andi Shyti
2026-07-27  4:15     ` Mukesh Savaliya
2026-07-27 20:42       ` Andi Shyti
2026-07-28  4:56         ` Mukesh Savaliya
2026-07-28  9:42           ` Wolfram Sang
2026-07-28 10:14             ` Mukesh Savaliya
2026-07-29 15:19               ` Wolfram Sang
2026-07-30 11:53                 ` Aniket RANDIVE
2026-07-30 20:23                   ` Wolfram Sang
2026-08-01 21:02                     ` Wolfram Sang
2026-08-03 10:53                       ` Aniket RANDIVE
2026-08-03 11:52                 ` Mukesh Savaliya
2026-07-20 11:41 ` [PATCH v6 2/2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency Aniket Randive
2026-07-22  5:26   ` Mukesh Savaliya [this message]
2026-07-24 11:51     ` Aniket RANDIVE
2026-07-22  5:25 ` [PATCH v6 0/2] i2c: Add dynamic transfer timeout based on message " Mukesh Savaliya
2026-07-24 11:56   ` Aniket RANDIVE

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=2b025902-8879-4426-bc81-484fd9553aa2@oss.qualcomm.com \
    --to=mukesh.savaliya@oss.qualcomm.com \
    --cc=andi.shyti@kernel.org \
    --cc=aniket.randive@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viken.dadhaniya@oss.qualcomm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®