Skip to content

topology2: sdw-jack-generic: Make BE DAI and copiers honor SDW_JACK_C… - #11036

Draft
rfvirgil wants to merge 1 commit into
thesofproject:mainfrom
CirrusLogic:tplg2-simple-jack-1ch-fix
Draft

topology2: sdw-jack-generic: Make BE DAI and copiers honor SDW_JACK_C…#11036
rfvirgil wants to merge 1 commit into
thesofproject:mainfrom
CirrusLogic:tplg2-simple-jack-1ch-fix

Conversation

@rfvirgil

Copy link
Copy Markdown
Contributor

CS42L42 capture DP only has 1 channel.

Jack capture was not working on CS42L42 even with SDW_JACK_CAPTURE_CH=1. This was because the simple-jack tplg did not apply SDW_JACK_CAPTURE_CH to the BE DAI or copiers. The result was that SOF/ASoC would attempt to open a 2-channel stream, which would then fail to prepare because DP0.ch1 does not exist.

@rfvirgil
rfvirgil requested a review from bardliao July 24, 2026 16:05
@rfvirgil
rfvirgil requested review from jsarha and ranj063 as code owners July 24, 2026 16:05
@rfvirgil
rfvirgil force-pushed the tplg2-simple-jack-1ch-fix branch from f968c19 to 91318ce Compare July 24, 2026 16:06
@bardliao
bardliao requested a review from Copilot July 27, 2026 07:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the topology2 Intel SoundWire “sdw-jack-generic” platform configuration to correctly honor SDW_JACK_CAPTURE_CH for jack capture, addressing failures when the codec capture datapath only supports mono (e.g., CS42L42 DP0).

Changes:

  • Set the capture BE DAI channel count from a hardcoded 2 to $SDW_JACK_CAPTURE_CH.
  • Propagate $SDW_JACK_CAPTURE_CH into the host-gateway capture copier output audio formats.
  • Propagate $SDW_JACK_CAPTURE_CH into the capture ALH copier input audio format.
Comments suppressed due to low confidence (1)

tools/topology/topology2/platform/intel/sdw-jack-generic.conf:391

  • out_sample_type is set to UNSIGNED_INTEGER but out_fmt_cfg is computed without incorporating the sample type, diverging from the default out_fmt_cfg expression in tools/topology/topology2/include/common/output_audio_format.conf:134. This can generate an incorrect format config for non-integer sample types.
							out_fmt_cfg		"$[($out_channels | ($out_valid_bit_depth * 256))]"

out_bit_depth 32
out_valid_bit_depth 32
out_sample_type $SAMPLE_TYPE_FLOAT
out_fmt_cfg "$[($out_channels | ($out_valid_bit_depth * 256))]"
Comment on lines 463 to 467
in_rate $JACK_RATE
in_channels $SDW_JACK_CAPTURE_CH
in_bit_depth 32
in_valid_bit_depth $SDW_LINK_VALID_BITS
in_sample_type $SAMPLE_TYPE_MSB_INTEGER
@rfvirgil

Copy link
Copy Markdown
Contributor Author

@bardliao For the last Copilot issue:

The capture ALH copier now sets in_channels from SDW_JACK_CAPTURE_CH, but its output_audio_format still relies on the default out_channels (2). This can leave the pipeline advertising/staging stereo output even when the DAI input is mono.

I tried setting the out_channels of the alh-copier but then I got corrupted audio, even if I also set out_fmt_cfg.

@rfvirgil
rfvirgil marked this pull request as draft July 27, 2026 10:42

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfvirgil can you address the copilot comments before we merge. Thanks !

@bardliao

Copy link
Copy Markdown
Collaborator

@bardliao For the last Copilot issue:

The capture ALH copier now sets in_channels from SDW_JACK_CAPTURE_CH, but its output_audio_format still relies on the default out_channels (2). This can leave the pipeline advertising/staging stereo output even when the DAI input is mono.

I tried setting the out_channels of the alh-copier but then I got corrupted audio, even if I also set out_fmt_cfg.

Yeah, I think other components work with 2 channels. So we need to do 4 ch -> 2 ch convert in the copier. @singalsu Am I correct?

…URE_CH

The BE DAI and all widgets in the capture path should honor the number of
capture channels set by SDW_JACK_CAPTURE_CH.

Before this change, the value of SDW_JACK_CAPTURE_CH only affected the
min/max channels of the FE DAI but all the other widgets in the pipeline
were defaulting to 2-channel. Because of this, the codec DAI was always
asked for a 2-channel capture, which won't work on codecs that only
support 1 channel. And the host-copier output was 2-channel audio that
could not be connected to the 1-channel DAI.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
@rfvirgil
rfvirgil force-pushed the tplg2-simple-jack-1ch-fix branch from 91318ce to 839185b Compare July 27, 2026 15:55
@rfvirgil

Copy link
Copy Markdown
Contributor Author

It turns out that setting in_fmt/out_fmt is a red herring that causes more problems than it fixes. The correct fix seems to be setting [in|out]_ch_map and [in|out]_ch_cfg, and then I can hook everything together with functioning audio.

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.

4 participants