Skip to content

Commit 64007ad

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: Use snd_codec format when initializing probe
The data probing is a debug feature. Currently parameters channels and rate specified by the application are read while the format is ignored. More robust approach is to read all of them. Audio format, while not used by the Probe module for PCM streaming, takes part in the gateway initialization on the DSP side. With full parametrization we gain better coverage with the data probing feature. Signed-off-by: Cezary Rojewski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 845f716 commit 64007ad

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

sound/soc/intel/avs/probes.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "debug.h"
1515
#include "messages.h"
1616

17-
static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_id node_id,
18-
size_t buffer_size)
17+
static int avs_dsp_init_probe(struct avs_dev *adev, struct snd_compr_params *params, int bps,
18+
union avs_connector_node_id node_id, size_t buffer_size)
1919
{
2020
struct avs_probe_cfg cfg = {{0}};
2121
struct avs_module_entry mentry;
@@ -27,12 +27,16 @@ static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_id
2727
return ret;
2828

2929
/*
30-
* Probe module uses no cycles, audio data format and input and output
31-
* frame sizes are unused. It is also not owned by any pipeline.
30+
* Probe module uses no cycles, input and output frame sizes are unused.
31+
* It is also not owned by any pipeline.
3232
*/
3333
cfg.base.ibs = 1;
3434
/* BSS module descriptor is always segment of index=2. */
3535
cfg.base.is_pages = mentry.segments[2].flags.length;
36+
cfg.base.audio_fmt.sampling_freq = params->codec.sample_rate;
37+
cfg.base.audio_fmt.bit_depth = bps;
38+
cfg.base.audio_fmt.num_channels = params->codec.ch_out;
39+
cfg.base.audio_fmt.valid_bit_depth = bps;
3640
cfg.gtw_cfg.node_id = node_id;
3741
cfg.gtw_cfg.dma_buffer_size = buffer_size;
3842

@@ -128,8 +132,6 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
128132
struct hdac_ext_stream *host_stream = avs_compr_get_host_stream(cstream);
129133
struct snd_compr_runtime *rtd = cstream->runtime;
130134
struct avs_dev *adev = to_avs_dev(dai->dev);
131-
/* compr params do not store bit depth, default to S32_LE. */
132-
snd_pcm_format_t format = SNDRV_PCM_FORMAT_S32_LE;
133135
unsigned int format_val;
134136
int bps, ret;
135137

@@ -142,7 +144,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
142144
ret = snd_compr_malloc_pages(cstream, rtd->buffer_size);
143145
if (ret < 0)
144146
return ret;
145-
bps = snd_pcm_format_physical_width(format);
147+
bps = snd_pcm_format_physical_width(params->codec.format);
146148
if (bps < 0)
147149
return bps;
148150
format_val = snd_hdac_stream_format(params->codec.ch_out, bps, params->codec.sample_rate);
@@ -166,7 +168,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
166168
node_id.vindex = hdac_stream(host_stream)->stream_tag - 1;
167169
node_id.dma_type = AVS_DMA_HDA_HOST_INPUT;
168170

169-
ret = avs_dsp_init_probe(adev, node_id, rtd->dma_bytes);
171+
ret = avs_dsp_init_probe(adev, params, bps, node_id, rtd->dma_bytes);
170172
if (ret < 0) {
171173
dev_err(dai->dev, "probe init failed: %d\n", ret);
172174
avs_dsp_enable_d0ix(adev);

0 commit comments

Comments
 (0)