From: Jerome Brunet <jbrunet@baylibre.com>
To: Neil Armstrong <narmstrong@baylibre.com>, broonie@kernel.org
Cc: alsa-devel@alsa-project.org, linux-amlogic@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC
Date: Thu, 29 Apr 2021 19:43:06 +0200 [thread overview]
Message-ID: <1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <20210429170147.3615883-1-narmstrong@baylibre.com>
On Thu 29 Apr 2021 at 19:01, Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> +static int sm1_toacodec_mux_put_enum(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_component *component =
> + snd_soc_dapm_kcontrol_component(kcontrol);
> + struct snd_soc_dapm_context *dapm =
> + snd_soc_dapm_kcontrol_dapm(kcontrol);
> + struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
> + unsigned int mux, changed;
> +
> + mux = snd_soc_enum_item_to_val(e, ucontrol->value.enumerated.item[0]);
> + changed = snd_soc_component_test_bits(component, e->reg,
> + CTRL0_DAT_SEL_SM1,
> + FIELD_PREP(CTRL0_DAT_SEL_SM1, mux));
> +
> + if (!changed)
> + return 0;
> +
> + /* Force disconnect of the mux while updating */
> + snd_soc_dapm_mux_update_power(dapm, kcontrol, 0, NULL, NULL);
> +
> + snd_soc_component_update_bits(component, e->reg,
> + CTRL0_DAT_SEL_SM1 |
> + CTRL0_LRCLK_SEL_SM1 |
> + CTRL0_BCLK_SEL_SM1,
> + FIELD_PREP(CTRL0_DAT_SEL_SM1, mux) |
> + FIELD_PREP(CTRL0_LRCLK_SEL_SM1, mux) |
> + FIELD_PREP(CTRL0_BCLK_SEL_SM1, mux));
> +
> + /*
> + * FIXME:
> + * On this soc, the glue gets the MCLK directly from the clock
> + * controller instead of going the through the TDM interface.
> + *
> + * Here we assume interface A uses clock A, etc ... While it is
> + * true for now, it could be different. Instead the glue should
> + * find out the clock used by the interface and select the same
> + * source. For that, we will need regmap backed clock mux which
> + * is a work in progress
> + */
> + snd_soc_component_update_bits(component, e->reg,
> + CTRL0_MCLK_SEL,
> + FIELD_PREP(CTRL0_MCLK_SEL, mux));
> +
> + snd_soc_dapm_mux_update_power(dapm, kcontrol, mux, e, NULL);
> +
> + return 0;
> +}
Instead of duplicating this function, I'd prefer if you could use regmap fields
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2021-04-29 17:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 17:01 [PATCH] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC Neil Armstrong
2021-04-29 17:43 ` Jerome Brunet [this message]
2021-04-30 8:31 ` Neil Armstrong
2021-05-19 16:10 ` 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=1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.com \
/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