All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: mid-x86: Use the soc-jack apis for jack type detection
@ 2011-02-10  7:28 Koul, Vinod
  2011-02-11  0:02 ` Liam Girdwood
  2011-02-11 11:17 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Koul, Vinod @ 2011-02-10  7:28 UTC (permalink / raw)
  To: alsa-devel; +Cc: Vinod Koul, broonie, Harsha Priya, lrg

From: Vinod Koul <vinod.koul@intel.com>

This patch modifies the mfld_machine to use the new jack apis for adding the
voltage zones for jack type detection. It also modifed TI sn95031 codec driver
to use these new apis

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Harsha Priya <priya.harsha@intel.com>
---
 sound/soc/codecs/sn95031.c       |    4 +---
 sound/soc/mid-x86/mfld_machine.c |   12 ++++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index 4cc0017..d0b7802 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -782,9 +782,7 @@ static int sn95031_get_headset_state(struct snd_soc_jack *mfld_jack)
 {
 	int micbias = sn95031_get_mic_bias(mfld_jack->codec);
 
-	/* Defaulting to HEADSET for now.
-	 * will change after adding soc-jack detection apis */
-	int jack_type = SND_JACK_HEADSET;
+	int jack_type = snd_soc_jack_get_type(mfld_jack, micbias);
 
 	pr_debug("jack type detected = %d\n", jack_type);
 	if (jack_type == SND_JACK_HEADSET)
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c
index 45a0067..96487fb 100644
--- a/sound/soc/mid-x86/mfld_machine.c
+++ b/sound/soc/mid-x86/mfld_machine.c
@@ -74,6 +74,12 @@ static struct snd_soc_jack_pin mfld_jack_pins[] = {
 	},
 };
 
+/* jack detection voltage zones */
+static struct snd_soc_jack_zone mfld_zones[] = {
+	{MFLD_MV_START, MFLD_MV_AM_HS, SND_JACK_HEADPHONE},
+	{MFLD_MV_AM_HS, MFLD_MV_HS, SND_JACK_HEADSET},
+};
+
 /* sound card controls */
 static const char *headset_switch_text[] = {"Earpiece", "Headset"};
 
@@ -264,6 +270,12 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
 		pr_err("adding jack pins failed\n");
 		return ret_val;
 	}
+	ret_val = snd_soc_jack_add_zones(&mfld_jack,
+			ARRAY_SIZE(mfld_zones), mfld_zones);
+	if (ret_val) {
+		pr_err("adding jack zones failed\n");
+		return ret_val;
+	}
 
 	/* we want to check if anything is inserted at boot,
 	 * so send a fake event to codec and it will read adc
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: mid-x86: Use the soc-jack apis for jack type detection
  2011-02-10  7:28 [PATCH] ASoC: mid-x86: Use the soc-jack apis for jack type detection Koul, Vinod
@ 2011-02-11  0:02 ` Liam Girdwood
  2011-02-11 11:17 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Liam Girdwood @ 2011-02-11  0:02 UTC (permalink / raw)
  To: Koul, Vinod; +Cc: Harsha Priya, alsa-devel, broonie

On Thu, 2011-02-10 at 12:58 +0530, Koul, Vinod wrote:
> From: Vinod Koul <vinod.koul@intel.com>
> 
> This patch modifies the mfld_machine to use the new jack apis for adding the
> voltage zones for jack type detection. It also modifed TI sn95031 codec driver
> to use these new apis
> 
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Signed-off-by: Harsha Priya <priya.harsha@intel.com>
> ---

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: mid-x86: Use the soc-jack apis for jack type detection
  2011-02-10  7:28 [PATCH] ASoC: mid-x86: Use the soc-jack apis for jack type detection Koul, Vinod
  2011-02-11  0:02 ` Liam Girdwood
@ 2011-02-11 11:17 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2011-02-11 11:17 UTC (permalink / raw)
  To: Koul, Vinod; +Cc: alsa-devel, Harsha Priya, lrg

On Thu, Feb 10, 2011 at 12:58:01PM +0530, Koul, Vinod wrote:
> From: Vinod Koul <vinod.koul@intel.com>
> 
> This patch modifies the mfld_machine to use the new jack apis for adding the
> voltage zones for jack type detection. It also modifed TI sn95031 codec driver
> to use these new apis

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-11 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-10  7:28 [PATCH] ASoC: mid-x86: Use the soc-jack apis for jack type detection Koul, Vinod
2011-02-11  0:02 ` Liam Girdwood
2011-02-11 11:17 ` Mark Brown

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.