Skip to content

Commit 61775d5

Browse files
0xB0Dwsakernel
authored andcommitted
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: e517526 ("i2c: Add Qualcomm CCI I2C driver") Reported-by: Vladimir Zapolskiy <[email protected]> Reviewed-by: Vladimir Zapolskiy <[email protected]> Tested-by: Vladimir Zapolskiy <[email protected]> Cc: <[email protected]> Signed-off-by: Bryan O'Donoghue <[email protected]> Reviewed-by: Robert Foss <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent b8caf0a commit 61775d5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/i2c/busses/i2c-qcom-cci.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,11 @@ static int cci_probe(struct platform_device *pdev)
639639
if (ret < 0)
640640
goto error;
641641

642+
pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
643+
pm_runtime_use_autosuspend(dev);
644+
pm_runtime_set_active(dev);
645+
pm_runtime_enable(dev);
646+
642647
for (i = 0; i < cci->data->num_masters; i++) {
643648
if (!cci->master[i].cci)
644649
continue;
@@ -650,14 +655,12 @@ static int cci_probe(struct platform_device *pdev)
650655
}
651656
}
652657

653-
pm_runtime_set_autosuspend_delay(dev, MSEC_PER_SEC);
654-
pm_runtime_use_autosuspend(dev);
655-
pm_runtime_set_active(dev);
656-
pm_runtime_enable(dev);
657-
658658
return 0;
659659

660660
error_i2c:
661+
pm_runtime_disable(dev);
662+
pm_runtime_dont_use_autosuspend(dev);
663+
661664
for (--i ; i >= 0; i--) {
662665
if (cci->master[i].cci) {
663666
i2c_del_adapter(&cci->master[i].adap);

0 commit comments

Comments
 (0)