From: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
To: Aniket Randive <aniket.randive@oss.qualcomm.com>,
Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>,
Andi Shyti <andi.shyti@kernel.org>
Cc: naresh.maramaina@oss.qualcomm.com, linux-arm-msm@vger.kernel.org,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-i2c@vger.kernel.org
Subject: Re: [PATCH v3 2/3] i2c: qcom-geni: Add bus recovery support for FIFO mode
Date: Tue, 27 Oct 2026 19:37:57 +0530 [thread overview]
Message-ID: <acac5cec-6fa2-4465-9f66-a5e533404978@oss.qualcomm.com> (raw)
In-Reply-To: <20261027-20260826_aniket_randive_oss_qualcomm_com-v3-2-7f2a6e572de9@oss.qualcomm.com>
On 10/27/2026 10:43 AM, Aniket Randive wrote:
[...]> ---
> drivers/i2c/busses/i2c-qcom-geni.c | 127 ++++++++++++++++++++++++++++++++++++-
> 1 file changed, 126 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index 60b6273f538c..d9e86f110ae9 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
[...]> +static int geni_i2c_recover_bus(struct i2c_adapter *adap)
> +{
> + struct geni_i2c_dev *gi2c = i2c_get_adapdata(adap);
> + u32 ios;
> + int ret;
> +
> + ret = pm_runtime_get_sync(gi2c->se.dev);
> + if (ret < 0) {
> + dev_err(gi2c->se.dev, "bus recovery failed, error turning SE resources:%d\n", ret);
> + pm_runtime_put_noidle(gi2c->se.dev);
> + return ret;
> + }
> +
> + ret = gi2c->dev_data->set_rate(&gi2c->se, gi2c->clk_freq_out);
> + if (ret) {
> + dev_err(gi2c->se.dev, "bus recovery failed, error setting clock rate: %d\n",
> + ret);
> + pm_runtime_put_autosuspend(gi2c->se.dev);
can use goto , jump there at exit with ret updated.
As 4 times i see pm_runtime_put_autosuspend().> + return ret;
> + }
> +
> + if (geni_i2c_bus_is_free(gi2c)) {
> + pm_runtime_put_autosuspend(gi2c->se.dev);
> + return 0;
> + }
> +
> + /* Bus clear cannot recover a target holding SCL low. */
> + ios = readl_relaxed(gi2c->se.base + SE_GENI_IOS);
> + if (!(ios & IO2_DATA_IN)) {
> + pm_runtime_put_autosuspend(gi2c->se.dev);
> + return -EBUSY;
> + }
> +
> + ret = geni_i2c_fifo_bus_cmd(gi2c, I2C_BUS_CLEAR);
> + if (!ret)
> + ret = geni_i2c_fifo_bus_cmd(gi2c, I2C_STOP_ON_BUS);
> +
> + /*
> + * Recovery succeeds only once both bus lines are released. The bus
> + * state is the authority, while a clean opcode status with either
> + * line low is a failed recovery.
> + */
> + if (geni_i2c_bus_is_free(gi2c))
> + ret = 0;
> + else if (!ret)
> + ret = -EBUSY;
> +
Please simplify with ternary condition ?
> + pm_runtime_put_autosuspend(gi2c->se.dev);
> +
> + return ret;
> +}
> +[...]
next prev parent reply other threads:[~2026-10-27 14:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 5:13 [PATCH v3 0/3] i2c: qcom-geni: Add I2C bus recovery support Aniket Randive
2026-10-27 5:13 ` [PATCH v3 1/3] dmaengine: qcom: gpi: Add I2C bus recovery opcode support Aniket Randive
2026-10-27 13:34 ` Mukesh Savaliya
2026-10-27 5:13 ` [PATCH v3 2/3] i2c: qcom-geni: Add bus recovery support for FIFO mode Aniket Randive
2026-10-27 14:07 ` Mukesh Savaliya [this message]
2026-10-27 5:13 ` [PATCH v3 3/3] i2c: qcom-geni: Add bus recovery support for GPI DMA mode Aniket Randive
2026-10-27 14:31 ` 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=acac5cec-6fa2-4465-9f66-a5e533404978@oss.qualcomm.com \
--to=mukesh.savaliya@oss.qualcomm.com \
--cc=Frank.Li@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=aniket.randive@oss.qualcomm.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naresh.maramaina@oss.qualcomm.com \
--cc=viken.dadhaniya@oss.qualcomm.com \
--cc=vkoul@kernel.org \
/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®