public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Stephen Warren <swarren@nvidia.com>
Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org,
	lrg@slimlogic.co.uk
Subject: Re: [PATCH 6/6] ASoC: Tegra: Harmony: Support both int and ext mics
Date: Thu, 3 Feb 2011 22:52:35 +0000	[thread overview]
Message-ID: <20110203225235.GD4586@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1296766578-13988-6-git-send-email-swarren@nvidia.com>

On Thu, Feb 03, 2011 at 01:56:18PM -0700, Stephen Warren wrote:

> At present, I'm not sure how best to resolve this. Downstream drivers
> directly tweaked the wm8903's registers so that both ADCs processed the
> same input channel.

The CODEC driver needs to have support for routing the left and right
channels like things like the WM8993 do.

>  	{"IN1L", NULL, "Mic Jack"},
> +	{"IN1R", NULL, "Mic Jack"},

This looks odd - I'd expect to see separate widgets for the internal
microphone rather than using the same widget.  This would greatly
simplify the driver code without really impacting the level of
configuration applications need to do (and allowing them to use both
simultaneously if they want to).

> +static int harmony_set_mic_selection(struct snd_kcontrol *kcontrol,
> +				     struct snd_ctl_elem_value *ucontrol)
> +{
> +	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
> +	struct snd_soc_card *card = codec->card;
> +	struct tegra_harmony *harmony = snd_soc_card_get_drvdata(card);
> +
> +	if (harmony->mic_selection == ucontrol->value.integer.value[0])
> +		return 0;
> +
> +	harmony->mic_selection = ucontrol->value.integer.value[0];
> +	harmony_mic_control(codec);

This should be locking the CODEC mutex while doing the update.

> +static const struct soc_enum harmony_enum[] = {
> +	SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(mic_selection_names),
> +			    mic_selection_names),
>  };

Don't create arrays of enums, declare individual varaibles and reference
them...

> +	SOC_ENUM_EXT("Mic Selection", harmony_enum[0],
> +		     harmony_get_mic_selection, harmony_set_mic_selection),

...as it makes the references to them much easier to follow and less
error prone.

  parent reply	other threads:[~2011-02-03 22:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1296766578-13988-1-git-send-email-swarren@nvidia.com>
     [not found] ` <1296766578-13988-3-git-send-email-swarren@nvidia.com>
     [not found]   ` <1296766578-13988-3-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-02-03 22:38     ` [PATCH 3/6] ASoC: WM8903: Fix mic detection issues Mark Brown
     [not found] ` <1296766578-13988-4-git-send-email-swarren@nvidia.com>
     [not found]   ` <1296766578-13988-4-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-02-03 22:40     ` [PATCH 4/6] ASoC: Tegra: Harmony: Implement mic detection Mark Brown
     [not found] ` <1296766578-13988-6-git-send-email-swarren@nvidia.com>
2011-02-03 22:52   ` Mark Brown [this message]
     [not found]     ` <20110203225235.GD4586-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-02-04 17:20       ` [PATCH 6/6] ASoC: Tegra: Harmony: Support both int and ext mics Stephen Warren
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF0310C8EB68-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-07 11:13           ` [alsa-devel] " Mark Brown
     [not found]             ` <20110207111310.GA31475-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2011-02-08 20:34               ` Stephen Warren
     [not found]                 ` <74CDBE0F657A3D45AFBB94109FB122FF0310F5FFAC-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-08 20:58                   ` Mark Brown
     [not found]                     ` <20110208205848.GA23844-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2011-02-08 23:32                       ` Stephen Warren
     [not found]                         ` <74CDBE0F657A3D45AFBB94109FB122FF0310F60084-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-09 12:15                           ` Mark Brown
     [not found] ` <1296766578-13988-5-git-send-email-swarren@nvidia.com>
     [not found]   ` <1296766578-13988-5-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-02-04 14:46     ` [PATCH 5/6] ASoC: Harmony: Call snd_soc_dapm_nc_pin Mark Brown
     [not found] ` <1296766578-13988-1-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-02-03 22:35   ` [PATCH 1/6] ASoC: Tegra: Harmony: Add headphone jack detection Mark Brown
     [not found]     ` <20110203223530.GA4586-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-02-03 23:25       ` Stephen Warren
2011-02-04 14:47         ` Mark Brown
     [not found]         ` <74CDBE0F657A3D45AFBB94109FB122FF0310C8EA93-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-04 20:32           ` Stephen Warren
     [not found]             ` <74CDBE0F657A3D45AFBB94109FB122FF0310F5FB00-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-08 20:28               ` [alsa-devel] " Stephen Warren
     [not found]                 ` <74CDBE0F657A3D45AFBB94109FB122FF0310F5FFA5-C7FfzLzN0UxDw2glCA4ptUEOCMrvLtNR@public.gmane.org>
2011-02-08 20:59                   ` Mark Brown
     [not found]                     ` <20110208205917.GB23844-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2011-02-08 21:56                       ` Liam Girdwood
2011-02-09 12:11   ` Mark Brown
     [not found] ` <1296766578-13988-2-git-send-email-swarren@nvidia.com>
     [not found]   ` <1296766578-13988-2-git-send-email-swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2011-02-04 14:46     ` [PATCH 2/6] ASoC: Tegra: Harmony: Add switch control for speaker Mark Brown
2011-02-09 12:11     ` [alsa-devel] " 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=20110203225235.GD4586@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=swarren@nvidia.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