1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * ff-proc.c - a part of driver for RME Fireface series
4 *
5 * Copyright (c) 2015-2017 Takashi Sakamoto
6 */
7
8#include "./ff.h"
9
10const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src)
11{
12 static const char *const labels[] = {
13 "Internal",
14 "S/PDIF",
15 "ADAT1",
16 "ADAT2",
17 "Word",
18 "LTC",
19 };
20
21 if (src >= ARRAY_SIZE(labels))
22 return NULL;
23
24 return labels[src];
25}
26
27static void proc_dump_status(struct snd_info_entry *entry,
28 struct snd_info_buffer *buffer)
29{
30 struct snd_ff *ff = entry->private_data;
31
32 ff->spec->protocol->dump_status(ff, buffer);
33}
34
35static 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))
39{
40 struct snd_info_entry *entry;
41
42 entry = snd_info_create_card_entry(card: ff->card, name, parent: root);
43 if (entry)
44 snd_info_set_text_ops(entry, private_data: ff, read: op);
45}
46
47void snd_ff_proc_init(struct snd_ff *ff)
48{
49 struct snd_info_entry *root;
50
51 /*
52 * All nodes are automatically removed at snd_card_disconnect(),
53 * by following to link list.
54 */
55 root = snd_info_create_card_entry(card: ff->card, name: "firewire",
56 parent: ff->card->proc_root);
57 if (root == NULL)
58 return;
59 root->mode = S_IFDIR | 0555;
60
61 add_node(ff, root, name: "status", op: proc_dump_status);
62}
63

source code of linux/sound/firewire/fireface/ff-proc.c