summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/avs/probes.c
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2022-12-02 16:28:36 +0100
committerMark Brown <broonie@kernel.org>2022-12-05 14:05:28 +0000
commited914a2a45a45e7d8f900ae8997ca4573792afcc (patch)
tree62e6955e78b50ad3db38a65e039644b5f8de0f1b /sound/soc/intel/avs/probes.c
parent700462f55493c6831ad71b209eaebe310dcf11fd (diff)
downloadlinux-stable-ed914a2a45a45e7d8f900ae8997ca4573792afcc.tar.gz
linux-stable-ed914a2a45a45e7d8f900ae8997ca4573792afcc.tar.bz2
linux-stable-ed914a2a45a45e7d8f900ae8997ca4573792afcc.zip
ASoC: Intel: avs: Data probing soc-component
Define stub component for data probing. Stub as most operations from standard PCM case do not apply here. Specific bits are CPU DAIs and compress_ops. FE DAIs can link against these new CPU DAI to create new compress devices. Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://lore.kernel.org/r/20221202152841.672536-12-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/avs/probes.c')
-rw-r--r--sound/soc/intel/avs/probes.c53
1 files changed, 51 insertions, 2 deletions
diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index e90284ec8500..29d63f2a9616 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -249,7 +249,6 @@ static int avs_probe_compr_copy(struct snd_soc_component *comp, struct snd_compr
return count;
}
-__maybe_unused
static const struct snd_soc_cdai_ops avs_probe_dai_ops = {
.startup = avs_probe_compr_open,
.shutdown = avs_probe_compr_free,
@@ -258,7 +257,57 @@ static const struct snd_soc_cdai_ops avs_probe_dai_ops = {
.pointer = avs_probe_compr_pointer,
};
-__maybe_unused
static const struct snd_compress_ops avs_probe_compress_ops = {
.copy = avs_probe_compr_copy,
};
+
+static struct snd_soc_dai_driver probe_cpu_dais[] = {
+{
+ .name = "Probe Extraction CPU DAI",
+ .compress_new = snd_soc_new_compress,
+ .cops = &avs_probe_dai_ops,
+ .capture = {
+ .stream_name = "Probe Extraction",
+ .channels_min = 1,
+ .channels_max = 8,
+ .rates = SNDRV_PCM_RATE_48000,
+ .rate_min = 48000,
+ .rate_max = 48000,
+ },
+},
+};
+
+static int avs_probe_component_probe(struct snd_soc_component *component)
+{
+ struct avs_soc_component *acomp = to_avs_soc_component(component);
+ struct avs_dev *adev = to_avs_dev(component->dev);
+
+ mutex_lock(&adev->comp_list_mutex);
+ list_add_tail(&acomp->node, &adev->comp_list);
+ mutex_unlock(&adev->comp_list_mutex);
+ return 0;
+}
+
+static void avs_probe_component_remove(struct snd_soc_component *component)
+{
+ struct avs_soc_component *acomp = to_avs_soc_component(component);
+ struct avs_dev *adev = to_avs_dev(component->dev);
+
+ mutex_lock(&adev->comp_list_mutex);
+ list_del(&acomp->node);
+ mutex_unlock(&adev->comp_list_mutex);
+}
+
+static const struct snd_soc_component_driver avs_probe_component_driver = {
+ .name = "avs-probe-compr",
+ .probe = avs_probe_component_probe,
+ .remove = avs_probe_component_remove,
+ .compress_ops = &avs_probe_compress_ops,
+ .module_get_upon_open = 1, /* increment refcount when a stream is opened */
+};
+
+int avs_probe_platform_register(struct avs_dev *adev, const char *name)
+{
+ return avs_soc_component_register(adev->dev, name, &avs_probe_component_driver,
+ probe_cpu_dais, ARRAY_SIZE(probe_cpu_dais));
+}