]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: SOF: Introduce widget use_count
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Mon, 27 Sep 2021 12:05:14 +0000 (15:05 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 1 Oct 2021 19:48:28 +0000 (20:48 +0100)
commit211951b803b40938c02704105c9f82cd1c959686
treeb26ae4c89a7e597fcc9f1d77a872700abe08b4f3
parent7fd6ad56106f6bdf380b8bf878f4054311657288
ASoC: SOF: Introduce widget use_count

Add a new field, use_count to struct snd_sof_widget to keep track
of the usage count for each widget. Since widgets can belong to
multiple pipelines, this field will ensure that the widget
is setup only when the first pipeline that needs it is started
and freed when the last pipeline that needs it is stopped. There is
no need to protect the widget use_count access as the core already
handles mutual exclusion at the PCM level.
Add a new helper sof_widget_free() to handle freeing the SOF
widgets and export the sof_widget_setup/free() functions.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20210927120517.20505-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc.c
sound/soc/sof/sof-audio.c
sound/soc/sof/sof-audio.h