Commit 61775d54 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Wolfram Sang

i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter

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: e5175261 ("i2c: Add Qualcomm CCI I2C driver")
Reported-by: default avatarVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: default avatarVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Tested-by: default avatarVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent b8caf0a0
...@@ -639,6 +639,11 @@ static int cci_probe(struct platform_device *pdev) ...@@ -639,6 +639,11 @@ static int cci_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto error; 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++) { for (i = 0; i < cci->data->num_masters; i++) {
if (!cci->master[i].cci) if (!cci->master[i].cci)
continue; continue;
...@@ -650,14 +655,12 @@ static int cci_probe(struct platform_device *pdev) ...@@ -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; return 0;
error_i2c: error_i2c:
pm_runtime_disable(dev);
pm_runtime_dont_use_autosuspend(dev);
for (--i ; i >= 0; i--) { for (--i ; i >= 0; i--) {
if (cci->master[i].cci) { if (cci->master[i].cci) {
i2c_del_adapter(&cci->master[i].adap); i2c_del_adapter(&cci->master[i].adap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment