copier: add support for windows driver

Windows driver always set sample type of MSB for 24/32 format but SOF FW
supports 24/32 LSB type for non-copier modules. So FW will convert the
input MSB 24/32 to LSB 24/32 and process it and convert it back to MSB
24/32 when exiting gtw.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Damian Nikodem <damian.nikodem@intel.com>
This commit is contained in:
Rander Wang 2023-11-08 11:18:00 +08:00 committed by Liam Girdwood
parent 807471497a
commit 383d17a19e
1 changed files with 39 additions and 4 deletions

View File

@ -274,10 +274,45 @@ pcm_converter_func get_converter_func(const struct ipc4_audio_format *in_fmt,
audio_stream_fmt_conversion(out_fmt->depth, out_fmt->valid_bit_depth, &out, &out_valid,
out_fmt->s_type);
if (in_fmt->s_type == IPC4_TYPE_MSB_INTEGER && in_valid == SOF_IPC_FRAME_S24_4LE)
in_valid = SOF_IPC_FRAME_S24_4LE_MSB;
if (out_fmt->s_type == IPC4_TYPE_MSB_INTEGER && out_valid == SOF_IPC_FRAME_S24_4LE)
out_valid = SOF_IPC_FRAME_S24_4LE_MSB;
/* use MSB sample type to select conversion function if the data is enter or exit dsp.
* In playback case, host input and dai output and in capture case, host output and
* dai input.
*/
if (in_fmt->s_type == IPC4_TYPE_MSB_INTEGER && in_valid == SOF_IPC_FRAME_S24_4LE) {
switch (type) {
case ipc4_gtw_host:
if (dir == ipc4_playback)
in_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
case ipc4_gtw_alh:
case ipc4_gtw_link:
case ipc4_gtw_ssp:
case ipc4_gtw_dmic:
if (dir == ipc4_capture)
in_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
default:
break;
}
}
if (out_fmt->s_type == IPC4_TYPE_MSB_INTEGER && out_valid == SOF_IPC_FRAME_S24_4LE) {
switch (type) {
case ipc4_gtw_host:
if (dir == ipc4_capture)
out_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
case ipc4_gtw_alh:
case ipc4_gtw_link:
case ipc4_gtw_ssp:
case ipc4_gtw_dmic:
if (dir == ipc4_playback)
out_valid = SOF_IPC_FRAME_S24_4LE_MSB;
break;
default:
break;
}
}
/* check container & sample size */
if (use_no_container_convert_function(in, in_valid, out, out_valid))