Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * ff-proc.c - a part of driver for RME Fireface series
0004  *
0005  * Copyright (c) 2015-2017 Takashi Sakamoto
0006  */
0007 
0008 #include "./ff.h"
0009 
0010 const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src)
0011 {
0012     static const char *const labels[] = {
0013         "Internal",
0014         "S/PDIF",
0015         "ADAT1",
0016         "ADAT2",
0017         "Word",
0018         "LTC",
0019     };
0020 
0021     if (src >= ARRAY_SIZE(labels))
0022         return NULL;
0023 
0024     return labels[src];
0025 }
0026 
0027 static void proc_dump_status(struct snd_info_entry *entry,
0028                  struct snd_info_buffer *buffer)
0029 {
0030     struct snd_ff *ff = entry->private_data;
0031 
0032     ff->spec->protocol->dump_status(ff, buffer);
0033 }
0034 
0035 static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
0036              const char *name,
0037              void (*op)(struct snd_info_entry *e,
0038                 struct snd_info_buffer *b))
0039 {
0040     struct snd_info_entry *entry;
0041 
0042     entry = snd_info_create_card_entry(ff->card, name, root);
0043     if (entry)
0044         snd_info_set_text_ops(entry, ff, op);
0045 }
0046 
0047 void snd_ff_proc_init(struct snd_ff *ff)
0048 {
0049     struct snd_info_entry *root;
0050 
0051     /*
0052      * All nodes are automatically removed at snd_card_disconnect(),
0053      * by following to link list.
0054      */
0055     root = snd_info_create_card_entry(ff->card, "firewire",
0056                       ff->card->proc_root);
0057     if (root == NULL)
0058         return;
0059     root->mode = S_IFDIR | 0555;
0060 
0061     add_node(ff, root, "status", proc_dump_status);
0062 }