From 6424e6d7e6653c02e45f8bb20aede8952d3a835e Mon Sep 17 00:00:00 2001 From: Brent Lu Date: Thu, 24 Aug 2023 12:36:41 +0800 Subject: [PATCH] topology1: adl-max98360a-da7219: support DA7219 headphone codec Add an new topology adl-max98360a-da7219.tplg for DA7219 headphone codec with MAX98360A speaker amplifier on ADL boards. The MCLK frequency is set to 24.576MHz to use PLL bypass mode and avoid the WCLK locking problem on earlier platforms. Signed-off-by: Brent Lu --- tools/topology/topology1/CMakeLists.txt | 1 + .../topology1/sof-tgl-max98357a-rt5682.m4 | 30 +++++++++++++------ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tools/topology/topology1/CMakeLists.txt b/tools/topology/topology1/CMakeLists.txt index b6f5a7bcb0c3..5a9523f3643d 100644 --- a/tools/topology/topology1/CMakeLists.txt +++ b/tools/topology/topology1/CMakeLists.txt @@ -111,6 +111,7 @@ set(TPLGS "sof-tgl-max98357a-rt5682\;sof-adl-cs35l41\;-DCODEC=CS35L41\;-DFMT=s24le\;-DPLATFORM=adl\;-DLINUX_MACHINE_DRIVER=sof_ssp_amp\;-DAMP_SSP=1\;-DBT_OFFLOAD\;-DNO_HEADPHONE" "sof-tgl-max98357a-rt5682\;sof-adl-cs35l41-waves\;-DCODEC=CS35L41\;-DFMT=s24le\;-DPLATFORM=adl\;-DLINUX_MACHINE_DRIVER=sof_ssp_amp\;-DAMP_SSP=1\;-DBT_OFFLOAD\;-DNO_HEADPHONE\;-DWAVES\;-DNOHOTWORD\;-DNO16KDMIC" "sof-tgl-max98357a-rt5682\;sof-adl-cs35l41-google-aec-waves\;-DCODEC=CS35L41\;-DFMT=s24le\;-DPLATFORM=adl\;-DLINUX_MACHINE_DRIVER=sof_ssp_amp\;-DAMP_SSP=1\;-DBT_OFFLOAD\;-DNO_HEADPHONE\;-DGOOGLE_RTC_AUDIO_PROCESSING\;-DWAVES\;-DNOHOTWORD\;-DNO16KDMIC\;-DSPK_MIC_PERIOD_US=10000" + "sof-tgl-max98357a-rt5682\;sof-adl-max98360a-da7219\;-DUSE_DA7219\;-DCODEC=MAX98360A\;-DFMT=s32le\;-DPLATFORM=adl\;-DLINUX_MACHINE_DRIVER=sof_rt5682\;-DAMP_SSP=1\;-DBT_OFFLOAD\;-DSPK_MIC_PERIOD_US=10000\;-DNOHOTWORD\;-DNO16KDMIC" "sof-tgl-max98373-rt5682\;sof-tgl-max98373-rt5682\;-DAMP_SSP=1" "sof-tgl-max98373-rt5682\;sof-tgl-max98373-rt5682-igonr\;-DAMP_SSP=1\;-DIGO" "sof-tgl-max98373-rt5682\;sof-tgl-max98373-rt5682-xperi\;-DAMP_SSP=1\;-DINCLUDE_IIR_EQ=1" diff --git a/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 b/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 index 0f316f48161a..0951f278d73c 100644 --- a/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 +++ b/tools/topology/topology1/sof-tgl-max98357a-rt5682.m4 @@ -30,6 +30,9 @@ DEBUG_START # ifdef(`2CH_2WAY', `ifdef(`4CH_PASSTHROUGH', `fatal_error(note: 2CH_2WAY and 4CH_PASSTHROUGH are mutually exclusive)')') +ifdef(`USE_DA7219',`define(HEADPHONE, `DA7219')',`define(HEADPHONE, `RT5682')') +ifdef(`USE_DA7219',`define(MCLK_RATE, `24576000')',`define(MCLK_RATE, `19200000')') + # # Define the demux configure # @@ -426,43 +429,43 @@ ifdef(`NO_AMP',`',` DAI_CONFIG(SSP, SPK_SSP_INDEX, SPK_BE_ID, SPK_SSP_NAME, ifelse( CODEC, `MAX98357A', ` - SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(I2S, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 1536000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(2, 16, 3, 3), SSP_CONFIG_DATA(SSP, SPK_SSP_INDEX, 16)))', CODEC, `MAX98360A', ` - SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(I2S, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 3072000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(2, 32, 3, 3), SSP_CONFIG_DATA(SSP, SPK_SSP_INDEX, 32)))', CODEC, `MAX98360A_TDM', ` - SSP_CONFIG(DSP_A, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(DSP_A, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 12288000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(8, 32, 15, 15), SSP_CONFIG_DATA(SSP, SPK_SSP_INDEX, 32)))', CODEC, `RT1011', ` - SSP_CONFIG(DSP_A, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(DSP_A, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 4800000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(4, 25, 3, 15), SSP_CONFIG_DATA(SSP, SPK_SSP_INDEX, 24)))', CODEC, `MAX98390', ` - SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 6144000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(4, 32, 3, 15), SSP_CONFIG_DATA(SSP, SPK_SSP_INDEX, 32)))', CODEC, `RT1019', ` - SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(I2S, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 3072000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(2, 32, 3, 3), SSP_CONFIG_DATA(SSP, SPK_SSP_INDEX, 24)))', CODEC, `CS35L41', ` - SSP_CONFIG(DSP_A, SSP_CLOCK(mclk, 19200000, codec_mclk_in), + SSP_CONFIG(DSP_A, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 6144000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(4, 32, 3, 15), @@ -472,11 +475,20 @@ ifelse( ifdef(`NO_HEADPHONE',`',` # SSP 0 (ID: BOARD_HP_BE_ID) DAI_CONFIG(SSP, 0, BOARD_HP_BE_ID, SSP0-Codec, - SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in), +ifelse( + HEADPHONE, `DA7219', ` + SSP_CONFIG(I2S, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), + SSP_CLOCK(bclk, 3072000, codec_slave), + SSP_CLOCK(fsync, 48000, codec_slave), + SSP_TDM(2, 32, 3, 3), + SSP_CONFIG_DATA(SSP, 0, 24)))', + HEADPHONE, `RT5682', ` + SSP_CONFIG(I2S, SSP_CLOCK(mclk, MCLK_RATE, codec_mclk_in), SSP_CLOCK(bclk, 2400000, codec_slave), SSP_CLOCK(fsync, 48000, codec_slave), SSP_TDM(2, 25, 3, 3), - SSP_CONFIG_DATA(SSP, 0, 24, 0, 0, 0, SSP_CC_BCLK_ES)))') + SSP_CONFIG_DATA(SSP, 0, 24, 0, 0, 0, SSP_CC_BCLK_ES)))', + )') # 4 HDMI/DP outputs (ID: 3,4,5,6) DAI_CONFIG(HDA, 0, BOARD_HDMI_BE_ID_BASE, iDisp1,