lkml.org 
[lkml]   [2020]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 18/25] ASoC: sun8i-codec: Automatically set the system sample rate
On Wed, Sep 30, 2020 at 09:11:41PM -0500, Samuel Holland wrote:
> The sun8i codec has three clock/sample rate domains:
> - The AIF1 domain, with a sample rate equal to AIF1 LRCK
> - The AIF2 domain, with a sample rate equal to AIF2 LRCK
> - The SYSCLK domain, containing the ADC, DAC, and effects (AGC/DRC),
> with a sample rate given by a divisor from SYSCLK. The divisor is
> controlled by the AIF1_FS or AIF2_FS field in SYS_SR_CTRL, depending
> on if SYSCLK's source is AIF1CLK or AIF2CLK, respectively. The exact
> sample rate depends on if SYSCLK is running at 22.6 MHz or 24.6 MHz.
>
> When an AIF (currently only AIF1) is active, the ADC and DAC should run
> at that sample rate to avoid artifacting. Sample rate conversion is only
> available when multiple AIFs are active and are routed to each other;
> this means the sample rate conversion hardware usually cannot be used.
>
> Only attach the event hook to the channel 0 AIF widgets, since we only
> need one event when a DAI stream starts or stops. Channel 0 is always
> brought up with a DAI stream, regardless of the number of channels in
> the stream.
>
> The ADC and DAC (along with their effects blocks) can be used even if
> no AIFs are in use. In that case, we should select an appropriate sample
> rate divisor, instead of keeping the last-used AIF sample rate.
> 44.1/48 kHz was chosen to balance audio quality and power consumption.
>
> Since the sample rate is tied to active AIF paths, disabling pmdown_time
> allows switching to the optimal sample rate immediately, instead of
> after a 5 second delay.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>

Acked-by: Maxime Ripard <mripard@kernel.org>

Maxime
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-10-05 13:59    [W:0.342 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site