2019-05-30 06:57:59 +07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2017-03-31 20:06:05 +07:00
|
|
|
/*
|
|
|
|
* ff-proc.c - a part of driver for RME Fireface series
|
|
|
|
*
|
|
|
|
* Copyright (c) 2015-2017 Takashi Sakamoto
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "./ff.h"
|
|
|
|
|
2019-01-20 15:25:52 +07:00
|
|
|
const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src)
|
|
|
|
{
|
|
|
|
static const char *const labels[] = {
|
|
|
|
"Internal",
|
|
|
|
"S/PDIF",
|
|
|
|
"ADAT1",
|
|
|
|
"ADAT2",
|
|
|
|
"Word",
|
|
|
|
"LTC",
|
|
|
|
};
|
|
|
|
|
|
|
|
if (src >= ARRAY_SIZE(labels))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return labels[src];
|
|
|
|
}
|
|
|
|
|
2019-01-20 15:25:47 +07:00
|
|
|
static void proc_dump_status(struct snd_info_entry *entry,
|
|
|
|
struct snd_info_buffer *buffer)
|
|
|
|
{
|
|
|
|
struct snd_ff *ff = entry->private_data;
|
|
|
|
|
2019-01-20 15:25:48 +07:00
|
|
|
ff->spec->protocol->dump_status(ff, buffer);
|
2019-01-20 15:25:47 +07:00
|
|
|
}
|
|
|
|
|
2017-03-31 20:06:05 +07:00
|
|
|
static void add_node(struct snd_ff *ff, struct snd_info_entry *root,
|
|
|
|
const char *name,
|
|
|
|
void (*op)(struct snd_info_entry *e,
|
|
|
|
struct snd_info_buffer *b))
|
|
|
|
{
|
|
|
|
struct snd_info_entry *entry;
|
|
|
|
|
|
|
|
entry = snd_info_create_card_entry(ff->card, name, root);
|
2019-02-05 18:34:12 +07:00
|
|
|
if (entry)
|
|
|
|
snd_info_set_text_ops(entry, ff, op);
|
2017-03-31 20:06:05 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
void snd_ff_proc_init(struct snd_ff *ff)
|
|
|
|
{
|
|
|
|
struct snd_info_entry *root;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* All nodes are automatically removed at snd_card_disconnect(),
|
|
|
|
* by following to link list.
|
|
|
|
*/
|
|
|
|
root = snd_info_create_card_entry(ff->card, "firewire",
|
|
|
|
ff->card->proc_root);
|
|
|
|
if (root == NULL)
|
|
|
|
return;
|
2018-05-24 02:20:59 +07:00
|
|
|
root->mode = S_IFDIR | 0555;
|
2017-03-31 20:06:05 +07:00
|
|
|
|
2019-01-20 15:25:47 +07:00
|
|
|
add_node(ff, root, "status", proc_dump_status);
|
2017-03-31 20:06:05 +07:00
|
|
|
}
|