All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Samuel Holland <samuel@sholland.org>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>, Chen-Yu Tsai <wens@csie.org>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Ondrej Jirman <megous@megous.com>,
	alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 18/25] ASoC: sun8i-codec: Automatically set the system sample rate
Date: Mon, 5 Oct 2020 13:58:33 +0200	[thread overview]
Message-ID: <20201005115833.rbs3bujsofkznpik@gilmour.lan> (raw)
In-Reply-To: <20201001021148.15852-19-samuel@sholland.org>

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime@cerno.tech>
To: Samuel Holland <samuel@sholland.org>
Cc: Ondrej Jirman <megous@megous.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>, Chen-Yu Tsai <wens@csie.org>,
	Mark Brown <broonie@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 18/25] ASoC: sun8i-codec: Automatically set the system sample rate
Date: Mon, 5 Oct 2020 13:58:33 +0200	[thread overview]
Message-ID: <20201005115833.rbs3bujsofkznpik@gilmour.lan> (raw)
In-Reply-To: <20201001021148.15852-19-samuel@sholland.org>

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Maxime Ripard <maxime@cerno.tech>
To: Samuel Holland <samuel@sholland.org>
Cc: Ondrej Jirman <megous@megous.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>, Chen-Yu Tsai <wens@csie.org>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 18/25] ASoC: sun8i-codec: Automatically set the system sample rate
Date: Mon, 5 Oct 2020 13:58:33 +0200	[thread overview]
Message-ID: <20201005115833.rbs3bujsofkznpik@gilmour.lan> (raw)
In-Reply-To: <20201001021148.15852-19-samuel@sholland.org>


[-- Attachment #1.1: Type: text/plain, Size: 1743 bytes --]

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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-10-05 11:58 UTC|newest]

Thread overview: 181+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01  2:11 [PATCH 00/25] ASoC: sun8i-codec: support for AIF2 and AIF3 Samuel Holland
2020-10-01  2:11 ` Samuel Holland
2020-10-01  2:11 ` Samuel Holland
2020-10-01  2:11 ` [PATCH 01/25] ASoC: sun8i-codec: Set up clock tree at probe time Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05  9:53   ` Maxime Ripard
2020-10-05  9:53     ` Maxime Ripard
2020-10-05  9:53     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 02/25] ASoC: sun8i-codec: Swap module clock/reset dependencies Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05  9:54   ` Maxime Ripard
2020-10-05  9:54     ` Maxime Ripard
2020-10-05  9:54     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 03/25] ASoC: sun8i-codec: Sort DAPM controls, widgets, and routes Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05  9:54   ` Maxime Ripard
2020-10-05  9:54     ` Maxime Ripard
2020-10-05  9:54     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 04/25] ASoC: sun8i-codec: Consistently name DAPM widgets " Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05  9:57   ` Maxime Ripard
2020-10-05  9:57     ` Maxime Ripard
2020-10-05  9:57     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 05/25] ASoC: sun8i-codec: Correct DAPM widget types Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05  9:57   ` Maxime Ripard
2020-10-05  9:57     ` Maxime Ripard
2020-10-05  9:57     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 06/25] ASoC: sun8i-codec: Fix AIF widget channel references Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 10:00   ` Maxime Ripard
2020-10-05 10:00     ` Maxime Ripard
2020-10-05 10:00     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 07/25] ASoC: sun8i-codec: Enable AIF mono/stereo control Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 10:00   ` Maxime Ripard
2020-10-05 10:00     ` Maxime Ripard
2020-10-05 10:00     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 08/25] ASoC: sun8i-codec: Use snd_soc_dai_get_drvdata Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 10:01   ` Maxime Ripard
2020-10-05 10:01     ` Maxime Ripard
2020-10-05 10:01     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 09/25] ASoC: sun8i-codec: Prepare to extend the DAI driver Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:24   ` Maxime Ripard
2020-10-05 11:24     ` Maxime Ripard
2020-10-05 11:24     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 10/25] ASoC: sun8i-codec: Program format before clock inversion Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:26   ` Maxime Ripard
2020-10-05 11:26     ` Maxime Ripard
2020-10-05 11:26     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 11/25] ASoC: sun8i-codec: Enable all supported clock inversions Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:30   ` Maxime Ripard
2020-10-05 11:30     ` Maxime Ripard
2020-10-05 11:30     ` Maxime Ripard
2020-10-06  4:29     ` Samuel Holland
2020-10-06  4:29       ` Samuel Holland
2020-10-06  4:29       ` Samuel Holland
2020-10-08 12:59       ` Maxime Ripard
2020-10-08 12:59         ` Maxime Ripard
2020-10-08 12:59         ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 12/25] ASoC: sun8i-codec: Program the correct word size Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:30   ` Maxime Ripard
2020-10-05 11:30     ` Maxime Ripard
2020-10-05 11:30     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 13/25] ASoC: sun8i-codec: Round up the LRCK divisor Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:31   ` Maxime Ripard
2020-10-05 11:31     ` Maxime Ripard
2020-10-05 11:31     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 14/25] ASoC: sun8i-codec: Correct the BCLK divisor calculation Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:34   ` Maxime Ripard
2020-10-05 11:34     ` Maxime Ripard
2020-10-05 11:34     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 15/25] ASoC: sun8i-codec: Support the TDM slot binding Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:34   ` Maxime Ripard
2020-10-05 11:34     ` Maxime Ripard
2020-10-05 11:34     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 16/25] ASoC: sun8i-codec: Enforce symmetric DAI parameters Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:39   ` Maxime Ripard
2020-10-05 11:39     ` Maxime Ripard
2020-10-05 11:39     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 17/25] ASoC: sun8i-codec: Enable all supported sample rates Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:39   ` Maxime Ripard
2020-10-05 11:39     ` Maxime Ripard
2020-10-05 11:39     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 18/25] ASoC: sun8i-codec: Automatically set the system sample rate Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:58   ` Maxime Ripard [this message]
2020-10-05 11:58     ` Maxime Ripard
2020-10-05 11:58     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 19/25] ASoC: sun8i-codec: Constrain to compatible sample rates Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 11:59   ` Maxime Ripard
2020-10-05 11:59     ` Maxime Ripard
2020-10-05 11:59     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 20/25] ASoC: sun8i-codec: Protect the clock rate while streams are open Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01 13:27   ` kernel test robot
2020-10-01 13:27     ` kernel test robot
2020-10-01 13:27     ` kernel test robot
2020-10-01 13:27     ` kernel test robot
2020-10-05 12:01   ` Maxime Ripard
2020-10-05 12:01     ` Maxime Ripard
2020-10-05 12:01     ` Maxime Ripard
2020-10-05 13:15     ` Chen-Yu Tsai
2020-10-05 13:15       ` Chen-Yu Tsai
2020-10-05 13:15       ` Chen-Yu Tsai
2020-10-06  4:46       ` Samuel Holland
2020-10-06  4:46         ` Samuel Holland
2020-10-06  4:46         ` Samuel Holland
2020-10-06  4:43     ` Samuel Holland
2020-10-06  4:43       ` Samuel Holland
2020-10-06  4:43       ` Samuel Holland
2020-10-08 13:02       ` Maxime Ripard
2020-10-08 13:02         ` Maxime Ripard
2020-10-08 13:02         ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 21/25] ASoC: sun8i-codec: Require an exact BCLK divisor match Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 12:01   ` Maxime Ripard
2020-10-05 12:01     ` Maxime Ripard
2020-10-05 12:01     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 22/25] ASoC: sun8i-codec: Enable all supported PCM formats Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 12:02   ` Maxime Ripard
2020-10-05 12:02     ` Maxime Ripard
2020-10-05 12:02     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 23/25] ASoC: sun8i-codec: Generalize AIF clock control Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 12:04   ` Maxime Ripard
2020-10-05 12:04     ` Maxime Ripard
2020-10-05 12:04     ` Maxime Ripard
2020-10-06  4:51     ` Samuel Holland
2020-10-06  4:51       ` Samuel Holland
2020-10-06  4:51       ` Samuel Holland
2020-10-12 11:17       ` Maxime Ripard
2020-10-12 11:17         ` Maxime Ripard
2020-10-12 11:17         ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 24/25] ASoC: sun8i-codec: Add a DAI, widgets, and routes for AIF2 Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 12:05   ` Maxime Ripard
2020-10-05 12:05     ` Maxime Ripard
2020-10-05 12:05     ` Maxime Ripard
2020-10-01  2:11 ` [PATCH 25/25] ASoC: sun8i-codec: Add a DAI, widgets, and routes for AIF3 Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-01  2:11   ` Samuel Holland
2020-10-05 17:54 ` [PATCH 00/25] ASoC: sun8i-codec: support for AIF2 and AIF3 Mark Brown
2020-10-05 17:54   ` Mark Brown
2020-10-05 17:54   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201005115833.rbs3bujsofkznpik@gilmour.lan \
    --to=maxime@cerno.tech \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=megous@megous.com \
    --cc=perex@perex.cz \
    --cc=samuel@sholland.org \
    --cc=tiwai@suse.com \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.