[PATCH 1/3] ASoC: WM8903: Add wm8903_set_gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Stephen Warren <swarren@xxxxxxxxxx>

Also, fix platform_data handling to have an explicit "don't touch this pin"
option.

Temporarily hack out the mic detection platform_data handling for simplicity
tesing the GPIO changes. Should the write-sequencer enabling be conditional?

Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
---
 sound/soc/codecs/wm8903.c |   11 ++++++++++-
 sound/soc/codecs/wm8903.h |    3 +++
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index a2a446c..493ae5a 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1635,6 +1635,13 @@ static int wm8903_resume(struct snd_soc_codec *codec)
 	return 0;
 }
 
+void wm8903_set_gpio(struct snd_soc_codec *codec, unsigned gpio, int state)
+{
+	snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + gpio,
+			    WM8903_GP1_LVL_MASK, state << WM8903_GP1_LVL_SHIFT);
+}
+EXPORT_SYMBOL_GPL(wm8903_set_gpio);
+
 static int wm8903_probe(struct snd_soc_codec *codec)
 {
 	struct wm8903_platform_data *pdata = dev_get_platdata(codec->dev);
@@ -1667,13 +1674,14 @@ static int wm8903_probe(struct snd_soc_codec *codec)
 	/* Set up GPIOs and microphone detection */
 	if (pdata) {
 		for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
-			if (!pdata->gpio_cfg[i])
+			if (pdata->gpio_cfg[i] == WM8903_GPIO_NO_CONFIG)
 				continue;
 
 			snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i,
 				      pdata->gpio_cfg[i] & 0xffff);
 		}
 
+#if 0
 		snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0,
 			      pdata->micdet_cfg);
 
@@ -1681,6 +1689,7 @@ static int wm8903_probe(struct snd_soc_codec *codec)
 		if (pdata->micdet_cfg)
 			snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0,
 					    WM8903_WSEQ_ENA, WM8903_WSEQ_ENA);
+#endif
 
 		wm8903->mic_delay = pdata->micdet_delay;
 	}
diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h
index e8490f3..12937ac 100644
--- a/sound/soc/codecs/wm8903.h
+++ b/sound/soc/codecs/wm8903.h
@@ -19,6 +19,9 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec,
 			     struct snd_soc_jack *jack,
 			     int det, int shrt);
 
+extern void wm8903_set_gpio(struct snd_soc_codec *codec,
+			    unsigned gpio, int state);
+
 
 /*
  * Register values.
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux