Skip to content

Commit

Permalink
copier: add support for windows driver
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Damian Nikodem <[email protected]>
  • Loading branch information
RanderWang committed Nov 17, 2023
1 parent 20e7e31 commit 55bfb54
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions src/audio/copier/copier_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,41 @@ 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;
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))
Expand Down

0 comments on commit 55bfb54

Please sign in to comment.