ASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic pipelines
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mon, 4 Oct 2021 17:14:30 +0000 (12:14 -0500)
committerMark Brown <broonie@kernel.org>
Tue, 5 Oct 2021 12:08:14 +0000 (13:08 +0100)
commit84e3cfd16a72c7b7d569b72661093cdd16346d29
tree74f31859f5ec633c7abfbe50c19f5fd47fe69d82
parent68776b2fb06e7e438a2c4ebca5ca7f216e31d678
ASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic pipelines

In order to keep the widget use_count balanced, make sure the DAI
widgets are allocated once in hw_params and released in hw_free. A
'setup' status flag is used to deal with cases where the .hw_params
callback is invoked multiple times, and likewise with cases where
hw_free is invoked without hw_params being called first (which can
happen if the FE hw_params fails).

In addition, this patch frees the widgets in the suspend transition,
and reallocates them in the .prepare callback. The 'setup' flag helps
in this case differentiate between resume (setup needed) and
xruns (setup not needed).

This balanced operation was not needed previously but will be required
when SOF dynamic pipelines are enabled.

Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda-dai.c