Merge tag 'powerpc-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[linux/fpc-iii.git] / sound / firewire / fireface / ff-proc.c
blob4aecc8dcbb99ad08f01054bc9e7241ba87962754
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * ff-proc.c - a part of driver for RME Fireface series
5 * Copyright (c) 2015-2017 Takashi Sakamoto
6 */
8 #include "./ff.h"
10 const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src)
12 static const char *const labels[] = {
13 "Internal",
14 "S/PDIF",
15 "ADAT1",
16 "ADAT2",
17 "Word",
18 "LTC",
21 if (src >= ARRAY_SIZE(labels))
22 return NULL;
24 return labels[src];
27 static void proc_dump_status(struct snd_info_entry *entry,
28 struct snd_info_buffer *buffer)
30 struct snd_ff *ff = entry->private_data;
32 ff->spec->protocol->dump_status(ff, buffer);
35 static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
36 const char *name,
37 void (*op)(struct snd_info_entry *e,
38 struct snd_info_buffer *b))
40 struct snd_info_entry *entry;
42 entry = snd_info_create_card_entry(ff->card, name, root);
43 if (entry)
44 snd_info_set_text_ops(entry, ff, op);
47 void snd_ff_proc_init(struct snd_ff *ff)
49 struct snd_info_entry *root;
52 * All nodes are automatically removed at snd_card_disconnect(),
53 * by following to link list.
55 root = snd_info_create_card_entry(ff->card, "firewire",
56 ff->card->proc_root);
57 if (root == NULL)
58 return;
59 root->mode = S_IFDIR | 0555;
61 add_node(ff, root, "status", proc_dump_status);