ASoC: Intel: tgl_max98373: fix a runtime pm issue in multi-thread case
authorRander Wang <rander.wang@intel.com>
Fri, 21 Aug 2020 19:55:53 +0000 (14:55 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 24 Aug 2020 12:41:29 +0000 (13:41 +0100)
commite300486ad94d2608ebc3aaed4e03e86eeeb97084
tree1f86113f5b9a32a362f3efb8497e7201804d3233
parent44751fc5f0de07b0a1ab57e9beab9789638d76d2
ASoC: Intel: tgl_max98373: fix a runtime pm issue in multi-thread case

When the playback & capture streams are stopped simultaneously, the
SOF PCI device will remain pm_runtime active. The root-cause is a race
condition with two threads reaching the trigger function at the same
time. They see another stream is active so the dapm pin is not
disabled, so the codec remains active as well as the parent PCI
device.

For max98373, the capture stream provides feedback when playback is
working and it is unused when playback is stopped. So the dapm pin
should be set only when playback is active.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200821195603.215535-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/sof_maxim_common.c