Update of /cvsroot/alsa/alsa-kernel/pci/ac97
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2465/pci/ac97

Modified Files:
        ac97_proc.c 
Log Message:
added the write support to ac97#x-x+regs proc file.

this is for debugging purpose, and enabled only when CONFIG_SND_DEBUG is set.
it allows the user to modify AC97 register bits without compiling the sources.


Index: ac97_proc.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ac97/ac97_proc.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ac97_proc.c 7 Apr 2004 07:21:34 -0000       1.6
+++ ac97_proc.c 16 Apr 2004 18:29:12 -0000      1.7
@@ -321,6 +321,23 @@
        }
 }
 
+#ifdef CONFIG_SND_DEBUG
+/* direct register write for debugging */
+static void snd_ac97_proc_regs_write(snd_info_entry_t *entry, snd_info_buffer_t 
*buffer)
+{
+       ac97_t *ac97 = snd_magic_cast(ac97_t, entry->private_data, return);
+       char line[64];
+       unsigned int reg, val;
+       while (!snd_info_get_line(buffer, line, sizeof(line))) {
+               if (sscanf(line, "%x %x", &reg, &val) != 2)
+                       continue;
+               /* register must be odd */
+               if (reg < 0x80 && (reg & 1) == 0 && val <= 0xffff)
+                       snd_ac97_write_cache(ac97, reg, val);
+       }
+}
+#endif
+
 static void snd_ac97_proc_regs_read_main(ac97_t *ac97, snd_info_buffer_t * buffer, 
int subidx)
 {
        int reg, val;
@@ -376,6 +393,11 @@
        sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num);
        if ((entry = snd_info_create_card_entry(ac97->bus->card, name, 
ac97->bus->proc)) != NULL) {
                snd_info_set_text_ops(entry, ac97, 1024, snd_ac97_proc_regs_read);
+#ifdef CONFIG_SND_DEBUG
+               entry->mode |= S_IWUSR;
+               entry->c.text.write_size = 1024;
+               entry->c.text.write = snd_ac97_proc_regs_write;
+#endif
                if (snd_info_register(entry) < 0) {
                        snd_info_free_entry(entry);
                        entry = NULL;



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to