[alsa-devel] Correct use of ak4114.c?

dustin at seznam.cz dustin at seznam.cz
Wed Apr 4 22:36:20 CEST 2007


  
>  I am attaching a tested patch for ak4114.c and ak4114.h 

Hmm, the mailing list does not like attachments. Here is the patch:

diff -r 05ecca0fba92 i2c/other/ak4114.c
--- a/i2c/other/ak4114.c	Tue Apr 03 13:20:49 2007 +0200
+++ b/i2c/other/ak4114.c	Wed Apr 04 22:01:04 2007 +0200
@@ -435,7 +435,7 @@ static struct snd_kcontrol_new snd_ak411
 	.access =	SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
 	.info =		snd_ak4114_in_bit_info,
 	.get =		snd_ak4114_in_bit_get,
-	.private_value = (6<<8) | AK4114_REG_RCS1,
+	.private_value = (6<<8) | AK4114_REG_RCS0,
 },
 {
 	.iface =	SNDRV_CTL_ELEM_IFACE_PCM,
@@ -443,7 +443,15 @@ static struct snd_kcontrol_new snd_ak411
 	.access =	SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
 	.info =		snd_ak4114_in_bit_info,
 	.get =		snd_ak4114_in_bit_get,
-	.private_value = (3<<8) | AK4114_REG_RCS1,
+	.private_value = (3<<8) | AK4114_REG_RCS0,
+},
+{
+	.iface =	SNDRV_CTL_ELEM_IFACE_PCM,
+	.name =		"IEC958 PPL Lock Status",
+	.access =	SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
+	.info =		snd_ak4114_in_bit_info,
+	.get =		snd_ak4114_in_bit_get,
+	.private_value = (1<<31) | (4<<8) | AK4114_REG_RCS0,
 }
 };
 
@@ -462,7 +470,7 @@ int snd_ak4114_build(struct ak4114 *ak41
 		kctl = snd_ctl_new1(&snd_ak4114_iec958_controls[idx], ak4114);
 		if (kctl == NULL)
 			return -ENOMEM;
-		if (!strstr(kctl->id.name, "Playback")) {
+		if (strstr(kctl->id.name, "Playback")) {
 			if (ply_substream == NULL) {
 				snd_ctl_free_one(kctl);
 				ak4114->kctls[idx] = NULL;
@@ -526,6 +534,9 @@ static void ak4114_notify(struct ak4114 
 	if (c0 & AK4114_DTSCD)
 		snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
 			       &ak4114->kctls[13]->id);
+	if (c0 & AK4114_UNLCK)
+		snd_ctl_notify(ak4114->card, SNDRV_CTL_EVENT_MASK_VALUE,
+			       &ak4114->kctls[14]->id);
 }
 
 int snd_ak4114_external_rate(struct ak4114 *ak4114)
@@ -587,7 +598,7 @@ static void ak4114_stats(struct work_str
 {
 	struct ak4114 *chip = container_of(work, struct ak4114, work.work);
 
-	if (chip->init)
+	if (! chip->init)
 		snd_ak4114_check_rate_and_errors(chip, 0);
 
 	schedule_delayed_work(&chip->work, HZ / 10);
diff -r 05ecca0fba92 include/ak4114.h
--- a/include/ak4114.h	Tue Apr 03 13:20:49 2007 +0200
+++ b/include/ak4114.h	Wed Apr 04 21:57:44 2007 +0200
@@ -158,7 +158,7 @@
 #define AK4114_CHECK_NO_STAT	(1<<0)	/* no statistics */
 #define AK4114_CHECK_NO_RATE	(1<<1)	/* no rate check */
 
-#define AK4114_CONTROLS		14
+#define AK4114_CONTROLS		15
 
 typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data);
 typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr);


More information about the Alsa-devel mailing list