linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/1] i2c: qcom-cci: pm runtime ordering fix
@ 2022-10-18  2:19 Bryan O'Donoghue
  2022-10-18  2:19 ` [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Bryan O'Donoghue
  0 siblings, 1 reply; 4+ messages in thread
From: Bryan O'Donoghue @ 2022-10-18  2:19 UTC (permalink / raw)
  To: loic.poulain, robert.foss, wsa, linux-i2c, linux-arm-msm, linux-kernel
  Cc: vladimir.zapolskiy, bryan.odonoghue

v3:

- Drops pm_runtime_put, adds Valdimir Rb/Tb - Vladimir Zapolskiy
- This patch was previously part of a series for enabling CAMSS on
  sm8250/rb5. There's no reason to bind this fix up with the enabling
  series since it is an applicable fix for all CAMSS platforms.

https://patchwork.kernel.org/project/linux-media/patch/20220524140207.2758605-2-bryan.odonoghue@linaro.org/

Bryan O'Donoghue (1):
  i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter

 drivers/i2c/busses/i2c-qcom-cci.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
  2022-10-18  2:19 [PATCH v3 0/1] i2c: qcom-cci: pm runtime ordering fix Bryan O'Donoghue
@ 2022-10-18  2:19 ` Bryan O'Donoghue
  2022-10-18  9:17   ` Robert Foss
  2022-10-19 19:37   ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2022-10-18  2:19 UTC (permalink / raw)
  To: loic.poulain, robert.foss, wsa, linux-i2c, linux-arm-msm, linux-kernel
  Cc: vladimir.zapolskiy, bryan.odonoghue, stable

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>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Tested-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/i2c/busses/i2c-qcom-cci.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index 87739fb4388b..a4b97fe3c3a5 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -639,6 +639,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;
@@ -650,14 +655,12 @@ 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_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.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
  2022-10-18  2:19 ` [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Bryan O'Donoghue
@ 2022-10-18  9:17   ` Robert Foss
  2022-10-19 19:37   ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Foss @ 2022-10-18  9:17 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: loic.poulain, wsa, linux-i2c, linux-arm-msm, linux-kernel,
	vladimir.zapolskiy, stable

On Tue, 18 Oct 2022 at 04:19, Bryan O'Donoghue
<bryan.odonoghue@linaro.org> wrote:
>
> 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>
> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> Tested-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/i2c/busses/i2c-qcom-cci.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
> index 87739fb4388b..a4b97fe3c3a5 100644
> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> @@ -639,6 +639,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;
> @@ -650,14 +655,12 @@ 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_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.34.1
>

Reviewed-by: Robert Foss <robert.foss@linaro.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
  2022-10-18  2:19 ` [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Bryan O'Donoghue
  2022-10-18  9:17   ` Robert Foss
@ 2022-10-19 19:37   ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2022-10-19 19:37 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: loic.poulain, robert.foss, linux-i2c, linux-arm-msm,
	linux-kernel, vladimir.zapolskiy, stable

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

On Tue, Oct 18, 2022 at 03:19:20AM +0100, Bryan O'Donoghue wrote:
> 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>
> Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> Tested-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-19 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-18  2:19 [PATCH v3 0/1] i2c: qcom-cci: pm runtime ordering fix Bryan O'Donoghue
2022-10-18  2:19 ` [PATCH v3 1/1] i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter Bryan O'Donoghue
2022-10-18  9:17   ` Robert Foss
2022-10-19 19:37   ` Wolfram Sang

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).