Skip to content

Commit

Permalink
topology2: sdw-amp-generic: Remove hardcoded number of feedback channels
Browse files Browse the repository at this point in the history
Replace the hardcoded assumption of 2 feedback channels per link

A new constant AMP_FEEDBACK_CH_PER_LINK is added to set the number of
channels for the link BE DAI, replacing the original hardcoded value
of 2.

The default values are:
  For NUM_SDW_AMP_LINKS=1:
    AMP_FEEDBACK_CH=2, AMP_FEEDBACK_CH_PER_LINK=2

  For NUM_SDW_AMP_LINKS=2:
    AMP_FEEDBACK_CH=4, AMP_FEEDBACK_CH_PER_LINK=2

The alh-copier definition has been rewritten so that it is based only on
AMP_FEEDBACK_CH, instead of making assumptions from NUM_SDW_AMP_LINKS.
It supports 2 or 4 total feedback channels. Support for 1 and 3 feedback
channels has not been included because these are unusual and the code is
smaller without them. They can be added later if they are needed.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
  • Loading branch information
rfvirgil committed Oct 29, 2024
1 parent 5fe899d commit d9c5d19
Showing 1 changed file with 35 additions and 35 deletions.
70 changes: 35 additions & 35 deletions tools/topology/topology2/platform/intel/sdw-amp-generic.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Define {
SDW_AMP_BE_ID 2
SDW_AMP_IN_BE_ID 3
AMP_FEEDBACK_CH 2
AMP_FEEDBACK_CH_PER_LINK 2
SDW_AMP_FEEDBACK true
}

Expand Down Expand Up @@ -181,6 +182,7 @@ IncludeByKey.NUM_SDW_AMP_LINKS {
"2" {
Define {
AMP_FEEDBACK_CH 4
AMP_FEEDBACK_CH_PER_LINK 2
}

Object.Widget {
Expand Down Expand Up @@ -353,7 +355,7 @@ IncludeByKey.SDW_AMP_FEEDBACK {
name $SDW_SPK_IN_STREAM
default_hw_conf_id 1
rate 48000
channels 2
channels $AMP_FEEDBACK_CH_PER_LINK

Object.Base.hw_config.1 {
id 1
Expand Down Expand Up @@ -386,47 +388,45 @@ IncludeByKey.SDW_AMP_FEEDBACK {
num_output_audio_formats 1
num_output_pins 1

IncludeByKey.NUM_SDW_AMP_LINKS {
"2" {
Object.Base.input_audio_format [
{
in_channels 4
in_bit_depth 32
in_valid_bit_depth $SDW_LINK_VALID_BITS
Object.Base.input_audio_format [
{
in_channels $AMP_FEEDBACK_CH
in_bit_depth 32
in_valid_bit_depth $SDW_LINK_VALID_BITS

IncludeByKey.AMP_FEEDBACK_CH {
"2" {
in_ch_cfg $CHANNEL_CONFIG_STEREO
in_ch_map $CHANNEL_MAP_STEREO
}
"4" {
in_ch_cfg $CHANNEL_CONFIG_3_POINT_1
in_ch_map $CHANNEL_MAP_3_POINT_1
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
}
]
Object.Base.output_audio_format [
{
out_channels 4
out_bit_depth 32
out_valid_bit_depth 32
}

in_sample_type $SAMPLE_TYPE_MSB_INTEGER
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
}
]
Object.Base.output_audio_format [
{
out_channels $AMP_FEEDBACK_CH
out_bit_depth 32
out_valid_bit_depth 32

IncludeByKey.AMP_FEEDBACK_CH {
"2" {
out_ch_cfg $CHANNEL_CONFIG_STEREO
out_ch_map $CHANNEL_MAP_STEREO
}
"4" {
out_ch_cfg $CHANNEL_CONFIG_3_POINT_1
out_ch_map $CHANNEL_MAP_3_POINT_1
}
]
}
"1" {
# 32-bit 48KHz 2ch
Object.Base.input_audio_format [
{
in_bit_depth 32
in_valid_bit_depth $SDW_LINK_VALID_BITS
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
in_fmt_cfg "$[($in_channels | ($in_valid_bit_depth * 256))]"
}
]
Object.Base.output_audio_format [
{
out_bit_depth 32
out_valid_bit_depth 32
}
]
}
}
}
]
}
]
pipeline [
Expand Down

0 comments on commit d9c5d19

Please sign in to comment.