Skip to content

ipc4: dai: fix DMIC DMA link setup#10555

Open
serhiy-katsyuba-intel wants to merge 2 commits intothesofproject:mainfrom
serhiy-katsyuba-intel:out_fmt_fix
Open

ipc4: dai: fix DMIC DMA link setup#10555
serhiy-katsyuba-intel wants to merge 2 commits intothesofproject:mainfrom
serhiy-katsyuba-intel:out_fmt_fix

Conversation

@serhiy-katsyuba-intel
Copy link
Contributor

There are two problems with out_fmt:

  • 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.

  • 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.

This prevents initializing unused members of struct dai_config with
random garbage from the stack. In case some Zephyr DAI driver uses such
an uninitialized member, it's better to have a bug with stable
reproduction than a random one.

Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments