Skip to contentSkip to conversation

ASoC: wm892: Set an initial non-mute volume for the headphones

RFC In review Fabio Estevam 2 participants 2 messages Jul 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 ASoC: wm892: Set an initial non-mute volume for the headphones

From: Fabio Estevam <[email protected]>

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.

---
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(+)
sound/soc/codecs/wm8962.c +6 -0
index e2de9ec..6a5066c 100644
@@ -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);
sound/soc/codecs/wm8962.h +2 -0
index a1a5d52..5dbe972 100644
@@ -27,6 +27,8 @@
 #define WM8962_FLL_OSC  3
 #define WM8962_FLL_INT  4
 
+#define WM8962_HPOUTx_MINUS_20_DB		0x65
+
 /*
  * Register values.
  */
Signature · 1 line
1.8.1.2
maintainer
#1 lore raw
Quoted 7 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

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.

As a matter of policy we go with the chip defaults on things like this. It doesn't make everyone happy since it's typically not actually a useful configuration for any use case but it provides a standard.