Re: [PATCH 1/4] ASoC: Intel: sof_cs42l42: support JSL DAI link sequence

From: Pierre-Louis Bossart
Date: Mon Jun 07 2021 - 16:49:21 EST



Cs42l42 is sharing topology with DA7219's topology source file sof-glk-da7219.m4
on GLK platform. The configuration is:

dai link id 0 is for spk
#SSP 1 (ID: 0) with 19.2 MHz mclk with MCLK_ID 1 (unused), 1.536 MHz blck
DAI_CONFIG(SSP, 1, 0, SSP1-Codec,

dai link id 1 is for headphone
#SSP 2 (ID: 1) with 19.2 MHz mclk with MCLK_ID 1, 1.92 MHz bclk
DAI_CONFIG(SSP, 2, 1, SSP2-Codec,

dai link id 2 is for dmic
DAI_CONFIG(DMIC, 0, 2, dmic01,

dai link id 3/4/5 is for hdmi
DAI_CONFIG(HDA, 3, 3, iDisp1,
DAI_CONFIG(HDA, 4, 4, iDisp2,
DAI_CONFIG(HDA, 5, 5, iDisp3,

When on JSL, we plan to share topology with rt5682 which has different dai link
sequence:
sof-jsl-rt5682.m4:

dai link id 0 is for headphone
DAI_CONFIG(SSP, 0, 0, SSP0-Codec,

dai link id 6 is for spk
# SSP 1 (ID: 6)
DAI_CONFIG(SSP, SPK_INDEX, 6, SPK_NAME,
SET_SSP_CONFIG)

dai link id 3/4/5 is for hdmi
# 4 HDMI/DP outputs (ID: 3,4,5)
DAI_CONFIG(HDA, 0, 3, iDisp1,
DAI_CONFIG(HDA, 1, 4, iDisp2,
DAI_CONFIG(HDA, 2, 5, iDisp3,

I'm not sure if there is convention about the sequence to follow?

ok, now I get what you are trying to do.

Unfortunately there are no conventions so far, and since we have to be backwards-compatible with topology files already released we will need to deal with the different configurations in this machine driver, you're right about this.

The code you suggested is fine, but we can future-proof it a bit.

Instead of assuming any order depending on GLK or !GLK, we can add a BE 'base' for headphone, amp, DMIC and DMIC each (represented as a constant structure) and point to different configurations depending on a quirk. That way we can deal with other permutations such as HP - SPK - HDMI - DMIC