Skip to content

Commit

Permalink
topology2: change the sample type for Linux audio system
Browse files Browse the repository at this point in the history
At first the sample type is set to MSB_INTEGER to follow windows
settings, but actually we use LSB_INTERGER type such as S24_4LE.
Now change the default sample type to LSB_INTERGER to align with
FW usage. For DAI copier we need to use MSB_INTERGER for hardware
requirement. Currently sample type only affect s24/c32 case, so only
change sample type in dai for this format config.

FW will use sample type to choose correct format conversion
function and can deal with Windows audio stream correctly with MSB
s24/c32 format.

out_fmt_cfg is redefined for a alsa-lib bug. Alsa-lib will first process
out_fmt_cfg = '$[($out_channels | ($out_valid_bit_depth * 256)) |
($out_sample_type * 65536)]' in base class and then deal with
out_sample_type, so error is reported. Now first define out_sample_type
and then out_fmt_cfg, everything works.

Signed-off-by: Rander Wang <[email protected]>
(cherry picked from commit fc8a4b6)
  • Loading branch information
RanderWang authored and kv2019i committed Sep 7, 2023
1 parent 92c45ab commit 2935d98
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tools/topology/topology2/include/common/audio_format.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ Class.Base."audio_format" {
in_valid_bit_depth 16
in_channels 2
in_interleaving_style "interleaved"
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
in_sample_type $SAMPLE_TYPE_LSB_INTEGER
out_rate 48000
out_bit_depth 16
out_valid_bit_depth 16
out_channels 2
out_interleaving_style "interleaved"
out_sample_type $SAMPLE_TYPE_MSB_INTEGER
out_sample_type $SAMPLE_TYPE_LSB_INTEGER
in_ch_cfg $CHANNEL_CONFIG_STEREO
in_ch_map $CHANNEL_MAP_STEREO
out_ch_cfg $CHANNEL_CONFIG_STEREO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Class.Base."input_audio_format" {
in_valid_bit_depth 16
in_channels 2
in_interleaving_style "interleaved"
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
in_sample_type $SAMPLE_TYPE_LSB_INTEGER
in_ch_cfg $CHANNEL_CONFIG_STEREO
in_ch_map $CHANNEL_MAP_STEREO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Class.Base."output_audio_format" {
out_valid_bit_depth 16
out_channels 2
out_interleaving_style "interleaved"
out_sample_type $SAMPLE_TYPE_MSB_INTEGER
out_sample_type $SAMPLE_TYPE_LSB_INTEGER
out_ch_cfg $CHANNEL_CONFIG_STEREO
out_ch_map $CHANNEL_MAP_STEREO

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Class.Pipeline."dai-copier-be" {
in_valid_bit_depth 24
out_bit_depth 32
out_valid_bit_depth 24
out_sample_type $SAMPLE_TYPE_MSB_INTEGER
out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Class.Pipeline."dai-kpb-be" {
in_valid_bit_depth 24
out_bit_depth 32
out_valid_bit_depth 24
out_sample_type $SAMPLE_TYPE_MSB_INTEGER
out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]"
}

Object.Base.audio_format.1 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Class.Pipeline."io-gateway" {
{
out_bit_depth 32
out_valid_bit_depth 24
out_sample_type $SAMPLE_TYPE_MSB_INTEGER
out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]"
}
{
out_bit_depth 32
Expand Down

0 comments on commit 2935d98

Please sign in to comment.