[RFC SOF 1/2] topology: Add sof-byt-codec-tdm4.m4 file

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Mon Dec 7 16:11:10 CET 2020


Hi Hans,

> Some BYT/CHT boards (mostly Cherry Trail) use TDM 4 slots 24 bit as
> wire format to the codec, rather then standard I2S 2 channel 24 bit.
> 
> Add a new m4 file for this. This is a copy of sof-byt-codec.m4 with
> the following changes:
> 
> @@ -1,4 +1,4 @@
> -`# Topology for generic' PLATFORM `board with' CODEC `on SSP' SSP_NUM
> +`# Topology for generic' PLATFORM `board with' CODEC `on SSP' SSP_NUM `using TDM 4 slots 24 bit'
> 
>   # Include topology builder
>   include(`utils.m4')
> @@ -97,8 +97,8 @@
>   # BE configurations - overrides config in ACPI if present
>   #
>   DAI_CONFIG(SSP, SSP_NUM, 0, SSP2-Codec,
> -	   SSP_CONFIG(I2S, SSP_CLOCK(mclk, 19200000, codec_mclk_in),
> -		      SSP_CLOCK(bclk, 2400000, codec_slave),
> +	   SSP_CONFIG(DSP_B, SSP_CLOCK(mclk, 19200000, codec_mclk_in),
> +		      SSP_CLOCK(bclk, 4800000, codec_slave),
>   		      SSP_CLOCK(fsync, 48000, codec_slave),
> -		      SSP_TDM(2, 25, 3, 3),
> +		      SSP_TDM(4, 25, 3, 3),
>   		      SSP_CONFIG_DATA(SSP, SSP_NUM, 24)))

I don't think this change is necessary, the problem is probably that we 
still rely on the hard-coded 4 slots in the machine driver which was the 
default for the Atom/SST driver.

If I look at the cht_bsw_nau8824.c driver, the only place where there is 
a reference to 4 slots is in the cht_codec_init() function.

https://elixir.bootlin.com/linux/latest/source/sound/soc/intel/boards/cht_bsw_nau8824.c#L104

In other drivers, this was moved to the codec_fixup routine which is 
overridden/ignored when SOF is used.

see e.g.

https://elixir.bootlin.com/linux/latest/source/sound/soc/intel/boards/cht_bsw_max98090_ti.c

https://elixir.bootlin.com/linux/latest/source/sound/soc/intel/boards/cht_bsw_rt5645.c

If you follow the same pattern that should make this problem go away. 
When SOF is used we typically don't have any hard-coded format and 
whatever is defined in the topology is propagated to the codec driver.

Hope this helps
-Pierre


More information about the Alsa-devel mailing list