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 19:15:14 +0000 (20:15 +0100)
commit0235bc04627d02a08f7ad9d226a8fe78e6c4a1c3
tree084d190df7e526152552e7a33489826c71b4b6d1
parent3c27ea23ffb43262da6c64964163895951aaed4e
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.

Fixes: 94d2d08974746 ('ASoC: Intel: Boards: tgl_max98373: add dai_trigger function')
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