mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 17:11:46 +00:00
i2c: qup: Fix order of runtime pm initialization
The runtime pm calls need to be done before populating the children via the i2c_add_adapter call. If this is not done, a child can run into issues trying to do i2c read/writes due to the pm_runtime_sync failing. Signed-off-by: Andy Gross <agross@codeaurora.org> Reviewed-by: Felipe Balbi <balbi@ti.com> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de> Cc: stable@kernel.org
This commit is contained in:
parent
cf27020d2f
commit
86b59bbfae
1 changed files with 8 additions and 4 deletions
|
@ -674,16 +674,20 @@ static int qup_i2c_probe(struct platform_device *pdev)
|
||||||
qup->adap.dev.of_node = pdev->dev.of_node;
|
qup->adap.dev.of_node = pdev->dev.of_node;
|
||||||
strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));
|
strlcpy(qup->adap.name, "QUP I2C adapter", sizeof(qup->adap.name));
|
||||||
|
|
||||||
ret = i2c_add_adapter(&qup->adap);
|
|
||||||
if (ret)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
|
pm_runtime_set_autosuspend_delay(qup->dev, MSEC_PER_SEC);
|
||||||
pm_runtime_use_autosuspend(qup->dev);
|
pm_runtime_use_autosuspend(qup->dev);
|
||||||
pm_runtime_set_active(qup->dev);
|
pm_runtime_set_active(qup->dev);
|
||||||
pm_runtime_enable(qup->dev);
|
pm_runtime_enable(qup->dev);
|
||||||
|
|
||||||
|
ret = i2c_add_adapter(&qup->adap);
|
||||||
|
if (ret)
|
||||||
|
goto fail_runtime;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
fail_runtime:
|
||||||
|
pm_runtime_disable(qup->dev);
|
||||||
|
pm_runtime_set_suspended(qup->dev);
|
||||||
fail:
|
fail:
|
||||||
qup_i2c_disable_clocks(qup);
|
qup_i2c_disable_clocks(qup);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue