All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aniket RANDIVE <aniket.randive@oss.qualcomm.com>
To: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Andi Shyti <andi.shyti@kernel.org>,
	Dmitry Guzman <Dmitry.Guzman@mobileye.com>
Cc: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
	linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 2/2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency
Date: Wed, 26 Aug 2026 16:19:31 +0530	[thread overview]
Message-ID: <07c22121-0a61-4445-b2ad-7bd5c46633af@oss.qualcomm.com> (raw)
In-Reply-To: <7222e72f-e618-4a78-8b48-1e712b9beba5@oss.qualcomm.com>

Thanks Mukesh for the review.

On 8/24/2026 12:41 PM, Mukesh Savaliya wrote:
> 
> 
> On 8/13/2026 11:15 AM, Aniket Randive wrote:
> 
> [...]
> 
>>   static int geni_i2c_gpi_multi_xfer_timeout_handler(struct device *dev,
>>                              struct geni_i2c_gpi_multi_desc_xfer 
>> *multi_xfer,
>> -                           u32 transfer_timeout_msecs,
>> +                           unsigned long timeout_jiffies,
>>                              struct completion *transfer_comp)
>>   {
>>       int i;
>> -    u32 time_left;
>> +    unsigned long time_left;
>>       for (i = 0; i < multi_xfer->msg_idx_cnt - 1; i++) {
>>           reinit_completion(transfer_comp);
>>           if (multi_xfer->msg_idx_cnt != multi_xfer->irq_cnt) {
>>               time_left = wait_for_completion_timeout(transfer_comp,
>> -                                transfer_timeout_msecs);
>> +                                timeout_jiffies);
>>               if (!time_left) {
>>                   dev_err(dev, "%s: Transfer timeout\n", __func__);
>>                   return -ETIMEDOUT;
>> @@ -778,8 +787,22 @@ static int geni_i2c_gpi(struct geni_i2c_dev 
>> *gi2c, struct i2c_msg msgs[],
>>           dma_async_issue_pending(gi2c->tx_c);
>>           if ((msg_idx == (gi2c->num_msgs - 1)) || flags & 
>> DMA_PREP_INTERRUPT) {
>> +            size_t max_len = 0;
>> +            int j;
>> +
>> +            /*
>> +             * Use the longest message as the timeout base: one 
>> completion
>> +             * covers the whole BEI batch, so the budget must fit the 
>> worst
>> +             * case single-message wire time.
>> +             */
> 
> Using only the longest message length may under-estimate the required 
> Timeout.

Yes. We can take sum of all messages in GPI multi desc path. I will do 
this change in next patch.

> 
>> +            for (j = 0; j < gi2c->num_msgs; j++)
>> +                max_len = max_t(size_t, max_len, msgs[j].len);
> can we use sum(msgs[i].len) instead of max() ?> + 
> i2c_update_timeout(&gi2c->adap, gi2c->clk_freq_out, max_len,
>> +                       I2C_TIMEOUT_SAFETY_COEFFICIENT,
>> +                       I2C_TIMEOUT_MIN_USEC);
>>               ret = geni_i2c_gpi_multi_xfer_timeout_handler(gi2c- 
>> >se.dev, gi2c_gpi_xfer,
>> -                                      XFER_TIMEOUT, &gi2c->done);
>> +                                      gi2c->adap.timeout,
>> +                                      &gi2c->done);
>>               if (ret) {
>>                   dev_err(gi2c->se.dev,
>>                       "I2C multi write msg transfer timeout: %d\n",
>> @@ -899,7 +922,10 @@ static int geni_i2c_gpi_xfer(struct geni_i2c_dev 
>> *gi2c, struct i2c_msg msgs[], i
>>           if (!gi2c->is_tx_multi_desc_xfer) {
>>               dma_async_issue_pending(gi2c->tx_c);
>> -            time_left = wait_for_completion_timeout(&gi2c->done, 
>> XFER_TIMEOUT);
>> +            i2c_update_timeout(&gi2c->adap, gi2c->clk_freq_out, 
>> msgs[i].len,
>> +                       I2C_TIMEOUT_SAFETY_COEFFICIENT,
>> +                       I2C_TIMEOUT_MIN_USEC);
>> +            time_left = wait_for_completion_timeout(&gi2c->done, 
>> gi2c->adap.timeout);
>>               if (!time_left) {
>>                   dev_err(gi2c->se.dev, "%s:I2C timeout\n", __func__);
>>                   gi2c->err = -ETIMEDOUT;
>>
> 


      reply	other threads:[~2026-08-26 10:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13  5:45 [PATCH v7 0/2] i2c: Add dynamic transfer timeout based on message length and frequency Aniket Randive
2026-08-13  5:45 ` [PATCH v7 1/2] i2c: core: Add i2c_update_timeout() helper for dynamic transfer timeouts Aniket Randive
2026-08-24  6:19   ` Mukesh Savaliya
2026-08-24 10:06     ` Aniket RANDIVE
2026-08-24 13:44       ` Mukesh Savaliya
2026-08-26 10:51         ` Aniket RANDIVE
2026-08-13  5:45 ` [PATCH v7 2/2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency Aniket Randive
2026-08-24  7:11   ` Mukesh Savaliya
2026-08-26 10:49     ` Aniket RANDIVE [this message]

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=07c22121-0a61-4445-b2ad-7bd5c46633af@oss.qualcomm.com \
    --to=aniket.randive@oss.qualcomm.com \
    --cc=Dmitry.Guzman@mobileye.com \
    --cc=andi.shyti@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mukesh.savaliya@oss.qualcomm.com \
    --cc=viken.dadhaniya@oss.qualcomm.com \
    --cc=wsa+renesas@sang-engineering.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.