From: Sascha Hauer <s.hauer@pengutronix.de>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 5/6] ASoC: ak4642: Implement Microphone in pathes
Date: Thu, 15 May 2014 14:27:59 +0200 [thread overview]
Message-ID: <20140515122759.GG5858@pengutronix.de> (raw)
In-Reply-To: <1400053058-1115-6-git-send-email-s.hauer@pengutronix.de>
On Wed, May 14, 2014 at 09:37:37AM +0200, Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> sound/soc/codecs/ak4642.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 114 insertions(+)
I'll rework this patch. I just realized that it is only valid for the
ak4648. The ak4642 does not have that many microphone in sources.
Sasca
>
> diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
> index 3ba4c0f..6292a6a 100644
> --- a/sound/soc/codecs/ak4642.c
> +++ b/sound/soc/codecs/ak4642.c
> @@ -153,6 +153,81 @@ struct ak4642_priv {
> */
> static const DECLARE_TLV_DB_SCALE(out_tlv, -11550, 50, 1);
>
> +static const char * const ak4642_micl_strings[] = { "LIN1", "LIN2", "LIN3", "LIN4" };
> +static const char * const ak4642_micr_strings[] = { "RIN1", "RIN2", "RIN3", "RIN4" };
> +
> +static const struct soc_enum ak4642_micl_enum =
> + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(ak4642_micl_strings),
> + ak4642_micl_strings);
> +
> +static const struct soc_enum ak4642_micr_enum =
> + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(ak4642_micr_strings),
> + ak4642_micr_strings);
> +
> +static int ak4642_micl_enum_get(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
> + u32 val, inl;
> +
> + val = snd_soc_read(codec, PW_MGMT3);
> +
> + inl = (val >> 1) & 0x1;
> + inl |= (val >> 5) & 0x2;
> +
> + ucontrol->value.integer.value[0] = inl;
> +
> + return 0;
> +}
> +
> +static int ak4642_micl_enum_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
> + int val, inl;
> +
> + val = ucontrol->value.integer.value[0];
> +
> + inl = (val & 0x1) << 1;
> + inl |= (val & 0x2) << 5;
> +
> + snd_soc_update_bits(codec, PW_MGMT3, (1 << 1) | (1 << 6), inl);
> +
> + return 1;
> +}
> +
> +static int ak4642_micr_enum_get(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
> + u32 val, inr;
> +
> + val = snd_soc_read(codec, PW_MGMT3);
> +
> + inr = (val >> 2) & 0x1;
> + inr |= (val >> 6) & 0x2;
> +
> + ucontrol->value.integer.value[0] = inr;
> +
> + return 0;
> +}
> +
> +static int ak4642_micr_enum_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol);
> + int val, inr;
> +
> + val = ucontrol->value.integer.value[0];
> +
> + inr = (val & 0x1) << 2;
> + inr |= (val & 0x2) << 6;
> +
> + snd_soc_update_bits(codec, PW_MGMT3, (1 << 2) | (1 << 7), inr);
> +
> + return 1;
> +}
> +
> static const struct snd_kcontrol_new ak4642_snd_controls[] = {
>
> SOC_DOUBLE_R_TLV("Digital Playback Volume", L_DVC, R_DVC,
> @@ -168,6 +243,16 @@ static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] = {
> SOC_DAPM_SINGLE("DACL", SG_SL1, 4, 1, 0),
> };
>
> +static const struct snd_kcontrol_new ak4642_micl_controls[] = {
> + SOC_ENUM_EXT("Mic Left Capture Route", ak4642_micl_enum,
> + ak4642_micl_enum_get, ak4642_micl_enum_put),
> +};
> +
> +static const struct snd_kcontrol_new ak4642_micr_controls[] = {
> + SOC_ENUM_EXT("Mic Right Capture Route", ak4642_micr_enum,
> + ak4642_micr_enum_get, ak4642_micr_enum_put),
> +};
> +
> static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = {
>
> /* Outputs */
> @@ -188,6 +273,22 @@ static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = {
>
> /* DAC */
> SND_SOC_DAPM_DAC("DAC", "HiFi Playback", PW_MGMT1, 2, 0),
> +
> + SND_SOC_DAPM_ADC("ADC", "Capture", SND_SOC_NOPM, 0, 0),
> +
> + SND_SOC_DAPM_MUX("Mic Left Capture Route",
> + SND_SOC_NOPM, 0, 0, ak4642_micl_controls),
> + SND_SOC_DAPM_MUX("Mic Right Capture Route",
> + SND_SOC_NOPM, 0, 0, ak4642_micr_controls),
> +
> + SND_SOC_DAPM_INPUT("LIN1"),
> + SND_SOC_DAPM_INPUT("LIN2"),
> + SND_SOC_DAPM_INPUT("LIN3"),
> + SND_SOC_DAPM_INPUT("LIN4"),
> + SND_SOC_DAPM_INPUT("RIN1"),
> + SND_SOC_DAPM_INPUT("RIN2"),
> + SND_SOC_DAPM_INPUT("RIN3"),
> + SND_SOC_DAPM_INPUT("RIN4"),
> };
>
> static const struct snd_soc_dapm_route ak4642_intercon[] = {
> @@ -205,6 +306,19 @@ static const struct snd_soc_dapm_route ak4642_intercon[] = {
> {"DACH", NULL, "DAC"},
>
> {"LINEOUT Mixer", "DACL", "DAC"},
> +
> + {"Mic Left Capture Route", "LIN1", "LIN1"},
> + {"Mic Left Capture Route", NULL, "LIN2"},
> + {"Mic Left Capture Route", NULL, "LIN3"},
> + {"Mic Left Capture Route", NULL, "LIN4"},
> +
> + {"Mic Right Capture Route", "RIN1", "RIN1"},
> + {"Mic Right Capture Route", NULL, "RIN2"},
> + {"Mic Right Capture Route", NULL, "RIN3"},
> + {"Mic Right Capture Route", NULL, "RIN4"},
> +
> + {"ADC", NULL, "Mic Right Capture Route"},
> + {"ADC", NULL, "Mic Left Capture Route"},
> };
>
> /*
> --
> 2.0.0.rc0
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2014-05-15 12:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-14 7:37 [PATCH] ak4642 codec updates Sascha Hauer
2014-05-14 7:37 ` [PATCH 1/6] ASoC: ak4642: Fix typo zoro -> zero Sascha Hauer
2014-05-14 11:32 ` Mark Brown
2014-05-14 7:37 ` [PATCH 2/6] ASoC: ak4642: Add ALC controls Sascha Hauer
2014-05-14 11:32 ` Mark Brown
2014-05-14 7:37 ` [PATCH 3/6] ASoC: ak4642: Add driver data and driver private struct Sascha Hauer
2014-05-14 11:33 ` Mark Brown
2014-05-14 7:37 ` [PATCH 4/6] ASoC: ak4642: Add support for extended sysclk frequencies of the ak4648 Sascha Hauer
2014-05-14 11:34 ` Mark Brown
2014-05-14 7:37 ` [PATCH 5/6] ASoC: ak4642: Implement Microphone in pathes Sascha Hauer
2014-05-15 12:27 ` Sascha Hauer [this message]
2014-05-14 7:37 ` [PATCH 6/6] ASoC: ak4642: Add enable gpio support Sascha Hauer
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=20140515122759.GG5858@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox