| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * motu-proc.c - a part of driver for MOTU FireWire series |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2015-2017 Takashi Sakamoto <o-takashi@sakamocchi.jp> |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the terms of the GNU General Public License, version 2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include "./motu.h" |
|---|
| .. | .. |
|---|
| 20 | 19 | [SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX] = "S/PDIF on coaxial interface", |
|---|
| 21 | 20 | [SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR] = "AESEBU on XLR interface", |
|---|
| 22 | 21 | [SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC] = "Word clock on BNC interface", |
|---|
| 22 | + [SND_MOTU_CLOCK_SOURCE_SPH] = "Source packet header", |
|---|
| 23 | + [SND_MOTU_CLOCK_SOURCE_UNKNOWN] = "Unknown", |
|---|
| 23 | 24 | }; |
|---|
| 24 | 25 | |
|---|
| 25 | 26 | static void proc_read_clock(struct snd_info_entry *entry, |
|---|
| .. | .. |
|---|
| 27 | 28 | { |
|---|
| 28 | 29 | |
|---|
| 29 | 30 | struct snd_motu *motu = entry->private_data; |
|---|
| 30 | | - const struct snd_motu_protocol *const protocol = motu->spec->protocol; |
|---|
| 31 | 31 | unsigned int rate; |
|---|
| 32 | 32 | enum snd_motu_clock_source source; |
|---|
| 33 | 33 | |
|---|
| 34 | | - if (protocol->get_clock_rate(motu, &rate) < 0) |
|---|
| 34 | + if (snd_motu_protocol_get_clock_rate(motu, &rate) < 0) |
|---|
| 35 | 35 | return; |
|---|
| 36 | | - if (protocol->get_clock_source(motu, &source) < 0) |
|---|
| 36 | + if (snd_motu_protocol_get_clock_source(motu, &source) < 0) |
|---|
| 37 | 37 | return; |
|---|
| 38 | 38 | |
|---|
| 39 | 39 | snd_iprintf(buffer, "Rate:\t%d\n", rate); |
|---|
| .. | .. |
|---|
| 44 | 44 | struct snd_info_buffer *buffer) |
|---|
| 45 | 45 | { |
|---|
| 46 | 46 | struct snd_motu *motu = entry->private_data; |
|---|
| 47 | | - const struct snd_motu_protocol *const protocol = motu->spec->protocol; |
|---|
| 48 | 47 | unsigned int mode; |
|---|
| 49 | 48 | struct snd_motu_packet_format *formats; |
|---|
| 50 | 49 | int i; |
|---|
| 51 | 50 | |
|---|
| 52 | | - if (protocol->cache_packet_formats(motu) < 0) |
|---|
| 51 | + if (snd_motu_protocol_cache_packet_formats(motu) < 0) |
|---|
| 53 | 52 | return; |
|---|
| 54 | 53 | |
|---|
| 55 | | - snd_iprintf(buffer, "tx:\tmsg\tfixed\tdiffered\n"); |
|---|
| 54 | + snd_iprintf(buffer, "tx:\tmsg\tfixed\ttotal\n"); |
|---|
| 56 | 55 | for (i = 0; i < SND_MOTU_CLOCK_RATE_COUNT; ++i) { |
|---|
| 57 | 56 | mode = i >> 1; |
|---|
| 58 | 57 | |
|---|
| .. | .. |
|---|
| 61 | 60 | "%u:\t%u\t%u\t%u\n", |
|---|
| 62 | 61 | snd_motu_clock_rates[i], |
|---|
| 63 | 62 | formats->msg_chunks, |
|---|
| 64 | | - formats->fixed_part_pcm_chunks[mode], |
|---|
| 65 | | - formats->differed_part_pcm_chunks[mode]); |
|---|
| 63 | + motu->spec->tx_fixed_pcm_chunks[mode], |
|---|
| 64 | + formats->pcm_chunks[mode]); |
|---|
| 66 | 65 | } |
|---|
| 67 | 66 | |
|---|
| 68 | | - snd_iprintf(buffer, "rx:\tmsg\tfixed\tdiffered\n"); |
|---|
| 67 | + snd_iprintf(buffer, "rx:\tmsg\tfixed\ttotal\n"); |
|---|
| 69 | 68 | for (i = 0; i < SND_MOTU_CLOCK_RATE_COUNT; ++i) { |
|---|
| 70 | 69 | mode = i >> 1; |
|---|
| 71 | 70 | |
|---|
| .. | .. |
|---|
| 74 | 73 | "%u:\t%u\t%u\t%u\n", |
|---|
| 75 | 74 | snd_motu_clock_rates[i], |
|---|
| 76 | 75 | formats->msg_chunks, |
|---|
| 77 | | - formats->fixed_part_pcm_chunks[mode], |
|---|
| 78 | | - formats->differed_part_pcm_chunks[mode]); |
|---|
| 76 | + motu->spec->rx_fixed_pcm_chunks[mode], |
|---|
| 77 | + formats->pcm_chunks[mode]); |
|---|
| 79 | 78 | } |
|---|
| 80 | 79 | } |
|---|
| 81 | 80 | |
|---|
| .. | .. |
|---|
| 87 | 86 | struct snd_info_entry *entry; |
|---|
| 88 | 87 | |
|---|
| 89 | 88 | entry = snd_info_create_card_entry(motu->card, name, root); |
|---|
| 90 | | - if (entry == NULL) |
|---|
| 91 | | - return; |
|---|
| 92 | | - |
|---|
| 93 | | - snd_info_set_text_ops(entry, motu, op); |
|---|
| 94 | | - if (snd_info_register(entry) < 0) |
|---|
| 95 | | - snd_info_free_entry(entry); |
|---|
| 89 | + if (entry) |
|---|
| 90 | + snd_info_set_text_ops(entry, motu, op); |
|---|
| 96 | 91 | } |
|---|
| 97 | 92 | |
|---|
| 98 | 93 | void snd_motu_proc_init(struct snd_motu *motu) |
|---|
| .. | .. |
|---|
| 108 | 103 | if (root == NULL) |
|---|
| 109 | 104 | return; |
|---|
| 110 | 105 | root->mode = S_IFDIR | 0555; |
|---|
| 111 | | - if (snd_info_register(root) < 0) { |
|---|
| 112 | | - snd_info_free_entry(root); |
|---|
| 113 | | - return; |
|---|
| 114 | | - } |
|---|
| 115 | 106 | |
|---|
| 116 | 107 | add_node(motu, root, "clock", proc_read_clock); |
|---|
| 117 | 108 | add_node(motu, root, "format", proc_read_format); |
|---|