Skip to content

Commit d3fc7aa

Browse files
takaswietiwai
authored andcommitted
ALSA: fireface: add proc node to help debugging
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>
1 parent ff2c293 commit d3fc7aa

File tree

4 files changed

+68
-1
lines changed

4 files changed

+68
-1
lines changed

sound/firewire/fireface/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
snd-fireface-objs := ff.o ff-transaction.o ff-midi.o
1+
snd-fireface-objs := ff.o ff-transaction.o ff-midi.o ff-proc.o
22
obj-$(CONFIG_SND_FIREFACE) += snd-fireface.o

sound/firewire/fireface/ff-proc.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* ff-proc.c - a part of driver for RME Fireface series
3+
*
4+
* Copyright (c) 2015-2017 Takashi Sakamoto
5+
*
6+
* Licensed under the terms of the GNU General Public License, version 2.
7+
*/
8+
9+
#include "./ff.h"
10+
11+
static void proc_dump_clock_config(struct snd_info_entry *entry,
12+
struct snd_info_buffer *buffer)
13+
{
14+
struct snd_ff *ff = entry->private_data;
15+
16+
ff->spec->protocol->dump_clock_config(ff, buffer);
17+
}
18+
19+
static void proc_dump_sync_status(struct snd_info_entry *entry,
20+
struct snd_info_buffer *buffer)
21+
{
22+
struct snd_ff *ff = entry->private_data;
23+
24+
ff->spec->protocol->dump_sync_status(ff, buffer);
25+
}
26+
27+
static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
28+
const char *name,
29+
void (*op)(struct snd_info_entry *e,
30+
struct snd_info_buffer *b))
31+
{
32+
struct snd_info_entry *entry;
33+
34+
entry = snd_info_create_card_entry(ff->card, name, root);
35+
if (entry == NULL)
36+
return;
37+
38+
snd_info_set_text_ops(entry, ff, op);
39+
if (snd_info_register(entry) < 0)
40+
snd_info_free_entry(entry);
41+
}
42+
43+
void snd_ff_proc_init(struct snd_ff *ff)
44+
{
45+
struct snd_info_entry *root;
46+
47+
/*
48+
* All nodes are automatically removed at snd_card_disconnect(),
49+
* by following to link list.
50+
*/
51+
root = snd_info_create_card_entry(ff->card, "firewire",
52+
ff->card->proc_root);
53+
if (root == NULL)
54+
return;
55+
root->mode = S_IFDIR | S_IRUGO | S_IXUGO;
56+
if (snd_info_register(root) < 0) {
57+
snd_info_free_entry(root);
58+
return;
59+
}
60+
61+
add_node(ff, root, "clock-config", proc_dump_clock_config);
62+
add_node(ff, root, "sync-status", proc_dump_sync_status);
63+
}

sound/firewire/fireface/ff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ static void do_registration(struct work_struct *work)
6161

6262
name_card(ff);
6363

64+
snd_ff_proc_init(ff);
65+
6466
err = snd_ff_create_midi_devices(ff);
6567
if (err < 0)
6668
goto error;

sound/firewire/fireface/ff.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ int snd_ff_transaction_register(struct snd_ff *ff);
9999
int snd_ff_transaction_reregister(struct snd_ff *ff);
100100
void snd_ff_transaction_unregister(struct snd_ff *ff);
101101

102+
void snd_ff_proc_init(struct snd_ff *ff);
103+
102104
int snd_ff_create_midi_devices(struct snd_ff *ff);
103105

104106
#endif

0 commit comments

Comments
 (0)