From: Aniket RANDIVE <aniket.randive@oss.qualcomm.com>
To: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>,
viken.dadhaniya@oss.qualcomm.com, andi.shyti@kernel.org,
sumit.semwal@linaro.org, christian.koenig@amd.com
Cc: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
naresh.maramaina@oss.qualcomm.com
Subject: Re: [PATCH v2] i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency
Date: Thu, 9 Jul 2026 11:19:47 +0530 [thread overview]
Message-ID: <734537a8-7ece-4d2e-8e72-d090d4788b22@oss.qualcomm.com> (raw)
In-Reply-To: <81e84294-b438-415d-82ef-a523c4381eb4@oss.qualcomm.com>
Thanks Mukesh for the review.
On 7/7/2026 5:37 PM, Mukesh Savaliya wrote:
>
>
> On 7/5/2026 7:27 PM, Aniket Randive wrote:
> [...]
>
>> static int qcom_geni_i2c_conf(struct geni_se *se, unsigned long freq)
>> {
>> struct geni_i2c_dev *gi2c = dev_get_drvdata(se->dev);
>> @@ -471,7 +484,7 @@ 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);
>> + time_left = wait_for_completion_timeout(&gi2c->done,
>> geni_i2c_xfer_timeout(gi2c, len));
> Simplify with timeout = geni_i2c_xfer_timeout(gi2c, len) and use as an
> arg ?
Yes. we can add extra variable. I though to avoid extra variable.
>> if (!time_left)
>> geni_i2c_abort_xfer(gi2c);
>> @@ -513,7 +526,7 @@ 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);
>> + time_left = wait_for_completion_timeout(&gi2c->done,
>> geni_i2c_xfer_timeout(gi2c, len));
>> if (!time_left)
>> geni_i2c_abort_xfer(gi2c);
>> @@ -591,7 +604,7 @@ static void geni_i2c_gpi_multi_desc_unmap(struct
>> geni_i2c_dev *gi2c, struct i2c_
>> * geni_i2c_gpi_multi_xfer_timeout_handler() - Handles multi message
>> transfer timeout
>> * @dev: Pointer to the corresponding dev node
>> * @multi_xfer: Pointer to the geni_i2c_gpi_multi_desc_xfer
>> - * @transfer_timeout_msecs: Timeout value in milliseconds
>> + * @transfer_timeout_msecs: Per-message completion timeout in jiffies
>> * @transfer_comp: Completion object of the transfer
>> *
>> * This function waits for the completion of each processed transfer
>> messages
>> @@ -601,7 +614,7 @@ static void geni_i2c_gpi_multi_desc_unmap(struct
>> geni_i2c_dev *gi2c, struct i2c_
>> */
>> 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;
>> @@ -612,7 +625,7 @@ static int
>> geni_i2c_gpi_multi_xfer_timeout_handler(struct device *dev,
>> 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;
>> @@ -736,8 +749,15 @@ 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;
>> +
>> + for (j = 0; j < gi2c->num_msgs; j++)
>> + max_len = max_t(size_t, max_len, msgs[j].len);
>> +
>> ret = geni_i2c_gpi_multi_xfer_timeout_handler(gi2c-
>> >se.dev, gi2c_gpi_xfer,
>> - XFER_TIMEOUT, &gi2c->done);
>> + geni_i2c_xfer_timeout(
>> + gi2c, max_len), &gi2c->done);
> Simplify with timeout = geni_i2c_xfer_timeout(gi2c, len) and use as an
> arg ?
>> if (ret) {
>> dev_err(gi2c->se.dev,
>> "I2C multi write msg transfer timeout: %d\n",
>> @@ -852,7 +872,8 @@ 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);
>> + time_left = wait_for_completion_timeout(&gi2c->done,
>> geni_i2c_xfer_timeout(
>> + gi2c, msgs[i].len));
>> if (!time_left) {
>> dev_err(gi2c->se.dev, "%s:I2C timeout\n", __func__);
>> gi2c->err = -ETIMEDOUT;
>
next prev parent reply other threads:[~2026-07-09 5:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 13:57 Aniket Randive
2026-07-06 11:41 ` Konrad Dybcio
2026-07-09 6:28 ` Aniket RANDIVE
2026-07-10 9:27 ` Konrad Dybcio
2026-07-10 11:11 ` Aniket RANDIVE
2026-07-07 12:07 ` Mukesh Savaliya
2026-07-09 5:49 ` Aniket RANDIVE [this message]
2026-07-09 5:59 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=734537a8-7ece-4d2e-8e72-d090d4788b22@oss.qualcomm.com \
--to=aniket.randive@oss.qualcomm.com \
--cc=andi.shyti@kernel.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mukesh.savaliya@oss.qualcomm.com \
--cc=naresh.maramaina@oss.qualcomm.com \
--cc=sumit.semwal@linaro.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®