Skip to contentSkip to conversation

ALSA: cs5535audio: rename V_REFOUT control to MIC Bias

PATCH In review Andres Salomon 1 participant 1 message Nov 6, 2008

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

PATCH 10/14 ALSA: cs5535audio: rename V_REFOUT control to MIC Bias

This drops the AD1888 V_REFOUT control, and replaces it with a MIC Bias Enable control. It also moves the MIC bias enabling into a separate function.

---
 sound/pci/cs5535audio/cs5535audio.h      |   16 +++++++
 sound/pci/cs5535audio/cs5535audio_olpc.c |   73 ++++++++++++++++++++++++++++--
 sound/pci/cs5535audio/cs5535audio_pcm.c  |   17 +------
 3 files changed, 87 insertions(+), 19 deletions(-)
sound/pci/cs5535audio/cs5535audio.h +16 -0
index 22737fc..63190cd 100644
@@ -104,6 +104,19 @@ void __devinit olpc_prequirks(struct snd_card *card,
 		struct snd_ac97_template *ac97);
 int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
 void olpc_analog_input(struct snd_ac97 *ac97, int on);
+void olpc_mic_bias(struct snd_ac97 *ac97, int on);
+
+static inline void olpc_capture_open(struct snd_ac97 *ac97)
+{
+	/* enable MIC Bias for recording */
+	olpc_mic_bias(ac97, 1);
+}
+
+static inline void olpc_capture_close(struct snd_ac97 *ac97)
+{
+	/* disable the MIC Bias (so the recording LED turns off) */
+	olpc_mic_bias(ac97, 0);
+}
 #else
 static inline void olpc_prequirks(struct snd_card *card,
 		struct snd_ac97_template *ac97) { }
@@ -112,6 +125,9 @@ static inline int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
 	return 0;
 }
 static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { }
+static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { }
+static inline void olpc_capture_open(struct snd_ac97 *ac97) { }
+static inline void olpc_capture_close(struct snd_ac97 *ac97) { }
 #endif
 
 int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
sound/pci/cs5535audio/cs5535audio_olpc.c +69 -4

102 lines not on this page · raw message

sound/pci/cs5535audio/cs5535audio_pcm.c +2 -15
index fa2a6b1..0f48a87 100644
@@ -363,27 +363,14 @@ static int snd_cs5535audio_capture_open(struct snd_pcm_substream *substream)
 	if ((err = snd_pcm_hw_constraint_integer(runtime,
 					 SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
 		return err;
-
-#ifdef CONFIG_OLPC
-	/* Enable the V_ref bias only while recording. */
-	err = snd_ac97_update_bits(cs5535au->ac97, AC97_AD_MISC,
-			1 << AC97_AD_VREFD_SHIFT, 0);
-	if (err < 0)
-		snd_printk(KERN_ERR "Error updating AD_MISC %d\n", err);
-#endif
+	olpc_capture_open(cs5535au->ac97);
 	return 0;
 }
 
 static int snd_cs5535audio_capture_close(struct snd_pcm_substream *substream)
 {
-	int err;
 	struct cs5535audio *cs5535au = snd_pcm_substream_chip(substream);
-
-#ifdef CONFIG_OLPC
-	/* Disable V_ref bias. */
-	err = snd_ac97_update_bits(cs5535au->ac97, AC97_AD_MISC,
-			1 << AC97_AD_VREFD_SHIFT, 1 << AC97_AD_VREFD_SHIFT);
-#endif
+	olpc_capture_close(cs5535au->ac97);
 	return 0;
 }
 
Signature · 1 line
1.5.6.5