[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com>
Date: Thu, 29 Apr 2021 19:43:06 +0200
From: Jerome Brunet <jbrunet@...libre.com>
To: Neil Armstrong <narmstrong@...libre.com>, broonie@...nel.org
Cc: alsa-devel@...a-project.org, linux-amlogic@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC
On Thu 29 Apr 2021 at 19:01, Neil Armstrong <narmstrong@...libre.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
Powered by blists - more mailing lists