From: Samuel Holland <samuel@sholland.org>
To: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: Ondrej Jirman <megous@megous.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 17/17] ASoC: sun8i-codec: Add the AIF3 DAI, widgets, and routes
Date: Wed, 14 Oct 2020 22:24:36 -0500 [thread overview]
Message-ID: <d2d57d02-206e-534b-ca35-afc27e921596@sholland.org> (raw)
In-Reply-To: <20201014061941.4306-18-samuel@sholland.org>
On 10/14/20 1:19 AM, Samuel Holland wrote:
> AIF3 has some differences from AIF1 and AIF2:
> - It supports one channel only
> - It supports master mode only
> - It is not directly connected to any of the mixers; instead all audio
> goes through a mux with AIF2.
> - It does not have its own clock dividers; instead it reuses AIF2 BCLK
> and LRCK. This means that when both AIF2 and AIF3 are active, they
> must use the same sample rate and total frame width. Since AIF2 and
> AIF3 are only used for codec2codec DAI links, constraints are not
> applicable here; the only thing we can do when the rates don't match
> is report an error.
>
> Make the necessary adjustments to support this AIF.
>
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> sound/soc/sunxi/sun8i-codec.c | 138 ++++++++++++++++++++++++++++++++--
> 1 file changed, 130 insertions(+), 8 deletions(-)
>
> diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
> index 6a8232e07983..180442c62be1 100644
> --- a/sound/soc/sunxi/sun8i-codec.c
> +++ b/sound/soc/sunxi/sun8i-codec.c
[snip]
> @@ -263,19 +273,30 @@ static int sun8i_codec_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
> break;
> case SND_SOC_DAIFMT_CBM_CFM: /* Codec Master, DAI slave */
> value = 0x0;
> break;
> default:
> return -EINVAL;
> }
>
> - regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id),
> - BIT(SUN8I_AIF_CLK_CTRL_MSTR_MOD),
> - value << SUN8I_AIF_CLK_CTRL_MSTR_MOD);
> + if (dai->id == SUN8I_CODEC_AIF3) {
> + /* AIF3 only supports master mode. */
> + if (value)
> + return -EINVAL;
> +
> + /* Use the AIF2 BCLK and LRCK for AIF3. */
> + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id),
> + SUN8I_AIF3_CLK_CTRL_AIF3_CLK_SRC_MASK,
> + SUN8I_AIF3_CLK_CTRL_AIF3_CLK_SRC_AIF2);
Since the AIF3 clock source is set to AIF2 here...
> + } else {
> + regmap_update_bits(scodec->regmap, SUN8I_AIF_CLK_CTRL(dai->id),
> + BIT(SUN8I_AIF_CLK_CTRL_MSTR_MOD),
> + value << SUN8I_AIF_CLK_CTRL_MSTR_MOD);
> + }
>
> /* DAI format */
> switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
> case SND_SOC_DAIFMT_I2S:
> format = 0x0;
> break;
> case SND_SOC_DAIFMT_LEFT_J:
> format = 0x1;
[snip]
> @@ -908,16 +1016,22 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
> { "CLK AIF2", NULL, "AIF2CLK" },
> { "CLK AIF2", NULL, "SYSCLK" },
> { "RST AIF2", NULL, "CLK AIF2" },
> { "AIF2 ADCL", NULL, "RST AIF2" },
> { "AIF2 ADCR", NULL, "RST AIF2" },
> { "AIF2 DACL", NULL, "RST AIF2" },
> { "AIF2 DACR", NULL, "RST AIF2" },
>
> + { "CLK AIF3", NULL, "AIF1CLK" },
^^^^^^^
...this should be "AIF2CLK". I will fix it in the next version.
> + { "CLK AIF3", NULL, "SYSCLK" },
> + { "RST AIF3", NULL, "CLK AIF3" },
> + { "AIF3 ADC", NULL, "RST AIF3" },
> + { "AIF3 DAC", NULL, "RST AIF3" },
> +
> { "CLK ADC", NULL, "SYSCLK" },
> { "RST ADC", NULL, "CLK ADC" },
> { "ADC", NULL, "RST ADC" },
> { "ADCL", NULL, "ADC" },
> { "ADCR", NULL, "ADC" },
>
> { "CLK DAC", NULL, "SYSCLK" },
> { "RST DAC", NULL, "CLK DAC" },
next prev parent reply other threads:[~2020-10-15 3:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 6:19 [PATCH v2 00/17] ASoC: sun8i-codec: support for AIF2 and AIF3 Samuel Holland
2020-10-14 6:19 ` [PATCH v2 01/17] ASoC: sun8i-codec: Prepare to extend the DAI driver Samuel Holland
2020-10-14 6:19 ` [PATCH v2 02/17] ASoC: sun8i-codec: Program DAI format before clock inversion Samuel Holland
2020-10-14 6:19 ` [PATCH v2 03/17] ASoC: sun8i-codec: Enable all supported clock inversions Samuel Holland
2020-10-19 8:24 ` Maxime Ripard
2020-10-14 6:19 ` [PATCH v2 04/17] ASoC: sun8i-codec: Use the provided word size Samuel Holland
2020-10-14 6:19 ` [PATCH v2 05/17] ASoC: sun8i-codec: Round up the LRCK divisor Samuel Holland
2020-10-14 6:19 ` [PATCH v2 06/17] ASoC: sun8i-codec: Correct the BCLK divisor calculation Samuel Holland
2020-10-14 6:19 ` [PATCH v2 07/17] ASoC: sun8i-codec: Support the TDM slot binding Samuel Holland
2020-10-14 6:19 ` [PATCH v2 08/17] ASoC: sun8i-codec: Enforce symmetric DAI parameters Samuel Holland
2020-10-14 6:19 ` [PATCH v2 09/17] ASoC: sun8i-codec: Enable all supported sample rates Samuel Holland
2020-10-14 6:19 ` [PATCH v2 10/17] ASoC: sun8i-codec: Automatically set the system sample rate Samuel Holland
2020-10-19 8:25 ` Maxime Ripard
2020-10-14 6:19 ` [PATCH v2 11/17] ASoC: sun8i-codec: Constrain to compatible sample rates Samuel Holland
2020-10-14 6:19 ` [PATCH v2 12/17] ASoC: sun8i-codec: Protect the clock rate while streams are open Samuel Holland
2020-10-19 8:28 ` Maxime Ripard
2020-10-14 6:19 ` [PATCH v2 13/17] ASoC: sun8i-codec: Require an exact BCLK divisor match Samuel Holland
2020-10-14 6:19 ` [PATCH v2 14/17] ASoC: sun8i-codec: Enable all supported PCM formats Samuel Holland
2020-10-14 6:19 ` [PATCH v2 15/17] ASoC: sun8i-codec: Generalize AIF clock control Samuel Holland
2020-10-19 8:56 ` Maxime Ripard
2020-10-14 6:19 ` [PATCH v2 16/17] ASoC: sun8i-codec: Add the AIF2 DAI, widgets, and routes Samuel Holland
2020-10-14 6:19 ` [PATCH v2 17/17] ASoC: sun8i-codec: Add the AIF3 " Samuel Holland
2020-10-15 3:24 ` Samuel Holland [this message]
2020-10-26 23:46 ` [PATCH v2 00/17] ASoC: sun8i-codec: support for AIF2 and AIF3 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=d2d57d02-206e-534b-ca35-afc27e921596@sholland.org \
--to=samuel@sholland.org \
--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=mripard@kernel.org \
--cc=perex@perex.cz \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).