]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ALSA: fireface: add proc node to help debugging
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 31 Mar 2017 13:06:05 +0000 (22:06 +0900)
committerTakashi Iwai <tiwai@suse.de>
Wed, 5 Apr 2017 19:31:36 +0000 (21:31 +0200)
Drivers can retrieve the state and configuration of clock by read
transactions.

This commit allows protocol abstraction layer to to dump the
information for debugging, via proc interface.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/fireface/Makefile
sound/firewire/fireface/ff-proc.c [new file with mode: 0644]
sound/firewire/fireface/ff.c
sound/firewire/fireface/ff.h

index 8e465e4bd539d3ee456064bc6e35959992d06d07..e88ff9e2cf476258399c0371481775e3c545b578 100644 (file)
@@ -1,2 +1,2 @@
-snd-fireface-objs := ff.o ff-transaction.o ff-midi.o
+snd-fireface-objs := ff.o ff-transaction.o ff-midi.o ff-proc.o
 obj-$(CONFIG_SND_FIREFACE) += snd-fireface.o
diff --git a/sound/firewire/fireface/ff-proc.c b/sound/firewire/fireface/ff-proc.c
new file mode 100644 (file)
index 0000000..69441d1
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * ff-proc.c - a part of driver for RME Fireface series
+ *
+ * Copyright (c) 2015-2017 Takashi Sakamoto
+ *
+ * Licensed under the terms of the GNU General Public License, version 2.
+ */
+
+#include "./ff.h"
+
+static void proc_dump_clock_config(struct snd_info_entry *entry,
+                                  struct snd_info_buffer *buffer)
+{
+       struct snd_ff *ff = entry->private_data;
+
+       ff->spec->protocol->dump_clock_config(ff, buffer);
+}
+
+static void proc_dump_sync_status(struct snd_info_entry *entry,
+                                 struct snd_info_buffer *buffer)
+{
+       struct snd_ff *ff = entry->private_data;
+
+       ff->spec->protocol->dump_sync_status(ff, buffer);
+}
+
+static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
+                    const char *name,
+                    void (*op)(struct snd_info_entry *e,
+                               struct snd_info_buffer *b))
+{
+       struct snd_info_entry *entry;
+
+       entry = snd_info_create_card_entry(ff->card, name, root);
+       if (entry == NULL)
+               return;
+
+       snd_info_set_text_ops(entry, ff, op);
+       if (snd_info_register(entry) < 0)
+               snd_info_free_entry(entry);
+}
+
+void snd_ff_proc_init(struct snd_ff *ff)
+{
+       struct snd_info_entry *root;
+
+       /*
+        * All nodes are automatically removed at snd_card_disconnect(),
+        * by following to link list.
+        */
+       root = snd_info_create_card_entry(ff->card, "firewire",
+                                         ff->card->proc_root);
+       if (root == NULL)
+               return;
+       root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
+       if (snd_info_register(root) < 0) {
+               snd_info_free_entry(root);
+               return;
+       }
+
+       add_node(ff, root, "clock-config", proc_dump_clock_config);
+       add_node(ff, root, "sync-status", proc_dump_sync_status);
+}
index 11d76b372cd9353a65f04ed7cad41f180964c4db..22e7bcb4bd5102016a2c1ddc4d9e5d278bc6529d 100644 (file)
@@ -61,6 +61,8 @@ static void do_registration(struct work_struct *work)
 
        name_card(ff);
 
+       snd_ff_proc_init(ff);
+
        err = snd_ff_create_midi_devices(ff);
        if (err < 0)
                goto error;
index 2944bde250bf9d3f052f67753779bdbcc6f1e79f..2d1fab2c3467d7036bf5bcc2968e21362d410d50 100644 (file)
@@ -99,6 +99,8 @@ int snd_ff_transaction_register(struct snd_ff *ff);
 int snd_ff_transaction_reregister(struct snd_ff *ff);
 void snd_ff_transaction_unregister(struct snd_ff *ff);
 
+void snd_ff_proc_init(struct snd_ff *ff);
+
 int snd_ff_create_midi_devices(struct snd_ff *ff);
 
 #endif