soundwire: master: use pm_runtime_set_active() on add
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 24 Nov 2020 13:07:42 +0000 (21:07 +0800)
committerVinod Koul <vkoul@kernel.org>
Wed, 2 Dec 2020 07:19:34 +0000 (12:49 +0530)
commite04e60fce47e61743a8726d76b0149c1f4ad8957
treeb25895a05db4874aa919a78592524336e5923d80
parent47edc0104c61d609b0898a302267b7269d87a6af
soundwire: master: use pm_runtime_set_active() on add

The 'master' device acts as a glue layer used during bus
initialization only, and it needs to be 'transparent' for pm_runtime
management. Its behavior should be that it becomes active when one of
its children becomes active, and suspends when all of its children are
suspended.

In our tests on Intel platforms, we routinely see these sort of
warnings on the initial boot:

[ 21.447345] rt715 sdw:3:25d:715:0: runtime PM trying to activate
child device sdw:3:25d:715:0 but parent (sdw-master-3) is not active

This is root-caused to a missing setup to make the device 'active' on
probe. Since we don't want the device to remain active forever after
the probe, the autosuspend configuration is also enabled at the end of
the probe - the device will actually autosuspend only in the case
where there are no devices physically attached. In practice, the
master device will suspend when all its children are no longer active.

Fixes: bd84256e86ecf ('soundwire: master: enable pm runtime')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20201124130742.10986-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/master.c