Skip to content

Commit 7c26d2b

Browse files
MaurizioCascianolgirdwood
authored andcommitted
topology2: ipc3: fix Yoga Book stereo slot masks
SOF IPC3 derives the DAI channel count from the population count of the active TDM slot mask. The original topology enabled all four frame slots with mask 0xf while exposing two-channel PCM streams, so STREAM_PCM_PARAMS failed with -EINVAL. Keep the required four-slot, 25-bit frame geometry but activate only the two stereo slots with mask 0x3. Use the defined default_hw_config_id attribute and add a general topology artifact verifier. The verifier checks PCM and backend-link properties and accepts command-line overrides for use with other configurations. Tested on a Lenovo Yoga Book YB1-X91L with PCM0 playback and capture in S16_LE, S24_LE and S32_LE at 48 kHz stereo, plus PCM1 deep-buffer playback. Signed-off-by: Maurizio Casciano <mauriziocasciano7@gmail.com>
1 parent fb12497 commit 7c26d2b

3 files changed

Lines changed: 382 additions & 5 deletions

File tree

‎tools/topology/topology2/README.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,20 @@ The Yoga Book topology can be built directly with:
416416

417417
```bash
418418
cmake --build . --target topology2_prod_ipc3_sof-cht-rt5677
419+
python3 ../tools/topology/topology2/verify-topology.py \
420+
topology/topology2/production/ipc3/sof-cht-rt5677.tplg
419421
```
420422

421423
`sof-cht-rt5677.tplg` configures SSP2 for DSP_B with an inverted bit clock and
422424
non-inverted frame clock, 48 kHz stereo S24_LE, four 25-bit TDM slots, a
423-
4.8 MHz bit clock, and a 19.2 MHz codec MCLK. These values must stay aligned
424-
with the Linux `cht-yogabook` machine driver.
425+
4.8 MHz bit clock, and a 19.2 MHz codec MCLK. The Linux `cht_rt5677` machine
426+
driver configures the same frame and activates slots 0 and 1 with mask `0x3`.
427+
IPC3 derives the DAI channel count from the population count of this mask, so
428+
using `0xf` would incorrectly advertise four channels for the stereo stream.
429+
The verifier parses the compiled artifact and rejects changes to the SSP link
430+
or the PCM0/PCM1 stereo contract. Its Yoga Book values are defaults;
431+
command-line options can override the PCM, clock, format, frame, slot-mask, and
432+
sample-width expectations for other topologies. Run `verify-topology.py --help`
433+
for the complete interface.
425434

426435
Development and testing topologies go in `development/tplg-targets.cmake`.

‎tools/topology/topology2/cht-rt5677.conf‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<pcm_caps.conf>
1717
<fe_dai.conf>
1818
<route.conf>
19+
<common_definitions.conf>
1920
<virtual.conf>
2021
<ipc3/volume-playback.conf>
2122
<ipc3/mixer-volume-dai-playback.conf>
@@ -47,7 +48,7 @@ Object.Dai.SSP [
4748
dai_index 2
4849
direction "duplex"
4950
name "SSP2-Codec"
50-
default_hw_conf_id 0
51+
default_hw_config_id 0
5152
sample_bits 24
5253

5354
Object.Base.hw_config.1 {
@@ -66,8 +67,10 @@ Object.Dai.SSP [
6667
fsync_invert "false"
6768
tdm_slots 4
6869
tdm_slot_width 25
69-
tx_slots 15
70-
rx_slots 15
70+
# The frame has four slots, but the stereo stream uses slots 0 and 1.
71+
# IPC3 derives the DAI channel count from these active-slot masks.
72+
tx_slots 3
73+
rx_slots 3
7174
}
7275
}
7376
]

0 commit comments

Comments
 (0)