[PATCH v2 2/2] ASoC: tegra: Unify ASoC machine drivers

Jon Hunter jonathanh at nvidia.com
Mon May 24 14:22:28 CEST 2021



On 21/05/2021 20:05, Dmitry Osipenko wrote:

...

>>> +unsigned int tegra_asoc_machine_mclk_rate(unsigned int srate)
>>> +{
>>> +	unsigned int mclk;
>>> +
>>> +	switch (srate) {
>>> +	case 64000:
>>> +	case 88200:
>>> +	case 96000:
>>> +		mclk = 128 * srate;
>>> +		break;
>>> +	default:
>>> +		mclk = 256 * srate;
>>> +		break;
>>> +	}
>>> +	/* FIXME: Codec only requires >= 3MHz if OSR==0 */
>>> +	while (mclk < 6000000)
>>> +		mclk *= 2;
>>
>> So this appears to be specific to the wm8903 codec or at least this is
>> where it came from. And given that the switch statement is not complete
>> in terms of the sample rates (ie. only has a subset), I am wondering if
>> set should keep this specific to the wm8903 codec?
> 
> The RT5631 codec of Asus Transformers will re-use this function.

OK, but does it need this FIXME part? That appears to be codec specific.

> IIUC, the default switch-case works properly for all rates below 64KHz,
> at least I haven't had any problems with it. Could you please clarify
> why you are saying that the switch statement appears to be incomplete?

It looks a bit weird because less than 64kHz and greater than 96kHz we
use 256 and for only 64kHz, 88.2kHz and 96kHz we use 128. So it is not
clear to me which sample rates have actually been tested with this and
if this is complete or not?

Is it intended that we use 256 for sample rates greater than 96kHz?

Jon



More information about the Alsa-devel mailing list