Skip to content

Commit dc53aaf

Browse files
serhiy-katsyuba-intellgirdwood
authored andcommitted
ipc4: dai: fix DMIC DMA link setup
There are two problems with out_fmt: (1) Audio format for gateway DMA data is sent either in copier's base.audio_fmt or out_fmt depending on gateway direction. DMIC is a capture gateway and its input pin format should be used to set up DMA link. UAOL gateway (coming soon) can be either capture or playback, hence the direction check is used. (2) The copier pointer in copier_dai_create() points to IPC memory window contents. However, out_fmt (now gtw_fmt) is also used when DAIs are resumed after exiting D3 state. So cd->config (a copy of ipc4_copier_module_cfg that is kept allocated throughout the copier module lifetime) is used to get the address of the audio format struct. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 505e201 commit dc53aaf

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/audio/copier/copier_dai.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,8 @@ __cold int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
285285
dai.is_config_blob = true;
286286
dai.sampling_frequency = copier->out_fmt.sampling_frequency;
287287
dai.feature_mask = copier->copier_feature_mask;
288+
dai.gtw_fmt = (dai.direction == SOF_IPC_STREAM_PLAYBACK) ?
289+
&cd->config.out_fmt : &cd->config.base.audio_fmt;
288290

289291
switch (node_id.f.dma_type) {
290292
case ipc4_hda_link_output_class:
@@ -303,7 +305,6 @@ __cold int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
303305
comp_err(dev, "No ssp dma_config found in blob!");
304306
return -EINVAL;
305307
}
306-
dai.out_fmt = &copier->out_fmt;
307308
break;
308309
case ipc4_alh_link_output_class:
309310
case ipc4_alh_link_input_class:
@@ -330,7 +331,6 @@ __cold int copier_dai_create(struct comp_dev *dev, struct copier_data *cd,
330331
comp_err(dev, "No dmic dma_config found in blob!");
331332
return -EINVAL;
332333
}
333-
dai.out_fmt = &copier->out_fmt;
334334
#if CONFIG_COPIER_GAIN
335335
dai.apply_gain = true;
336336
#endif

src/include/sof/audio/ipc-config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct ipc_config_dai {
7777
*/
7878
/**< DMA configs - required for ACE 2.0 and newer */
7979
struct ipc_dma_config *host_dma_config[GTW_DMA_DEVICE_MAX_COUNT];
80-
const struct ipc4_audio_format *out_fmt;/**< audio format for output pin 0 - required
80+
const struct ipc4_audio_format *gtw_fmt;/**< audio format for gateway DMA data - required
8181
* for ACE 2.0 and newer
8282
*/
8383
/* Gain feature flag */

src/ipc/ipc4/dai.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void dai_set_link_hda_config(uint16_t *link_config,
3838
const void *spec_config)
3939
{
4040
#if ACE_VERSION > ACE_VERSION_1_5
41-
const struct ipc4_audio_format *out_fmt = common_config->out_fmt;
41+
const struct ipc4_audio_format *gtw_fmt = common_config->gtw_fmt;
4242
union hdalink_cfg link_cfg;
4343

4444
switch (common_config->type) {
@@ -49,14 +49,14 @@ void dai_set_link_hda_config(uint16_t *link_config,
4949
break;
5050
case SOF_DAI_INTEL_DMIC:
5151
link_cfg.full = 0;
52-
if (out_fmt->depth == IPC4_DEPTH_16BIT) {
52+
if (gtw_fmt->depth == IPC4_DEPTH_16BIT) {
5353
/* 16bit dmic packs two 16bit samples into single 32bit word
5454
* fw needs to adjust channel count to match final sample
5555
* group size
5656
*/
57-
link_cfg.part.hchan = (out_fmt->channels_count - 1) / 2;
57+
link_cfg.part.hchan = (gtw_fmt->channels_count - 1) / 2;
5858
} else {
59-
link_cfg.part.hchan = out_fmt->channels_count - 1;
59+
link_cfg.part.hchan = gtw_fmt->channels_count - 1;
6060
}
6161
link_cfg.part.stream = common_config->host_dma_config[0]->stream_id;
6262
break;

0 commit comments

Comments
 (0)