[PATCH] ASoC: Intel: Boards: cml_da7219_max98390: set TDM format configuration

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Thu Apr 15 13:19:12 CEST 2021



On 4/15/21 1:59 AM, mac.chiang at intel.com wrote:
> From: Mac Chiang <mac.chiang at intel.com>
> 
> add tx/rx 2 channels, 32bits support

If this is on CML, how would the 32 bits work?

you would be trying to generate a 48000*32*2=3072000Hz bit clock.

The base clock is 24 MHz, that's not an integer division.

I see you've used the same 32-bit value in the topology but I really 
don't get how this might work. Please tell me you are not using the M/N 
dividers, or if you do that you understand the impact the non-regular 
duty cycle will have on audio quality.


> Signed-off-by: Steve Lee <SteveS.Lee at maximintegrated.com>
> Signed-off-by: Mac Chiang <mac.chiang at intel.com>
> ---
>   sound/soc/intel/boards/bxt_da7219_max98357a.c | 25 +++++++++++++++++++++++++
>   1 file changed, 25 insertions(+)
> 
> diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c
> index 9ffef39..515379cd 100644
> --- a/sound/soc/intel/boards/bxt_da7219_max98357a.c
> +++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c
> @@ -253,6 +253,30 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
>   	return ret;
>   }
>   
> +static int max98390_hw_params(struct snd_pcm_substream *substream,
> +				struct snd_pcm_hw_params *params)
> +{
> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> +	struct snd_soc_dai *codec_dai;
> +	int j;
> +
> +	for_each_rtd_codec_dais(rtd, j, codec_dai) {
> +		if (!strcmp(codec_dai->component->name, MAX98390_DEV0_NAME)) {
> +			/* DEV0 tdm slot configuration */
> +			snd_soc_dai_set_tdm_slot(codec_dai, 0x1, 3, 2, 32);
> +		}
> +		if (!strcmp(codec_dai->component->name, MAX98390_DEV1_NAME)) {
> +			/* DEV1 tdm slot configuration */
> +			snd_soc_dai_set_tdm_slot(codec_dai, 0x2, 3, 2, 32);
> +		}
> +	}
> +	return 0;
> +}
> +
> +struct snd_soc_ops max_98390_ops = {
> +	.hw_params = max98390_hw_params,
> +};
> +
>   static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
>   {
>   	struct bxt_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
> @@ -813,6 +837,7 @@ static int broxton_audio_probe(struct platform_device *pdev)
>   				if (ctx->spkamp == SPKAMP_MAX98390) {
>   					broxton_dais[i].codecs = max98390_codec;
>   					broxton_dais[i].num_codecs = ARRAY_SIZE(max98390_codec);
> +					broxton_dais[i].ops = &max_98390_ops;
>   					broxton_dais[i].dpcm_capture = 1;
>   				}
>   			}
> 


More information about the Alsa-devel mailing list