Skip to contentSkip to conversation

ASoC: Mark WM8962 Additional Control 4 register as volatile

PATCH In review Mark Brown 2 participants 3 messages Sep 30, 2010

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 ASoC: Mark WM8962 Additional Control 4 register as volatile

There are some status bits for microphone detection in here.

---
 sound/soc/codecs/wm8962-tables.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/wm8962-tables.c +1 -1
index f21a8c1..6fa98ea 100644
@@ -21204,7 +21204,7 @@ const struct wm8962_reg_access wm8962_reg_access[WM8962_MAX_REGISTER + 1] = {
 	{ 0x0000, 0x0000, 0x0000 }, /* R45 */
 	{ 0x0000, 0x0000, 0x0000 }, /* R46 */
 	{ 0x000F, 0x0000, 0x0000 }, /* R47    - Thermal Shutdown Status */
-	{ 0x7EC7, 0x7E07, 0x0000 }, /* R48    - Additional Control (4) */
+	{ 0x7EC7, 0x7E07, 0xFFFF }, /* R48    - Additional Control (4) */
 	{ 0x00D3, 0x00D7, 0xFFFF }, /* R49    - Class D Control 1 */
 	{ 0x0000, 0x0000, 0x0000 }, /* R50 */
 	{ 0x0047, 0x0047, 0x0000 }, /* R51    - Class D Control 2 */
Signature · 1 line
1.7.1
author
#1 lore raw

PATCH 2/2 ASoC: Provide microphone bias configuration for WM8962

Add the widget for MICBIAS power control and allow configuration of the microphone bias setup via the platform data for the WM8962. When microphone status signals are brought out to GPIO this should be sufficient to enable microphone detection.

---
 include/sound/wm8962.h    |    6 ++++++
 sound/soc/codecs/wm8962.c |   12 ++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
include/sound/wm8962.h +6 -0
index cc32aff..9722aac 100644
@@ -17,6 +17,12 @@
 struct wm8962_pdata {
 	u32 gpio_init[WM8962_MAX_GPIO];
 
+	/* Setup for microphone detection, raw value to be written to
+	 * R48(0x30) - only microphone related bits will be updated.
+	 * Detection may be enabled here for use with signals brought
+	 * out on the GPIOs. */
+	u32 mic_cfg;
+
 	bool irq_active_low;
 
 	bool spk_mono;   /* Speaker outputs tied together as mono */
sound/soc/codecs/wm8962.c +12 -0
index 4fa5de8..be34146 100644
@@ -630,6 +630,8 @@ SND_SOC_DAPM_INPUT("IN4L"),
 SND_SOC_DAPM_INPUT("IN4R"),
 SND_SOC_DAPM_INPUT("Beep"),
 
+SND_SOC_DAPM_MICBIAS("MICBIAS", WM8962_PWR_MGMT_1, 1, 0),
+
 SND_SOC_DAPM_SUPPLY("Class G", WM8962_CHARGE_PUMP_B, 0, 1, NULL, 0),
 SND_SOC_DAPM_SUPPLY("SYSCLK", WM8962_CLOCKING2, 5, 0, sysclk_event,
 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
@@ -1755,6 +1757,16 @@ static int wm8962_probe(struct snd_soc_codec *codec)
 		if (pdata->spk_mono)
 			wm8962->reg_cache[WM8962_CLASS_D_CONTROL_2]
 				|= WM8962_SPK_MONO;
+
+		/* Micbias setup, detection enable and detection
+		 * threasholds. */
+		if (pdata->mic_cfg)
+			snd_soc_update_bits(codec, WM8962_ADDITIONAL_CONTROL_4,
+					    WM8962_MICDET_ENA |
+					    WM8962_MICDET_THR_MASK |
+					    WM8962_MICSHORT_THR_MASK |
+					    WM8962_MICBIAS_LVL,
+					    pdata->mic_cfg);
 	}
 
 	/* Latch volume update bits */
Signature · 1 line
1.7.1
Acked-by on v1 1/2
#2 lore raw
In reply to Mark Brown
Quoted 12 lines · Mark Brown

There are some status bits for microphone detection in here.

---
 sound/soc/codecs/wm8962-tables.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/wm8962-tables.c +0 -0
index f21a8c1..6fa98ea 100644

sound/soc/codecs/wm8962-tables.c const struct wm8962_reg_access wm8962_reg_access[WM8962_MAX_REGISTER + 1] = { · line 21210

Quoted 8 lines
sound/soc/codecs/wm8962-tables.c +1 -1
@@ -21204,7 +21204,7 @@ const struct wm8962_reg_access wm8962_reg_access[WM8962_MAX_REGISTER + 1] = {
 	{ 0x0000, 0x0000, 0x0000 }, /* R45 */
 	{ 0x0000, 0x0000, 0x0000 }, /* R46 */
 	{ 0x000F, 0x0000, 0x0000 }, /* R47    - Thermal Shutdown Status */
-	{ 0x7EC7, 0x7E07, 0x0000 }, /* R48    - Additional Control (4) */
+	{ 0x7EC7, 0x7E07, 0xFFFF }, /* R48    - Additional Control (4) */
 	{ 0x00D3, 0x00D7, 0xFFFF }, /* R49    - Class D Control 1 */
 	{ 0x0000, 0x0000, 0x0000 }, /* R50 */
 	{ 0x0047, 0x0047, 0x0000 }, /* R51    - Class D Control 2 */

Both

Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk