soundwire: intel_auxdevice: enable pm_runtime earlier on startup
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Thu, 3 Aug 2023 06:52:19 +0000 (14:52 +0800)
committerVinod Koul <vkoul@kernel.org>
Fri, 11 Aug 2023 06:54:56 +0000 (07:54 +0100)
commit3d71f43f8a59a62c6ab832d4e73a69bae22e13b7
tree83330cb44019ac8014296b1d8abe6d74ea684a71
parent3f92da3ea4480648ebeb8a4802085908a5c64cee
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: https://github.com/thesofproject/linux/issues/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>
drivers/soundwire/intel_auxdevice.c