From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: robert.foss@linaro.org, todor.too@gmail.com, agross@kernel.org,
bjorn.andersson@linaro.org
Cc: vladimir.zapolskiy@linaro.org, mchehab@kernel.org,
robh+dt@kernel.org, krzk+dt@kernel.org,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
devicetree@vger.kernel.org, mmitkov@quicinc.com,
jgrahsl@snap.com, hfink@snap.com,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Subject: [PATCH v2 1/4] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
Date: Tue, 24 May 2022 15:02:04 +0100 [thread overview]
Message-ID: <20220524140207.2758605-2-bryan.odonoghue@linaro.org> (raw)
In-Reply-To: <20220524140207.2758605-1-bryan.odonoghue@linaro.org>
When we compile-in the CCI along with the imx412 driver and run on the RB5
we see that i2c_add_adapter() causes the probe of the imx412 driver to
happen.
This probe tries to perform an i2c xfer() and the xfer() in i2c-qcom-cci.c
fails on pm_runtime_get() because the i2c-qcom-cci.c::probe() function has
not completed to pm_runtime_enable(dev).
Fix this sequence by ensuring pm_runtime_xxx() calls happen prior to adding
the i2c adapter.
Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver")
Reported-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
drivers/i2c/busses/i2c-qcom-cci.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index 5c7cc862f08f..90d02effeae9 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -638,6 +638,11 @@ static int cci_probe(struct platform_device *pdev)
if (ret < 0)
goto error;
+ pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
+ pm_runtime_use_autosuspend(dev);
+ pm_runtime_set_active(dev);
+ pm_runtime_enable(dev);
+
for (i = 0; i < cci->data->num_masters; i++) {
if (!cci->master[i].cci)
continue;
@@ -649,14 +654,13 @@ static int cci_probe(struct platform_device *pdev)
}
}
- pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
- pm_runtime_use_autosuspend(dev);
- pm_runtime_set_active(dev);
- pm_runtime_enable(dev);
-
return 0;
error_i2c:
+ pm_runtime_put(dev);
+ pm_runtime_disable(dev);
+ pm_runtime_dont_use_autosuspend(dev);
+
for (--i ; i >= 0; i--) {
if (cci->master[i].cci) {
i2c_del_adapter(&cci->master[i].adap);
--
2.36.1
next prev parent reply other threads:[~2022-05-24 14:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-24 14:02 [PATCH v2 0/4] Switch on IMX577 on RB5 with a new CCI fix Bryan O'Donoghue
2022-05-24 14:02 ` Bryan O'Donoghue [this message]
2022-05-25 7:27 ` [PATCH v2 1/4] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Vladimir Zapolskiy
2022-05-24 14:02 ` [PATCH v2 2/4] arm64: dts: qcom: sm8250: Disable camcc by default Bryan O'Donoghue
2022-05-24 14:02 ` [PATCH v2 3/4] arm64: dts: qcom: sm8250: camss: Define ports address/size cells Bryan O'Donoghue
2022-05-25 7:31 ` Vladimir Zapolskiy
2022-05-24 14:02 ` [PATCH v2 4/4] arm64: dts: qcom: qrb5165-rb5: Enable the IMX577 on cam2 Bryan O'Donoghue
2022-05-24 16:21 ` Dmitry Baryshkov
2022-05-24 16:44 ` Bryan O'Donoghue
2022-07-21 11:38 ` [PATCH v2 0/4] Switch on IMX577 on RB5 with a new CCI fix Benjamin Mugnier
2022-07-21 12:29 ` Bryan O'Donoghue
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=20220524140207.2758605-2-bryan.odonoghue@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=hfink@snap.com \
--cc=jgrahsl@snap.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mmitkov@quicinc.com \
--cc=robert.foss@linaro.org \
--cc=robh+dt@kernel.org \
--cc=todor.too@gmail.com \
--cc=vladimir.zapolskiy@linaro.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;
as well as URLs for NNTP newsgroup(s).