[alsa-devel] [RFC] ASoC: wm892: Set an initial non-mute volume for the headphones

Fabio Estevam festevam at gmail.com
Fri Jul 19 02:47:18 CEST 2013


From: Fabio Estevam <fabio.estevam at freescale.com>

By default the headphone left/right registers have a volume of zero.

Instead of having to change the volume via alsamixer in order to be able to hear
something, let's set an initial value of -20dB, so that audio playback can be 
heard by default.

Tested on a mx6qsabresd board.

Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
---
Mark,

I posted it as RFC as I don't know if this is a valid approach.
Suggestions are welcome.

Thanks

 sound/soc/codecs/wm8962.c | 6 ++++++
 sound/soc/codecs/wm8962.h | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index e2de9ec..6a5066c 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3448,6 +3448,12 @@ static int wm8962_probe(struct snd_soc_codec *codec)
 				    WM8962_MICBIAS_LVL,
 				    pdata->mic_cfg);
 
+	/* set an initial volume for playback of -20 dB */
+	snd_soc_update_bits(codec, WM8962_HPOUTL_VOLUME,
+			    WM8962_HPOUTL_VOL_MASK, WM8962_HPOUTx_MINUS_20_DB);
+	snd_soc_update_bits(codec, WM8962_HPOUTR_VOLUME,
+			    WM8962_HPOUTR_VOL_MASK, WM8962_HPOUTx_MINUS_20_DB);
+
 	/* Latch volume update bits */
 	snd_soc_update_bits(codec, WM8962_LEFT_INPUT_VOLUME,
 			    WM8962_IN_VU, WM8962_IN_VU);
diff --git a/sound/soc/codecs/wm8962.h b/sound/soc/codecs/wm8962.h
index a1a5d52..5dbe972 100644
--- a/sound/soc/codecs/wm8962.h
+++ b/sound/soc/codecs/wm8962.h
@@ -27,6 +27,8 @@
 #define WM8962_FLL_OSC  3
 #define WM8962_FLL_INT  4
 
+#define WM8962_HPOUTx_MINUS_20_DB		0x65
+
 /*
  * Register values.
  */
-- 
1.8.1.2



More information about the Alsa-devel mailing list