Skip to content

Commit 7036810

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: SOF: Intel: Add Probe compress CPU DAIs
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 <[email protected]> Acked-by: Pierre-Louis Bossart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 394695f commit 7036810

File tree

5 files changed

+48
-0
lines changed

5 files changed

+48
-0
lines changed

sound/soc/sof/compress.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
#include "ops.h"
1414
#include "probe.h"
1515

16+
struct snd_compr_ops sof_probe_compressed_ops = {
17+
.copy = sof_probe_compr_copy,
18+
};
19+
EXPORT_SYMBOL(sof_probe_compressed_ops);
20+
1621
int sof_probe_compr_open(struct snd_compr_stream *cstream,
1722
struct snd_soc_dai *dai)
1823
{

sound/soc/sof/compress.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
#include <sound/compress_driver.h>
1515

16+
extern struct snd_compr_ops sof_probe_compressed_ops;
17+
1618
int sof_probe_compr_open(struct snd_compr_stream *cstream,
1719
struct snd_soc_dai *dai);
1820
int sof_probe_compr_free(struct snd_compr_stream *cstream,

sound/soc/sof/intel/hda-dai.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,19 @@ static const struct snd_soc_dai_ops hda_link_dai_ops = {
399399
.trigger = hda_link_pcm_trigger,
400400
.prepare = hda_link_pcm_prepare,
401401
};
402+
403+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
404+
#include "../compress.h"
405+
406+
static struct snd_soc_cdai_ops sof_probe_compr_ops = {
407+
.startup = sof_probe_compr_open,
408+
.shutdown = sof_probe_compr_free,
409+
.set_params = sof_probe_compr_set_params,
410+
.trigger = sof_probe_compr_trigger,
411+
.pointer = sof_probe_compr_pointer,
412+
};
413+
414+
#endif
402415
#endif
403416

404417
/*
@@ -460,5 +473,20 @@ struct snd_soc_dai_driver skl_dai[] = {
460473
.name = "Alt Analog CPU DAI",
461474
.ops = &hda_link_dai_ops,
462475
},
476+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
477+
{
478+
.name = "Probe Extraction CPU DAI",
479+
.compress_new = snd_soc_new_compress,
480+
.cops = &sof_probe_compr_ops,
481+
.capture = {
482+
.stream_name = "Probe Extraction",
483+
.channels_min = 1,
484+
.channels_max = 8,
485+
.rates = SNDRV_PCM_RATE_48000,
486+
.rate_min = 48000,
487+
.rate_max = 48000,
488+
},
489+
},
490+
#endif
463491
#endif
464492
};

sound/soc/sof/intel/hda.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,13 @@
349349

350350
/* Number of DAIs */
351351
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
352+
353+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA_PROBES)
354+
#define SOF_SKL_NUM_DAIS 16
355+
#else
352356
#define SOF_SKL_NUM_DAIS 15
357+
#endif
358+
353359
#else
354360
#define SOF_SKL_NUM_DAIS 8
355361
#endif

sound/soc/sof/pcm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#include "sof-priv.h"
1717
#include "sof-audio.h"
1818
#include "ops.h"
19+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES)
20+
#include "compress.h"
21+
#endif
1922

2023
/* Create DMA buffer page table for DSP */
2124
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)
787790

788791
#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS)
789792
pd->compr_ops = &sof_compressed_ops;
793+
#endif
794+
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_PROBES)
795+
/* override cops when probe support is enabled */
796+
pd->compr_ops = &sof_probe_compressed_ops;
790797
#endif
791798
pd->pcm_construct = sof_pcm_new;
792799
pd->ignore_machine = drv_name;

0 commit comments

Comments
 (0)