blob: 4aecc8dcbb99ad08f01054bc9e7241ba87962754 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-only
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * ff-proc.c - a part of driver for RME Fireface series
4 *
5 * Copyright (c) 2015-2017 Takashi Sakamoto
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00006 */
7
8#include "./ff.h"
9
David Brazdil0f672f62019-12-10 10:32:29 +000010const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000011{
David Brazdil0f672f62019-12-10 10:32:29 +000012 static const char *const labels[] = {
13 "Internal",
14 "S/PDIF",
15 "ADAT1",
16 "ADAT2",
17 "Word",
18 "LTC",
19 };
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000020
David Brazdil0f672f62019-12-10 10:32:29 +000021 if (src >= ARRAY_SIZE(labels))
22 return NULL;
23
24 return labels[src];
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000025}
26
David Brazdil0f672f62019-12-10 10:32:29 +000027static void proc_dump_status(struct snd_info_entry *entry,
28 struct snd_info_buffer *buffer)
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000029{
30 struct snd_ff *ff = entry->private_data;
31
David Brazdil0f672f62019-12-10 10:32:29 +000032 ff->spec->protocol->dump_status(ff, buffer);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000033}
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(ff->card, name, root);
David Brazdil0f672f62019-12-10 10:32:29 +000043 if (entry)
44 snd_info_set_text_ops(entry, ff, op);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000045}
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(ff->card, "firewire",
56 ff->card->proc_root);
57 if (root == NULL)
58 return;
59 root->mode = S_IFDIR | 0555;
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000060
David Brazdil0f672f62019-12-10 10:32:29 +000061 add_node(ff, root, "status", proc_dump_status);
Andrew Scullb4b6d4a2019-01-02 15:54:55 +000062}