Re: [PATCH v1 04/10] ASoC: tegra: Support RT5631 by machine driver
From: Mark Brown
Date: Tue Feb 21 2023 - 17:23:21 EST
On Tue, Feb 21, 2023 at 08:32:05PM +0200, Svyatoslav Ryhel wrote:
> Add Realtek ALC5631/RT5631 codec support to the Tegra ASoC machine driver.
> The RT5631 codec is found on devices like ASUS Transformer TF201, TF700T
> and other Tegra-based Android tablets.
>
> Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
> Signed-off-by: Ion Agorria <ion@xxxxxxxxxxx>
Your signoff should be last if you're the one sending this.
> +static unsigned int tegra_machine_mclk_rate_6mhz(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;
It feels like this is complicated enough and looks like the
clocking is flexible enough that it might be easier to just have
a table of values or otherwise enumerate standard rates, seeing
the code I feel like I need to worry about what happens if we
pick a clock rate over 6MHz (the loop could give a value over
that), and it's not clear why we have the switch statement rather
than just starting at a multiple of 128 and looping an extra time.
I suspect there's going to be no meaningful downside for having
the clock held at over 3MHz on a tablet form factor, the usual
issue would be power consumption but between the larger battery
size you tend to have on a tablet and the power draw of the
screen if that's on it's likely to be into the noise practially
speaking.
Attachment:
signature.asc
Description: PGP signature