[PATCH] ASoC: codes: Add support for ES8316 producer mode

Pierre-Louis Bossart pierre-louis.bossart at linux.intel.com
Fri Jul 1 15:44:24 CEST 2022


>  	/* Validate supported sample rates that are autodetected from MCLK */
> @@ -477,19 +478,24 @@ static int es8316_pcm_hw_params(struct snd_pcm_substream *substream,
>  	}
>  	if (i == NR_SUPPORTED_MCLK_LRCK_RATIOS)
>  		return -EINVAL;
> -
> +	lrck_divider = es8316->sysclk/params_rate(params);
> +	bclk_divider = lrck_divider/4;
>  	switch (params_format(params)) {
>  	case SNDRV_PCM_FORMAT_S16_LE:
>  		wordlen = ES8316_SERDATA2_LEN_16;
> +		bclk_divider/=16;
>  		break;
>  	case SNDRV_PCM_FORMAT_S20_3LE:
>  		wordlen = ES8316_SERDATA2_LEN_20;
> +		bclk_divider/=32;

S20_3LE uses 3 bytes, is the 32 divider correct here?

>  		break;
>  	case SNDRV_PCM_FORMAT_S24_LE:
>  		wordlen = ES8316_SERDATA2_LEN_24;
> +		bclk_divider/=24;>  		break;
>  	case SNDRV_PCM_FORMAT_S32_LE:
>  		wordlen = ES8316_SERDATA2_LEN_32;
> +		bclk_divider/=32;
>  		break;
>  	default:
>  		return -EINVAL;


More information about the Alsa-devel mailing list