ASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Wed, 2 Aug 2023 15:36:27 +0000 (10:36 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 7 Aug 2023 13:32:31 +0000 (14:32 +0100)
commit4af11e11defc200439a75a7957b03f3da37e46b2
tree6fa02c4a5c0fceb55c9e2ee8106fce2c31a6a1a4
parentdf93dfa2b4d0f0e2ac2f73f78582a3830659d00e
ASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

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>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5682-sdw.c
sound/soc/codecs/rt5682.c