From: Praveen Talari <praveen.talari@oss.qualcomm.com>
To: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>,
Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
Andi Shyti <andi.shyti@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org,
Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Subject: Re: [PATCH 1/3] i2c: qcom-geni: use cancel command before abort on transfer timeout
Date: Wed, 8 Jul 2026 14:47:25 +0530 [thread overview]
Message-ID: <9eb94d85-5074-4d2f-91a7-b3d39bd2bc4d@oss.qualcomm.com> (raw)
In-Reply-To: <74520b45-b3d1-475a-8929-b965ce760d5a@oss.qualcomm.com>
Hi Mukesh,
Thank you for review.
On 08-07-2026 13:05, Mukesh Savaliya wrote:
>
>
> On 7/8/2026 11:45 AM, Praveen Talari wrote:
>> The GENI I2C driver currently invokes geni_se_abort_m_cmd() directly
>> when
>> a transfer times out. However, the GENI hardware command cancellation
>> flow requires a cancel command to be issued first. An abort should only
>> be used as a fallback when the cancel operation itself fails to
>> complete.
>>
>> Introduce a dedicated cancel_done completion that is signalled on
> Typo :signalled
>
> "signaled when M_CMD_CANCEL_EN is received" With this , rest looks good.
Sure. Will update in next patch.
Thanks,
Praveen Talari
>> M_CMD_CANCEL_EN. The timeout recovery path waits for cancel completion
>> and escalates to geni_i2c_abort_xfer() only if the cancel command does
>> not complete within the expected time.
>>
>> Co-developed-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
>> Signed-off-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
>> Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
>> ---
> Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
>
>> drivers/i2c/busses/i2c-qcom-geni.c | 30 ++++++++++++++++++++++++++++--
>> 1 file changed, 28 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c
>> b/drivers/i2c/busses/i2c-qcom-geni.c
>> index 96dbf04138be..15403edb355a 100644
>> --- a/drivers/i2c/busses/i2c-qcom-geni.c
>> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
>> @@ -74,6 +74,7 @@ enum geni_i2c_err_code {
>> #define PACKING_BYTES_PW 4
>> #define ABORT_TIMEOUT HZ
>> +#define CANCEL_TIMEOUT HZ
>> #define XFER_TIMEOUT HZ
>> #define RST_TIMEOUT HZ
>> @@ -112,6 +113,7 @@ struct geni_i2c_dev {
>> int err;
>> struct i2c_adapter adap;
>> struct completion done;
>> + struct completion cancel_done;
>> struct i2c_msg *cur;
>> int cur_wr;
>> int cur_rd;
>> @@ -361,6 +363,8 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev)
>> dm_tx_st & TX_DMA_DONE || dm_tx_st & TX_RESET_DONE ||
>> dm_rx_st & RX_DMA_DONE || dm_rx_st & RX_RESET_DONE)
>> complete(&gi2c->done);
>> + if (m_stat & M_CMD_CANCEL_EN)
>> + complete(&gi2c->cancel_done);
>> spin_unlock(&gi2c->lock);
>> @@ -387,6 +391,27 @@ static void geni_i2c_abort_xfer(struct
>> geni_i2c_dev *gi2c)
>> dev_err(gi2c->se.dev, "Timeout abort_m_cmd\n");
>> }
>> +static void geni_i2c_cancel_xfer(struct geni_i2c_dev *gi2c)
>> +{
>> + unsigned long time_left = msecs_to_jiffies(CANCEL_TIMEOUT);
>> + unsigned long flags;
>> +
>> + reinit_completion(&gi2c->cancel_done);
>> +
>> + spin_lock_irqsave(&gi2c->lock, flags);
>> + if (!gi2c->err)
>> + geni_i2c_err(gi2c, GENI_TIMEOUT);
>> + gi2c->cur = NULL;
>> + geni_se_cancel_m_cmd(&gi2c->se);
>> + spin_unlock_irqrestore(&gi2c->lock, flags);
>> +
>> + time_left = wait_for_completion_timeout(&gi2c->cancel_done,
>> time_left);
>> + if (!time_left) {
>> + dev_err(gi2c->se.dev, "Timeout cancel_m_cmd\n");
>> + geni_i2c_abort_xfer(gi2c);
>> + }
>> +}
>> +
>> static void geni_i2c_rx_fsm_rst(struct geni_i2c_dev *gi2c)
>> {
>> u32 val;
>> @@ -473,7 +498,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);
>> if (!time_left)
>> - geni_i2c_abort_xfer(gi2c);
>> + geni_i2c_cancel_xfer(gi2c);
>> geni_i2c_rx_msg_cleanup(gi2c, cur);
>> @@ -515,7 +540,7 @@ static int geni_i2c_tx_one_msg(struct
>> geni_i2c_dev *gi2c, struct i2c_msg *msg,
>> cur = gi2c->cur;
>> time_left = wait_for_completion_timeout(&gi2c->done,
>> XFER_TIMEOUT);
>> if (!time_left)
>> - geni_i2c_abort_xfer(gi2c);
>> + geni_i2c_cancel_xfer(gi2c);
>> geni_i2c_tx_msg_cleanup(gi2c, cur);
>> @@ -1107,6 +1132,7 @@ static int geni_i2c_probe(struct
>> platform_device *pdev)
>> gi2c->adap.algo = &geni_i2c_algo;
>> init_completion(&gi2c->done);
>> + init_completion(&gi2c->cancel_done);
>> spin_lock_init(&gi2c->lock);
>> platform_set_drvdata(pdev, gi2c);
>>
>
next prev parent reply other threads:[~2026-07-08 9:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 6:15 [PATCH 0/3] i2c: qcom-geni: improve transfer error recovery and synchronization Praveen Talari
2026-07-08 6:15 ` [PATCH 1/3] i2c: qcom-geni: use cancel command before abort on transfer timeout Praveen Talari
2026-07-08 7:35 ` Mukesh Savaliya
2026-07-08 9:17 ` Praveen Talari [this message]
2026-07-08 6:15 ` [PATCH 2/3] i2c: qcom-geni: use dedicated completions for abort and reset events Praveen Talari
2026-07-08 7:35 ` Mukesh Savaliya
2026-07-08 9:23 ` Praveen Talari
2026-07-08 6:15 ` [PATCH 3/3] i2c: qcom-geni: Avoid unnecessary transfer cancel on address NACK Praveen Talari
2026-07-08 9:41 ` Mukesh Savaliya
2026-07-08 7:35 ` [PATCH 0/3] i2c: qcom-geni: improve transfer error recovery and synchronization Mukesh Savaliya
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=9eb94d85-5074-4d2f-91a7-b3d39bd2bc4d@oss.qualcomm.com \
--to=praveen.talari@oss.qualcomm.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=naresh.maramaina@oss.qualcomm.com \
--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