[alsa-devel] [PATCH] Re: iec958 switch uneffective while playing ac3 stream

Takashi Iwai tiwai at suse.de
Thu Apr 12 14:27:28 CEST 2007


At Tue, 10 Apr 2007 20:00:29 +0200,
Dominique Dumont wrote:
> 
> Takashi Iwai <tiwai at suse.de> writes:
> 
> >> These traces were invaluable to figure out what was going on when I
> >> hunted for the spdif bug. I believe it will also be valuable if people
> >> have to look for other hda bugs.
> >
> > I think snd_printdd() isn't appropriate for this because you cannot
> > choose it at runtime but only at build time.  My preference is to add 
> > a debug module option (with ifdef CONFIG_SND_DEBUG) and check the
> > option value there.
> 
> Something like this ?
> 
> Signed off by: Dominique Dumont <domi.dumont at free.fr>

I prefer having options in snd-hda-intel side.  Also, setting
permission 0644 makes it possible to turn on/off the debug option
dynamically, which is pretty useful.

A test patch is below.  How about it?


Takashi

diff -r b31803586d4f pci/hda/hda_intel.c
--- a/pci/hda/hda_intel.c	Thu Apr 12 13:08:09 2007 +0200
+++ b/pci/hda/hda_intel.c	Thu Apr 12 14:24:47 2007 +0200
@@ -72,6 +72,14 @@ module_param(enable_msi, int, 0);
 module_param(enable_msi, int, 0);
 MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)");
 
+#ifdef CONFIG_SND_DEBUG
+static int trace_cmd;
+module_param(trace_cmd, bool, 0644);
+MODULE_PARM_DESC(trace_cmd,
+		 "Trace communication with hda codecs (for debugging only).");
+#else
+#define trace_cmd 0
+#endif
 
 /* just for backward compatibility */
 static int enable;
@@ -637,6 +645,9 @@ static int azx_send_cmd(struct hda_codec
 			unsigned int para)
 {
 	struct azx *chip = codec->bus->private_data;
+	if (trace_cmd)
+		snd_printd("codec cmd: nid %02x direct %x verb %04x parm %02x\n",
+			   nid, direct, verb, para);
 	if (chip->single_cmd)
 		return azx_single_send_cmd(codec, nid, direct, verb, para);
 	else
@@ -647,10 +658,15 @@ static unsigned int azx_get_response(str
 static unsigned int azx_get_response(struct hda_codec *codec)
 {
 	struct azx *chip = codec->bus->private_data;
+	unsigned int res;
+
 	if (chip->single_cmd)
-		return azx_single_get_response(codec);
+		res = azx_single_get_response(codec);
 	else
-		return azx_rirb_get_response(codec);
+		res = azx_rirb_get_response(codec);
+	if (trace_cmd)
+		snd_printd("codec res: -> %x\n", res);
+	return res;
 }
 
 


More information about the Alsa-devel mailing list