From: Neil Armstrong <narmstrong@baylibre.com>
To: Jerome Brunet <jbrunet@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: Fri, 30 Apr 2021 10:31:13 +0200 [thread overview]
Message-ID: <d2e9fc82-1483-e4d0-db10-6c11d9fdbba9@baylibre.com> (raw)
In-Reply-To: <1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com>
On 29/04/2021 19:43, Jerome Brunet wrote:
>
> 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
>
>
Sure, will do
WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Jerome Brunet <jbrunet@baylibre.com>, broonie@kernel.org
Cc: linux-amlogic@lists.infradead.org, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] ASoC: meson: g12a-toacodec: add support for SM1 TOACODEC
Date: Fri, 30 Apr 2021 10:31:13 +0200 [thread overview]
Message-ID: <d2e9fc82-1483-e4d0-db10-6c11d9fdbba9@baylibre.com> (raw)
In-Reply-To: <1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com>
On 29/04/2021 19:43, Jerome Brunet wrote:
>
> 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
>
>
Sure, will do
WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Jerome Brunet <jbrunet@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: Fri, 30 Apr 2021 10:31:13 +0200 [thread overview]
Message-ID: <d2e9fc82-1483-e4d0-db10-6c11d9fdbba9@baylibre.com> (raw)
In-Reply-To: <1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com>
On 29/04/2021 19:43, Jerome Brunet wrote:
>
> 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
>
>
Sure, will do
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Neil Armstrong <narmstrong@baylibre.com>
To: Jerome Brunet <jbrunet@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: Fri, 30 Apr 2021 10:31:13 +0200 [thread overview]
Message-ID: <d2e9fc82-1483-e4d0-db10-6c11d9fdbba9@baylibre.com> (raw)
In-Reply-To: <1jo8dx9ec5.fsf@starbuckisacylon.baylibre.com>
On 29/04/2021 19:43, Jerome Brunet wrote:
>
> 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
>
>
Sure, will do
_______________________________________________
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-30 8:31 UTC|newest]
Thread overview: 16+ 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:01 ` Neil Armstrong
2021-04-29 17:01 ` Neil Armstrong
2021-04-29 17:01 ` Neil Armstrong
2021-04-29 17:43 ` Jerome Brunet
2021-04-29 17:43 ` Jerome Brunet
2021-04-29 17:43 ` Jerome Brunet
2021-04-29 17:43 ` Jerome Brunet
2021-04-30 8:31 ` Neil Armstrong [this message]
2021-04-30 8:31 ` Neil Armstrong
2021-04-30 8:31 ` Neil Armstrong
2021-04-30 8:31 ` Neil Armstrong
2021-05-19 16:10 ` Mark Brown
2021-05-19 16:10 ` Mark Brown
2021-05-19 16:10 ` Mark Brown
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=d2e9fc82-1483-e4d0-db10-6c11d9fdbba9@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jbrunet@baylibre.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.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.