Title: [9744] trunk/sound/soc: asoc: add ad73311 control
Revision
9744
Author
scott
Date
2011-03-21 05:37:14 -0400 (Mon, 21 Mar 2011)

Log Message

asoc: add ad73311 control

Modified Paths


Diff

Modified: trunk/sound/soc/blackfin/bf5xx-ad73311.c (9743 => 9744)


--- trunk/sound/soc/blackfin/bf5xx-ad73311.c	2011-03-21 09:29:04 UTC (rev 9743)
+++ trunk/sound/soc/blackfin/bf5xx-ad73311.c	2011-03-21 09:37:14 UTC (rev 9744)
@@ -100,7 +100,7 @@
 	ctrl_regs[2] = AD_CONTROL | AD_WRITE | CTRL_REG_D | REGD_OGS(ctrl->ogs) | \
 			REGD_IGS(ctrl->igs);
 	ctrl_regs[3] = AD_CONTROL | AD_WRITE | CTRL_REG_E | REGE_DA(0x1f);
-	ctrl_regs[4] = AD_CONTROL | AD_WRITE | CTRL_REG_F | REGF_SEEN ;
+	ctrl_regs[4] = AD_CONTROL | AD_WRITE | CTRL_REG_F | REGF_SEEN(ctrl->se_en) ;
 	ctrl_regs[5] = AD_CONTROL | AD_WRITE | CTRL_REG_A | REGA_MODE_DATA;
 #elif CONFIG_SND_AD7XXXX_SELECT == 1
 	/* MCLK = MCLK = 12.288 MHz
@@ -172,6 +172,7 @@
 		.dirate = 0,
 		.igs = 2,
 		.ogs = 2,
+		.se_en = 1,
 	};
 	if (gpio_request(GPIO_SE, "AD73311_SE")) {
 		printk(KERN_ERR "%s: Failed ro request GPIO_%d\n", __func__, GPIO_SE);

Modified: trunk/sound/soc/codecs/ad73311.c (9743 => 9744)


--- trunk/sound/soc/codecs/ad73311.c	2011-03-21 09:29:04 UTC (rev 9743)
+++ trunk/sound/soc/codecs/ad73311.c	2011-03-21 09:37:14 UTC (rev 9744)
@@ -44,6 +44,7 @@
 	.dirate = 0,
 	.igs = 2,
 	.ogs = 2,
+	.se_en = 1,
 };
 
 static int ad73311_ogs_put(struct snd_kcontrol *kcontrol,
@@ -121,6 +122,26 @@
 	return 0;
 }
 
+static int ad73311_seen_put(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	if (ad73311_ctrls.se_en != ucontrol->value.integer.value[0]) {
+		ad73311_ctrls.se_en = ucontrol->value.integer.value[0];
+		return codec->hw_write(codec->control_data, (char *)&ad73311_ctrls,
+				sizeof(ad73311_ctrls));
+	}
+	return 0;
+}
+
+static int ad73311_seen_get(struct snd_kcontrol *kcontrol,
+	struct snd_ctl_elem_value *ucontrol)
+{
+	ucontrol->value.integer.value[0] = ad73311_ctrls.se_en;
+	return 0;
+}
+
+
 static const struct snd_kcontrol_new ad73311_snd_controls[] = {
 	SOC_SINGLE_EXT("ADC Capture Volume", CTRL_REG_D, 0, 7, 0,
 			ad73311_igs_get, ad73311_igs_put),
@@ -128,6 +149,8 @@
 			ad73311_ogs_get, ad73311_ogs_put),
 	SOC_SINGLE_EXT("Decimation/Interpolation Rate", CTRL_REG_B, 0, 3, 0,
 			ad73311_dirate_get, ad73311_dirate_put),
+	SOC_SINGLE_EXT("Single-Ended Enable Switch", CTRL_REG_F, 5, 1, 0,
+			ad73311_seen_get, ad73311_seen_put),
 };
 #endif
 

Modified: trunk/sound/soc/codecs/ad73311.h (9743 => 9744)


--- trunk/sound/soc/codecs/ad73311.h	2011-03-21 09:29:04 UTC (rev 9743)
+++ trunk/sound/soc/codecs/ad73311.h	2011-03-21 09:37:14 UTC (rev 9744)
@@ -83,7 +83,7 @@
 /* Control register F */
 #define CTRL_REG_F	(5 << 8)
 
-#define REGF_SEEN		(1 << 5)
+#define REGF_SEEN(x)		((x & 0x1) << 5)
 #define REGF_INV		(1 << 6)
 #define REGF_ALB		(1 << 7)
 
@@ -145,6 +145,7 @@
 	char dirate; /* Decimation/Interpolation Rate */
 	char igs; /* Input Gain Select */
 	char ogs; /* Output Gain Select */
+	char se_en; /* Single-Ended Enable */
 };
 
 #endif
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to