All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi@samsung.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
	patches@opensource.wolfsonmicro.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] extcon: arizona: Use regulated mode for microphone supply when detecting
Date: Thu, 24 Jan 2013 09:59:59 +0900	[thread overview]
Message-ID: <5100878F.1010500@samsung.com> (raw)
In-Reply-To: <1358957029-5421-5-git-send-email-broonie@opensource.wolfsonmicro.com>

On 01/24/2013 01:03 AM, Mark Brown wrote:
> When starting microphone detection some headsets should be exposed to
> the fully regulated microphone bias in order to ensure that they behave
> in an optimal fashion.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/extcon/extcon-arizona.c |   62 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c
> index d7e1047..3aacacc 100644
> --- a/drivers/extcon/extcon-arizona.c
> +++ b/drivers/extcon/extcon-arizona.c
> @@ -27,6 +27,8 @@
>  #include <linux/regulator/consumer.h>
>  #include <linux/extcon.h>
>  
> +#include <sound/soc.h>
> +
>  #include <linux/mfd/arizona/core.h>
>  #include <linux/mfd/arizona/pdata.h>
>  #include <linux/mfd/arizona/registers.h>
> @@ -113,6 +115,40 @@ static void arizona_extcon_set_mode(struct arizona_extcon_info *info, int mode)
>  	dev_dbg(arizona->dev, "Set jack polarity to %d\n", mode);
>  }
>  
> +static void arizona_extcon_pulse_micbias(struct arizona_extcon_info *info)
> +{
> +	struct arizona *arizona = info->arizona;
> +	const char *widget;
> +	int ret;
> +
> +	if (arizona->dapm) {
> +		switch (info->micd_modes[0].bias) {
> +		case 1:
> +			widget = "MICBIAS1";
> +			break;
> +		case 2:
> +			widget = "MICBIAS2";
> +			break;
> +		case 3:
> +			widget = "MICBIAS3";
> +			break;
> +		default:
> +			widget = "MICVDD";
> +			break;
> +		}
> +
> +		ret = snd_soc_dapm_force_enable_pin(arizona->dapm, widget);
> +		if (ret != 0)
> +			dev_warn(arizona->dev, "Failed to enable %s: %d\n",
> +				 widget, ret);
> +
> +		ret = snd_soc_dapm_disable_pin(arizona->dapm, widget);
> +		if (ret != 0)
> +			dev_warn(arizona->dev, "Failed to disable %s: %d\n",
> +				 widget, ret);
> +	}
> +}
> +
>  static void arizona_start_mic(struct arizona_extcon_info *info)
>  {
>  	struct arizona *arizona = info->arizona;
> @@ -122,6 +158,15 @@ static void arizona_start_mic(struct arizona_extcon_info *info)
>  	/* Microphone detection can't use idle mode */
>  	pm_runtime_get(info->dev);
>  
> +	if (info->detecting) {
> +		ret = regulator_allow_bypass(info->micvdd, false);
> +		if (ret != 0) {
> +			dev_err(arizona->dev,
> +				"Failed to regulate MICVDD: %d\n",
> +				ret);
> +		}
> +	}
> +
>  	ret = regulator_enable(info->micvdd);
>  	if (ret != 0) {
>  		dev_err(arizona->dev, "Failed to enable MICVDD: %d\n",
> @@ -151,6 +196,7 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
>  {
>  	struct arizona *arizona = info->arizona;
>  	bool change;
> +	int ret;
>  
>  	regmap_update_bits_check(arizona->regmap, ARIZONA_MIC_DETECT_1,
>  				 ARIZONA_MICD_ENA, 0,
> @@ -162,6 +208,12 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
>  		regmap_write(arizona->regmap, 0x80, 0x0);
>  	}
>  
> +	ret = regulator_allow_bypass(info->micvdd, true);
> +	if (ret != 0) {
> +		dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n",
> +			ret);
> +	}
> +
>  	if (change) {
>  		regulator_disable(info->micvdd);
>  		pm_runtime_mark_last_busy(info->dev);
> @@ -564,6 +616,8 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info)
>  
>  	info->hpdet_active = true;
>  
> +	arizona_extcon_pulse_micbias(info);
> +
>  	ret = regmap_update_bits(arizona->regmap, 0x225, 0x4000, 0x4000);
>  	if (ret != 0)
>  		dev_warn(arizona->dev, "Failed to do magic: %d\n", ret);
> @@ -649,6 +703,13 @@ static irqreturn_t arizona_micdet(int irq, void *data)
>  			dev_err(arizona->dev, "Headset report failed: %d\n",
>  				ret);
>  
> +		/* Don't need to regulate for button detection */
> +		ret = regulator_allow_bypass(info->micvdd, false);
> +		if (ret != 0) {
> +			dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n",
> +				ret);
> +		}
> +
>  		info->mic = true;
>  		info->detecting = false;
>  		goto handled;
> @@ -716,6 +777,7 @@ static irqreturn_t arizona_micdet(int irq, void *data)
>  			input_report_key(info->input,
>  					 arizona_lvl_to_key[i].report, 0);
>  		input_sync(info->input);
> +		arizona_extcon_pulse_micbias(info);
>  	}
>  
>  handled:

This patch happen build error related to soc-dapm. You should add 'CONFIG_SND_SOC'
dependency to drivers/extcon/Kconfig for extcon-arizona driver.

drivers/built-in.o: In function `arizona_extcon_pulse_micbias':
/home/cwchoi00/kernel/git.kernel.org/extcon/drivers/extcon/extcon-arizona.c:140: undefined reference
to `snd_soc_dapm_force_enable_pin'
/home/cwchoi00/kernel/git.kernel.org/extcon/drivers/extcon/extcon-arizona.c:145: undefined reference
to `snd_soc_dapm_disable_pin'
/home/cwchoi00/kernel/git.kernel.org/extcon/drivers/extcon/extcon-arizona.c:145: undefined reference
to `snd_soc_dapm_disable_pin'

Thanks,
Chanwoo Choi


  reply	other threads:[~2013-01-24  0:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-23 16:03 [PATCH 1/5] extcon: arizona: Disable debouce for accessory removal detection Mark Brown
2013-01-23 16:03 ` [PATCH 2/5] extcon: arizona: Retry failed HP measurements Mark Brown
2013-01-23 16:03 ` [PATCH 3/5] extcon: arizona: Remove duplicate rate configuration Mark Brown
2013-01-23 16:03 ` [PATCH 4/5] extcon: arizona: Support additional configuration of microphone detection Mark Brown
2013-01-23 16:03 ` [PATCH 5/5] extcon: arizona: Use regulated mode for microphone supply when detecting Mark Brown
2013-01-24  0:59   ` Chanwoo Choi [this message]
2013-01-24  1:10 ` [PATCH 1/5] extcon: arizona: Disable debouce for accessory removal detection Chanwoo Choi

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=5100878F.1010500@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=patches@opensource.wolfsonmicro.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 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.