Takashi Iwai tiwai@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@free.fr
diff -r 42321871a7dc pci/hda/hda_codec.c --- a/pci/hda/hda_codec.c Thu Apr 05 17:08:57 2007 +0200 +++ b/pci/hda/hda_codec.c Tue Apr 10 19:52:01 2007 +0200 @@ -38,6 +38,12 @@ MODULE_DESCRIPTION("Universal interface MODULE_DESCRIPTION("Universal interface for High Definition Audio Codec"); MODULE_LICENSE("GPL");
+static int trace_codec_commands = 0 ; + +#ifdef CONFIG_SND_DEBUG +module_param(trace_codec_commands, bool, 0444); +MODULE_PARM_DESC(trace_codec_commands, "Trace communication with hda codec (for debugging only)."); +#endif /* CONFIG_SND_DEBUG */
/* * vendor / preset table @@ -87,6 +93,12 @@ unsigned int snd_hda_codec_read(struct h else res = (unsigned int)-1; mutex_unlock(&codec->bus->cmd_mutex); + + if (trace_codec_commands) + snd_printk(KERN_INFO + "hda_intel codec read: nid %x direct %x verb %x parm %x -> %x\n", + nid, direct, verb, parm, res) ; + return res; }
@@ -108,6 +120,12 @@ int snd_hda_codec_write(struct hda_codec unsigned int verb, unsigned int parm) { int err; + + if (trace_codec_commands) + snd_printk(KERN_INFO + "hda_intel codec write: nid %x direct %x verb %x parm %x\n", + nid, direct, verb, parm) ; + mutex_lock(&codec->bus->cmd_mutex); err = codec->bus->ops.command(codec, nid, direct, verb, parm); mutex_unlock(&codec->bus->cmd_mutex);