Skip to content

Commit 3d71f43

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel_auxdevice: enable pm_runtime earlier on startup
As soon as the bus starts, physical peripheral devices may report as ATTACHED and set their status with pm_runtime_set_active() in their update_status()/io_init(). This is problematic with the existing code, since the parent pm_runtime status is changed to "active" after starting the bus. This creates a time window where the pm_runtime framework can report an issue, e.g. "rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device sdw:0:025d:0711:00 but parent (sdw-master-0) is not active" This patch enables runtime_pm earlier to make sure the auxiliary device is pm_runtime active after powering-up, but before starting the bus. This problem was exposed by recent changes in the timing of the bus reset, but was present in this driver since we introduced pm_runtime support. Closes: thesofproject#4328 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230803065220.3823269-2-yung-chuan.liao@linux.intel.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 3f92da3 commit 3d71f43

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

drivers/soundwire/intel_auxdevice.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,6 @@ int intel_link_startup(struct auxiliary_device *auxdev)
248248

249249
sdw_intel_debugfs_init(sdw);
250250

251-
/* start bus */
252-
ret = sdw_intel_start_bus(sdw);
253-
if (ret) {
254-
dev_err(dev, "bus start failed: %d\n", ret);
255-
goto err_power_up;
256-
}
257-
258251
/* Enable runtime PM */
259252
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME)) {
260253
pm_runtime_set_autosuspend_delay(dev,
@@ -266,6 +259,13 @@ int intel_link_startup(struct auxiliary_device *auxdev)
266259
pm_runtime_enable(dev);
267260
}
268261

262+
/* start bus */
263+
ret = sdw_intel_start_bus(sdw);
264+
if (ret) {
265+
dev_err(dev, "bus start failed: %d\n", ret);
266+
goto err_pm_runtime;
267+
}
268+
269269
clock_stop_quirks = sdw->link_res->clock_stop_quirks;
270270
if (clock_stop_quirks & SDW_INTEL_CLK_STOP_NOT_ALLOWED) {
271271
/*
@@ -293,12 +293,17 @@ int intel_link_startup(struct auxiliary_device *auxdev)
293293
* with a delay. A more complete solution would require the
294294
* definition of Master properties.
295295
*/
296-
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE))
296+
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME_IDLE)) {
297+
pm_runtime_mark_last_busy(dev);
297298
pm_runtime_idle(dev);
299+
}
298300

299301
sdw->startup_done = true;
300302
return 0;
301303

304+
err_pm_runtime:
305+
if (!(link_flags & SDW_INTEL_MASTER_DISABLE_PM_RUNTIME))
306+
pm_runtime_disable(dev);
302307
err_power_up:
303308
sdw_intel_link_power_down(sdw);
304309
err_init:

0 commit comments

Comments
 (0)