| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ff-proc.c - a part of driver for RME Fireface series |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2015-2017 Takashi Sakamoto |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the terms of the GNU General Public License, version 2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include "./ff.h" |
|---|
| 10 | 9 | |
|---|
| 11 | | -static void proc_dump_clock_config(struct snd_info_entry *entry, |
|---|
| 12 | | - struct snd_info_buffer *buffer) |
|---|
| 10 | +const char *snd_ff_proc_get_clk_label(enum snd_ff_clock_src src) |
|---|
| 13 | 11 | { |
|---|
| 14 | | - struct snd_ff *ff = entry->private_data; |
|---|
| 12 | + static const char *const labels[] = { |
|---|
| 13 | + "Internal", |
|---|
| 14 | + "S/PDIF", |
|---|
| 15 | + "ADAT1", |
|---|
| 16 | + "ADAT2", |
|---|
| 17 | + "Word", |
|---|
| 18 | + "LTC", |
|---|
| 19 | + }; |
|---|
| 15 | 20 | |
|---|
| 16 | | - ff->spec->protocol->dump_clock_config(ff, buffer); |
|---|
| 21 | + if (src >= ARRAY_SIZE(labels)) |
|---|
| 22 | + return NULL; |
|---|
| 23 | + |
|---|
| 24 | + return labels[src]; |
|---|
| 17 | 25 | } |
|---|
| 18 | 26 | |
|---|
| 19 | | -static void proc_dump_sync_status(struct snd_info_entry *entry, |
|---|
| 20 | | - struct snd_info_buffer *buffer) |
|---|
| 27 | +static void proc_dump_status(struct snd_info_entry *entry, |
|---|
| 28 | + struct snd_info_buffer *buffer) |
|---|
| 21 | 29 | { |
|---|
| 22 | 30 | struct snd_ff *ff = entry->private_data; |
|---|
| 23 | 31 | |
|---|
| 24 | | - ff->spec->protocol->dump_sync_status(ff, buffer); |
|---|
| 32 | + ff->spec->protocol->dump_status(ff, buffer); |
|---|
| 25 | 33 | } |
|---|
| 26 | 34 | |
|---|
| 27 | 35 | static void add_node(struct snd_ff *ff, struct snd_info_entry *root, |
|---|
| .. | .. |
|---|
| 32 | 40 | struct snd_info_entry *entry; |
|---|
| 33 | 41 | |
|---|
| 34 | 42 | entry = snd_info_create_card_entry(ff->card, name, root); |
|---|
| 35 | | - if (entry == NULL) |
|---|
| 36 | | - return; |
|---|
| 37 | | - |
|---|
| 38 | | - snd_info_set_text_ops(entry, ff, op); |
|---|
| 39 | | - if (snd_info_register(entry) < 0) |
|---|
| 40 | | - snd_info_free_entry(entry); |
|---|
| 43 | + if (entry) |
|---|
| 44 | + snd_info_set_text_ops(entry, ff, op); |
|---|
| 41 | 45 | } |
|---|
| 42 | 46 | |
|---|
| 43 | 47 | void snd_ff_proc_init(struct snd_ff *ff) |
|---|
| .. | .. |
|---|
| 53 | 57 | if (root == NULL) |
|---|
| 54 | 58 | return; |
|---|
| 55 | 59 | root->mode = S_IFDIR | 0555; |
|---|
| 56 | | - if (snd_info_register(root) < 0) { |
|---|
| 57 | | - snd_info_free_entry(root); |
|---|
| 58 | | - return; |
|---|
| 59 | | - } |
|---|
| 60 | 60 | |
|---|
| 61 | | - add_node(ff, root, "clock-config", proc_dump_clock_config); |
|---|
| 62 | | - add_node(ff, root, "sync-status", proc_dump_sync_status); |
|---|
| 61 | + add_node(ff, root, "status", proc_dump_status); |
|---|
| 63 | 62 | } |
|---|