ASoC: SOF: Intel: Add Probe compress CPU DAIs
authorCezary Rojewski <cezary.rojewski@intel.com>
Tue, 18 Feb 2020 14:39:24 +0000 (15:39 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 18 Feb 2020 21:52:11 +0000 (21:52 +0000)
Declare extraction CPU DAI as well as sof_probe_compr_ops. FE DAIs can
link against these new CPU DAI to create new compress devices.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200218143924.10565-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/compress.c
sound/soc/sof/compress.h
sound/soc/sof/intel/hda-dai.c
sound/soc/sof/intel/hda.h
sound/soc/sof/pcm.c

index e87cc81a0599edcaa588e2715d62867aca18184e..7354dc6a49cf886da9705b5d54f37945fb2aee41 100644 (file)
 #include "ops.h"
 #include "probe.h"
 
+struct snd_compr_ops sof_probe_compressed_ops = {
+       .copy           = sof_probe_compr_copy,
+};
+EXPORT_SYMBOL(sof_probe_compressed_ops);
+
 int sof_probe_compr_open(struct snd_compr_stream *cstream,
                struct snd_soc_dai *dai)
 {
index dccc9e008f819cdd07626d552c55fc2bbd0fc33e..800f163603e1e10bf7832c84c1b306dc3bccbc68 100644 (file)
@@ -13,6 +13,8 @@
 
 #include <sound/compress_driver.h>
 
+extern struct snd_compr_ops sof_probe_compressed_ops;
+
 int sof_probe_compr_open(struct snd_compr_stream *cstream,
                struct snd_soc_dai *dai);
 int sof_probe_compr_free(struct snd_compr_stream *cstream,
index 9c6e3f990ee31d6cf5ee6c28a3daf7b42433b571..ed5e7d2c0d432afaf8af22412a326efa891a81c3 100644 (file)
@@ -399,6 +399,19 @@ static const struct snd_soc_dai_ops hda_link_dai_ops = {
        .trigger = hda_link_pcm_trigger,
        .prepare = hda_link_pcm_prepare,
 };
+
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
+#include "../compress.h"
+
+static struct snd_soc_cdai_ops sof_probe_compr_ops = {
+       .startup        = sof_probe_compr_open,
+       .shutdown       = sof_probe_compr_free,
+       .set_params     = sof_probe_compr_set_params,
+       .trigger        = sof_probe_compr_trigger,
+       .pointer        = sof_probe_compr_pointer,
+};
+
+#endif
 #endif
 
 /*
@@ -460,5 +473,20 @@ struct snd_soc_dai_driver skl_dai[] = {
        .name = "Alt Analog CPU DAI",
        .ops = &hda_link_dai_ops,
 },
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
+{
+       .name = "Probe Extraction CPU DAI",
+       .compress_new = snd_soc_new_compress,
+       .cops = &sof_probe_compr_ops,
+       .capture = {
+               .stream_name = "Probe Extraction",
+               .channels_min = 1,
+               .channels_max = 8,
+               .rates = SNDRV_PCM_RATE_48000,
+               .rate_min = 48000,
+               .rate_max = 48000,
+       },
+},
+#endif
 #endif
 };
index ca44ecb765344875a3a368378ab6d426f9e38725..537c0a930a15c82d559df5ffb456ab82fe70ec56 100644 (file)
 
 /* Number of DAIs */
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
+
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
+#define SOF_SKL_NUM_DAIS               16
+#else
 #define SOF_SKL_NUM_DAIS               15
+#endif
+
 #else
 #define SOF_SKL_NUM_DAIS               8
 #endif
index db3df02c7398f105c472889c7445f4fc853df0ac..b239bbff4b5cda71cc756e04442a115689f19384 100644 (file)
@@ -16,6 +16,9 @@
 #include "sof-priv.h"
 #include "sof-audio.h"
 #include "ops.h"
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES)
+#include "compress.h"
+#endif
 
 /* Create DMA buffer page table for DSP */
 static int create_page_table(struct snd_soc_component *component,
@@ -787,6 +790,10 @@ void snd_sof_new_platform_drv(struct snd_sof_dev *sdev)
 
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
        pd->compr_ops = &sof_compressed_ops;
+#endif
+#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES)
+       /* override cops when probe support is enabled */
+       pd->compr_ops = &sof_probe_compressed_ops;
 #endif
        pd->pcm_construct = sof_pcm_new;
        pd->ignore_machine = drv_name;