diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2014-11-28 10:59:17 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-11-29 14:09:47 -0500 |
commit | 04d426a039691bf114997a8af877682fdffcebd7 (patch) | |
tree | 88380222cd8ef700fb780192344289d9f03859f3 | |
parent | 19af57b46dda93b34902739673d5f37d8c6d0d5f (diff) |
ALSA: dice: Split proc interface into a file
This commit adds a file and move some codes related to proc output.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/firewire/dice/Makefile | 4 | ||||
-rw-r--r-- | sound/firewire/dice/dice-proc.c | 252 | ||||
-rw-r--r-- | sound/firewire/dice/dice.c | 244 | ||||
-rw-r--r-- | sound/firewire/dice/dice.h | 2 |
4 files changed, 257 insertions, 245 deletions
diff --git a/sound/firewire/dice/Makefile b/sound/firewire/dice/Makefile index 73b0e38803cb..9a48289eb9cb 100644 --- a/sound/firewire/dice/Makefile +++ b/sound/firewire/dice/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | snd-dice-objs := dice-transaction.o dice-stream.o dice-pcm.o dice-hwdep.o \ | 1 | snd-dice-objs := dice-transaction.o dice-stream.o dice-proc.o dice-pcm.o \ |
2 | dice.o | 2 | dice-hwdep.o dice.o |
3 | obj-m += snd-dice.o | 3 | obj-m += snd-dice.o |
diff --git a/sound/firewire/dice/dice-proc.c b/sound/firewire/dice/dice-proc.c new file mode 100644 index 000000000000..f5c1d1bced59 --- /dev/null +++ b/sound/firewire/dice/dice-proc.c | |||
@@ -0,0 +1,252 @@ | |||
1 | /* | ||
2 | * dice_proc.c - a part of driver for Dice based devices | ||
3 | * | ||
4 | * Copyright (c) Clemens Ladisch | ||
5 | * Copyright (c) 2014 Takashi Sakamoto | ||
6 | * | ||
7 | * Licensed under the terms of the GNU General Public License, version 2. | ||
8 | */ | ||
9 | |||
10 | #include "dice.h" | ||
11 | |||
12 | static int dice_proc_read_mem(struct snd_dice *dice, void *buffer, | ||
13 | unsigned int offset_q, unsigned int quadlets) | ||
14 | { | ||
15 | unsigned int i; | ||
16 | int err; | ||
17 | |||
18 | err = snd_fw_transaction(dice->unit, TCODE_READ_BLOCK_REQUEST, | ||
19 | DICE_PRIVATE_SPACE + 4 * offset_q, | ||
20 | buffer, 4 * quadlets, 0); | ||
21 | if (err < 0) | ||
22 | return err; | ||
23 | |||
24 | for (i = 0; i < quadlets; ++i) | ||
25 | be32_to_cpus(&((u32 *)buffer)[i]); | ||
26 | |||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static const char *str_from_array(const char *const strs[], unsigned int count, | ||
31 | unsigned int i) | ||
32 | { | ||
33 | if (i < count) | ||
34 | return strs[i]; | ||
35 | |||
36 | return "(unknown)"; | ||
37 | } | ||
38 | |||
39 | static void dice_proc_fixup_string(char *s, unsigned int size) | ||
40 | { | ||
41 | unsigned int i; | ||
42 | |||
43 | for (i = 0; i < size; i += 4) | ||
44 | cpu_to_le32s((u32 *)(s + i)); | ||
45 | |||
46 | for (i = 0; i < size - 2; ++i) { | ||
47 | if (s[i] == '\0') | ||
48 | return; | ||
49 | if (s[i] == '\\' && s[i + 1] == '\\') { | ||
50 | s[i + 2] = '\0'; | ||
51 | return; | ||
52 | } | ||
53 | } | ||
54 | s[size - 1] = '\0'; | ||
55 | } | ||
56 | |||
57 | static void dice_proc_read(struct snd_info_entry *entry, | ||
58 | struct snd_info_buffer *buffer) | ||
59 | { | ||
60 | static const char *const section_names[5] = { | ||
61 | "global", "tx", "rx", "ext_sync", "unused2" | ||
62 | }; | ||
63 | static const char *const clock_sources[] = { | ||
64 | "aes1", "aes2", "aes3", "aes4", "aes", "adat", "tdif", | ||
65 | "wc", "arx1", "arx2", "arx3", "arx4", "internal" | ||
66 | }; | ||
67 | static const char *const rates[] = { | ||
68 | "32000", "44100", "48000", "88200", "96000", "176400", "192000", | ||
69 | "any low", "any mid", "any high", "none" | ||
70 | }; | ||
71 | struct snd_dice *dice = entry->private_data; | ||
72 | u32 sections[ARRAY_SIZE(section_names) * 2]; | ||
73 | struct { | ||
74 | u32 number; | ||
75 | u32 size; | ||
76 | } tx_rx_header; | ||
77 | union { | ||
78 | struct { | ||
79 | u32 owner_hi, owner_lo; | ||
80 | u32 notification; | ||
81 | char nick_name[NICK_NAME_SIZE]; | ||
82 | u32 clock_select; | ||
83 | u32 enable; | ||
84 | u32 status; | ||
85 | u32 extended_status; | ||
86 | u32 sample_rate; | ||
87 | u32 version; | ||
88 | u32 clock_caps; | ||
89 | char clock_source_names[CLOCK_SOURCE_NAMES_SIZE]; | ||
90 | } global; | ||
91 | struct { | ||
92 | u32 iso; | ||
93 | u32 number_audio; | ||
94 | u32 number_midi; | ||
95 | u32 speed; | ||
96 | char names[TX_NAMES_SIZE]; | ||
97 | u32 ac3_caps; | ||
98 | u32 ac3_enable; | ||
99 | } tx; | ||
100 | struct { | ||
101 | u32 iso; | ||
102 | u32 seq_start; | ||
103 | u32 number_audio; | ||
104 | u32 number_midi; | ||
105 | char names[RX_NAMES_SIZE]; | ||
106 | u32 ac3_caps; | ||
107 | u32 ac3_enable; | ||
108 | } rx; | ||
109 | struct { | ||
110 | u32 clock_source; | ||
111 | u32 locked; | ||
112 | u32 rate; | ||
113 | u32 adat_user_data; | ||
114 | } ext_sync; | ||
115 | } buf; | ||
116 | unsigned int quadlets, stream, i; | ||
117 | |||
118 | if (dice_proc_read_mem(dice, sections, 0, ARRAY_SIZE(sections)) < 0) | ||
119 | return; | ||
120 | snd_iprintf(buffer, "sections:\n"); | ||
121 | for (i = 0; i < ARRAY_SIZE(section_names); ++i) | ||
122 | snd_iprintf(buffer, " %s: offset %u, size %u\n", | ||
123 | section_names[i], | ||
124 | sections[i * 2], sections[i * 2 + 1]); | ||
125 | |||
126 | quadlets = min_t(u32, sections[1], sizeof(buf.global) / 4); | ||
127 | if (dice_proc_read_mem(dice, &buf.global, sections[0], quadlets) < 0) | ||
128 | return; | ||
129 | snd_iprintf(buffer, "global:\n"); | ||
130 | snd_iprintf(buffer, " owner: %04x:%04x%08x\n", | ||
131 | buf.global.owner_hi >> 16, | ||
132 | buf.global.owner_hi & 0xffff, buf.global.owner_lo); | ||
133 | snd_iprintf(buffer, " notification: %08x\n", buf.global.notification); | ||
134 | dice_proc_fixup_string(buf.global.nick_name, NICK_NAME_SIZE); | ||
135 | snd_iprintf(buffer, " nick name: %s\n", buf.global.nick_name); | ||
136 | snd_iprintf(buffer, " clock select: %s %s\n", | ||
137 | str_from_array(clock_sources, ARRAY_SIZE(clock_sources), | ||
138 | buf.global.clock_select & CLOCK_SOURCE_MASK), | ||
139 | str_from_array(rates, ARRAY_SIZE(rates), | ||
140 | (buf.global.clock_select & CLOCK_RATE_MASK) | ||
141 | >> CLOCK_RATE_SHIFT)); | ||
142 | snd_iprintf(buffer, " enable: %u\n", buf.global.enable); | ||
143 | snd_iprintf(buffer, " status: %slocked %s\n", | ||
144 | buf.global.status & STATUS_SOURCE_LOCKED ? "" : "un", | ||
145 | str_from_array(rates, ARRAY_SIZE(rates), | ||
146 | (buf.global.status & | ||
147 | STATUS_NOMINAL_RATE_MASK) | ||
148 | >> CLOCK_RATE_SHIFT)); | ||
149 | snd_iprintf(buffer, " ext status: %08x\n", buf.global.extended_status); | ||
150 | snd_iprintf(buffer, " sample rate: %u\n", buf.global.sample_rate); | ||
151 | snd_iprintf(buffer, " version: %u.%u.%u.%u\n", | ||
152 | (buf.global.version >> 24) & 0xff, | ||
153 | (buf.global.version >> 16) & 0xff, | ||
154 | (buf.global.version >> 8) & 0xff, | ||
155 | (buf.global.version >> 0) & 0xff); | ||
156 | if (quadlets >= 90) { | ||
157 | snd_iprintf(buffer, " clock caps:"); | ||
158 | for (i = 0; i <= 6; ++i) | ||
159 | if (buf.global.clock_caps & (1 << i)) | ||
160 | snd_iprintf(buffer, " %s", rates[i]); | ||
161 | for (i = 0; i <= 12; ++i) | ||
162 | if (buf.global.clock_caps & (1 << (16 + i))) | ||
163 | snd_iprintf(buffer, " %s", clock_sources[i]); | ||
164 | snd_iprintf(buffer, "\n"); | ||
165 | dice_proc_fixup_string(buf.global.clock_source_names, | ||
166 | CLOCK_SOURCE_NAMES_SIZE); | ||
167 | snd_iprintf(buffer, " clock source names: %s\n", | ||
168 | buf.global.clock_source_names); | ||
169 | } | ||
170 | |||
171 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0) | ||
172 | return; | ||
173 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx) / 4); | ||
174 | for (stream = 0; stream < tx_rx_header.number; ++stream) { | ||
175 | if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 + | ||
176 | stream * tx_rx_header.size, | ||
177 | quadlets) < 0) | ||
178 | break; | ||
179 | snd_iprintf(buffer, "tx %u:\n", stream); | ||
180 | snd_iprintf(buffer, " iso channel: %d\n", (int)buf.tx.iso); | ||
181 | snd_iprintf(buffer, " audio channels: %u\n", | ||
182 | buf.tx.number_audio); | ||
183 | snd_iprintf(buffer, " midi ports: %u\n", buf.tx.number_midi); | ||
184 | snd_iprintf(buffer, " speed: S%u\n", 100u << buf.tx.speed); | ||
185 | if (quadlets >= 68) { | ||
186 | dice_proc_fixup_string(buf.tx.names, TX_NAMES_SIZE); | ||
187 | snd_iprintf(buffer, " names: %s\n", buf.tx.names); | ||
188 | } | ||
189 | if (quadlets >= 70) { | ||
190 | snd_iprintf(buffer, " ac3 caps: %08x\n", | ||
191 | buf.tx.ac3_caps); | ||
192 | snd_iprintf(buffer, " ac3 enable: %08x\n", | ||
193 | buf.tx.ac3_enable); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0) | ||
198 | return; | ||
199 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx) / 4); | ||
200 | for (stream = 0; stream < tx_rx_header.number; ++stream) { | ||
201 | if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 + | ||
202 | stream * tx_rx_header.size, | ||
203 | quadlets) < 0) | ||
204 | break; | ||
205 | snd_iprintf(buffer, "rx %u:\n", stream); | ||
206 | snd_iprintf(buffer, " iso channel: %d\n", (int)buf.rx.iso); | ||
207 | snd_iprintf(buffer, " sequence start: %u\n", buf.rx.seq_start); | ||
208 | snd_iprintf(buffer, " audio channels: %u\n", | ||
209 | buf.rx.number_audio); | ||
210 | snd_iprintf(buffer, " midi ports: %u\n", buf.rx.number_midi); | ||
211 | if (quadlets >= 68) { | ||
212 | dice_proc_fixup_string(buf.rx.names, RX_NAMES_SIZE); | ||
213 | snd_iprintf(buffer, " names: %s\n", buf.rx.names); | ||
214 | } | ||
215 | if (quadlets >= 70) { | ||
216 | snd_iprintf(buffer, " ac3 caps: %08x\n", | ||
217 | buf.rx.ac3_caps); | ||
218 | snd_iprintf(buffer, " ac3 enable: %08x\n", | ||
219 | buf.rx.ac3_enable); | ||
220 | } | ||
221 | } | ||
222 | |||
223 | quadlets = min_t(u32, sections[7], sizeof(buf.ext_sync) / 4); | ||
224 | if (quadlets >= 4) { | ||
225 | if (dice_proc_read_mem(dice, &buf.ext_sync, | ||
226 | sections[6], 4) < 0) | ||
227 | return; | ||
228 | snd_iprintf(buffer, "ext status:\n"); | ||
229 | snd_iprintf(buffer, " clock source: %s\n", | ||
230 | str_from_array(clock_sources, | ||
231 | ARRAY_SIZE(clock_sources), | ||
232 | buf.ext_sync.clock_source)); | ||
233 | snd_iprintf(buffer, " locked: %u\n", buf.ext_sync.locked); | ||
234 | snd_iprintf(buffer, " rate: %s\n", | ||
235 | str_from_array(rates, ARRAY_SIZE(rates), | ||
236 | buf.ext_sync.rate)); | ||
237 | snd_iprintf(buffer, " adat user data: "); | ||
238 | if (buf.ext_sync.adat_user_data & ADAT_USER_DATA_NO_DATA) | ||
239 | snd_iprintf(buffer, "-\n"); | ||
240 | else | ||
241 | snd_iprintf(buffer, "%x\n", | ||
242 | buf.ext_sync.adat_user_data); | ||
243 | } | ||
244 | } | ||
245 | |||
246 | void snd_dice_create_proc(struct snd_dice *dice) | ||
247 | { | ||
248 | struct snd_info_entry *entry; | ||
249 | |||
250 | if (!snd_card_proc_new(dice->card, "dice", &entry)) | ||
251 | snd_info_set_text_ops(entry, dice, dice_proc_read); | ||
252 | } | ||
diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index dbc1239c95ee..8e2c172de8a7 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c | |||
@@ -11,248 +11,6 @@ MODULE_DESCRIPTION("DICE driver"); | |||
11 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 11 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
12 | MODULE_LICENSE("GPL v2"); | 12 | MODULE_LICENSE("GPL v2"); |
13 | 13 | ||
14 | static int dice_proc_read_mem(struct snd_dice *dice, void *buffer, | ||
15 | unsigned int offset_q, unsigned int quadlets) | ||
16 | { | ||
17 | unsigned int i; | ||
18 | int err; | ||
19 | |||
20 | err = snd_fw_transaction(dice->unit, TCODE_READ_BLOCK_REQUEST, | ||
21 | DICE_PRIVATE_SPACE + 4 * offset_q, | ||
22 | buffer, 4 * quadlets, 0); | ||
23 | if (err < 0) | ||
24 | return err; | ||
25 | |||
26 | for (i = 0; i < quadlets; ++i) | ||
27 | be32_to_cpus(&((u32 *)buffer)[i]); | ||
28 | |||
29 | return 0; | ||
30 | } | ||
31 | |||
32 | static const char *str_from_array(const char *const strs[], unsigned int count, | ||
33 | unsigned int i) | ||
34 | { | ||
35 | if (i < count) | ||
36 | return strs[i]; | ||
37 | |||
38 | return "(unknown)"; | ||
39 | } | ||
40 | |||
41 | static void dice_proc_fixup_string(char *s, unsigned int size) | ||
42 | { | ||
43 | unsigned int i; | ||
44 | |||
45 | for (i = 0; i < size; i += 4) | ||
46 | cpu_to_le32s((u32 *)(s + i)); | ||
47 | |||
48 | for (i = 0; i < size - 2; ++i) { | ||
49 | if (s[i] == '\0') | ||
50 | return; | ||
51 | if (s[i] == '\\' && s[i + 1] == '\\') { | ||
52 | s[i + 2] = '\0'; | ||
53 | return; | ||
54 | } | ||
55 | } | ||
56 | s[size - 1] = '\0'; | ||
57 | } | ||
58 | |||
59 | static void dice_proc_read(struct snd_info_entry *entry, | ||
60 | struct snd_info_buffer *buffer) | ||
61 | { | ||
62 | static const char *const section_names[5] = { | ||
63 | "global", "tx", "rx", "ext_sync", "unused2" | ||
64 | }; | ||
65 | static const char *const clock_sources[] = { | ||
66 | "aes1", "aes2", "aes3", "aes4", "aes", "adat", "tdif", | ||
67 | "wc", "arx1", "arx2", "arx3", "arx4", "internal" | ||
68 | }; | ||
69 | static const char *const rates[] = { | ||
70 | "32000", "44100", "48000", "88200", "96000", "176400", "192000", | ||
71 | "any low", "any mid", "any high", "none" | ||
72 | }; | ||
73 | struct snd_dice *dice = entry->private_data; | ||
74 | u32 sections[ARRAY_SIZE(section_names) * 2]; | ||
75 | struct { | ||
76 | u32 number; | ||
77 | u32 size; | ||
78 | } tx_rx_header; | ||
79 | union { | ||
80 | struct { | ||
81 | u32 owner_hi, owner_lo; | ||
82 | u32 notification; | ||
83 | char nick_name[NICK_NAME_SIZE]; | ||
84 | u32 clock_select; | ||
85 | u32 enable; | ||
86 | u32 status; | ||
87 | u32 extended_status; | ||
88 | u32 sample_rate; | ||
89 | u32 version; | ||
90 | u32 clock_caps; | ||
91 | char clock_source_names[CLOCK_SOURCE_NAMES_SIZE]; | ||
92 | } global; | ||
93 | struct { | ||
94 | u32 iso; | ||
95 | u32 number_audio; | ||
96 | u32 number_midi; | ||
97 | u32 speed; | ||
98 | char names[TX_NAMES_SIZE]; | ||
99 | u32 ac3_caps; | ||
100 | u32 ac3_enable; | ||
101 | } tx; | ||
102 | struct { | ||
103 | u32 iso; | ||
104 | u32 seq_start; | ||
105 | u32 number_audio; | ||
106 | u32 number_midi; | ||
107 | char names[RX_NAMES_SIZE]; | ||
108 | u32 ac3_caps; | ||
109 | u32 ac3_enable; | ||
110 | } rx; | ||
111 | struct { | ||
112 | u32 clock_source; | ||
113 | u32 locked; | ||
114 | u32 rate; | ||
115 | u32 adat_user_data; | ||
116 | } ext_sync; | ||
117 | } buf; | ||
118 | unsigned int quadlets, stream, i; | ||
119 | |||
120 | if (dice_proc_read_mem(dice, sections, 0, ARRAY_SIZE(sections)) < 0) | ||
121 | return; | ||
122 | snd_iprintf(buffer, "sections:\n"); | ||
123 | for (i = 0; i < ARRAY_SIZE(section_names); ++i) | ||
124 | snd_iprintf(buffer, " %s: offset %u, size %u\n", | ||
125 | section_names[i], | ||
126 | sections[i * 2], sections[i * 2 + 1]); | ||
127 | |||
128 | quadlets = min_t(u32, sections[1], sizeof(buf.global) / 4); | ||
129 | if (dice_proc_read_mem(dice, &buf.global, sections[0], quadlets) < 0) | ||
130 | return; | ||
131 | snd_iprintf(buffer, "global:\n"); | ||
132 | snd_iprintf(buffer, " owner: %04x:%04x%08x\n", | ||
133 | buf.global.owner_hi >> 16, | ||
134 | buf.global.owner_hi & 0xffff, buf.global.owner_lo); | ||
135 | snd_iprintf(buffer, " notification: %08x\n", buf.global.notification); | ||
136 | dice_proc_fixup_string(buf.global.nick_name, NICK_NAME_SIZE); | ||
137 | snd_iprintf(buffer, " nick name: %s\n", buf.global.nick_name); | ||
138 | snd_iprintf(buffer, " clock select: %s %s\n", | ||
139 | str_from_array(clock_sources, ARRAY_SIZE(clock_sources), | ||
140 | buf.global.clock_select & CLOCK_SOURCE_MASK), | ||
141 | str_from_array(rates, ARRAY_SIZE(rates), | ||
142 | (buf.global.clock_select & CLOCK_RATE_MASK) | ||
143 | >> CLOCK_RATE_SHIFT)); | ||
144 | snd_iprintf(buffer, " enable: %u\n", buf.global.enable); | ||
145 | snd_iprintf(buffer, " status: %slocked %s\n", | ||
146 | buf.global.status & STATUS_SOURCE_LOCKED ? "" : "un", | ||
147 | str_from_array(rates, ARRAY_SIZE(rates), | ||
148 | (buf.global.status & | ||
149 | STATUS_NOMINAL_RATE_MASK) | ||
150 | >> CLOCK_RATE_SHIFT)); | ||
151 | snd_iprintf(buffer, " ext status: %08x\n", buf.global.extended_status); | ||
152 | snd_iprintf(buffer, " sample rate: %u\n", buf.global.sample_rate); | ||
153 | snd_iprintf(buffer, " version: %u.%u.%u.%u\n", | ||
154 | (buf.global.version >> 24) & 0xff, | ||
155 | (buf.global.version >> 16) & 0xff, | ||
156 | (buf.global.version >> 8) & 0xff, | ||
157 | (buf.global.version >> 0) & 0xff); | ||
158 | if (quadlets >= 90) { | ||
159 | snd_iprintf(buffer, " clock caps:"); | ||
160 | for (i = 0; i <= 6; ++i) | ||
161 | if (buf.global.clock_caps & (1 << i)) | ||
162 | snd_iprintf(buffer, " %s", rates[i]); | ||
163 | for (i = 0; i <= 12; ++i) | ||
164 | if (buf.global.clock_caps & (1 << (16 + i))) | ||
165 | snd_iprintf(buffer, " %s", clock_sources[i]); | ||
166 | snd_iprintf(buffer, "\n"); | ||
167 | dice_proc_fixup_string(buf.global.clock_source_names, | ||
168 | CLOCK_SOURCE_NAMES_SIZE); | ||
169 | snd_iprintf(buffer, " clock source names: %s\n", | ||
170 | buf.global.clock_source_names); | ||
171 | } | ||
172 | |||
173 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0) | ||
174 | return; | ||
175 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx) / 4); | ||
176 | for (stream = 0; stream < tx_rx_header.number; ++stream) { | ||
177 | if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 + | ||
178 | stream * tx_rx_header.size, | ||
179 | quadlets) < 0) | ||
180 | break; | ||
181 | snd_iprintf(buffer, "tx %u:\n", stream); | ||
182 | snd_iprintf(buffer, " iso channel: %d\n", (int)buf.tx.iso); | ||
183 | snd_iprintf(buffer, " audio channels: %u\n", | ||
184 | buf.tx.number_audio); | ||
185 | snd_iprintf(buffer, " midi ports: %u\n", buf.tx.number_midi); | ||
186 | snd_iprintf(buffer, " speed: S%u\n", 100u << buf.tx.speed); | ||
187 | if (quadlets >= 68) { | ||
188 | dice_proc_fixup_string(buf.tx.names, TX_NAMES_SIZE); | ||
189 | snd_iprintf(buffer, " names: %s\n", buf.tx.names); | ||
190 | } | ||
191 | if (quadlets >= 70) { | ||
192 | snd_iprintf(buffer, " ac3 caps: %08x\n", | ||
193 | buf.tx.ac3_caps); | ||
194 | snd_iprintf(buffer, " ac3 enable: %08x\n", | ||
195 | buf.tx.ac3_enable); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0) | ||
200 | return; | ||
201 | quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx) / 4); | ||
202 | for (stream = 0; stream < tx_rx_header.number; ++stream) { | ||
203 | if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 + | ||
204 | stream * tx_rx_header.size, | ||
205 | quadlets) < 0) | ||
206 | break; | ||
207 | snd_iprintf(buffer, "rx %u:\n", stream); | ||
208 | snd_iprintf(buffer, " iso channel: %d\n", (int)buf.rx.iso); | ||
209 | snd_iprintf(buffer, " sequence start: %u\n", buf.rx.seq_start); | ||
210 | snd_iprintf(buffer, " audio channels: %u\n", | ||
211 | buf.rx.number_audio); | ||
212 | snd_iprintf(buffer, " midi ports: %u\n", buf.rx.number_midi); | ||
213 | if (quadlets >= 68) { | ||
214 | dice_proc_fixup_string(buf.rx.names, RX_NAMES_SIZE); | ||
215 | snd_iprintf(buffer, " names: %s\n", buf.rx.names); | ||
216 | } | ||
217 | if (quadlets >= 70) { | ||
218 | snd_iprintf(buffer, " ac3 caps: %08x\n", | ||
219 | buf.rx.ac3_caps); | ||
220 | snd_iprintf(buffer, " ac3 enable: %08x\n", | ||
221 | buf.rx.ac3_enable); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | quadlets = min_t(u32, sections[7], sizeof(buf.ext_sync) / 4); | ||
226 | if (quadlets >= 4) { | ||
227 | if (dice_proc_read_mem(dice, &buf.ext_sync, | ||
228 | sections[6], 4) < 0) | ||
229 | return; | ||
230 | snd_iprintf(buffer, "ext status:\n"); | ||
231 | snd_iprintf(buffer, " clock source: %s\n", | ||
232 | str_from_array(clock_sources, | ||
233 | ARRAY_SIZE(clock_sources), | ||
234 | buf.ext_sync.clock_source)); | ||
235 | snd_iprintf(buffer, " locked: %u\n", buf.ext_sync.locked); | ||
236 | snd_iprintf(buffer, " rate: %s\n", | ||
237 | str_from_array(rates, ARRAY_SIZE(rates), | ||
238 | buf.ext_sync.rate)); | ||
239 | snd_iprintf(buffer, " adat user data: "); | ||
240 | if (buf.ext_sync.adat_user_data & ADAT_USER_DATA_NO_DATA) | ||
241 | snd_iprintf(buffer, "-\n"); | ||
242 | else | ||
243 | snd_iprintf(buffer, "%x\n", | ||
244 | buf.ext_sync.adat_user_data); | ||
245 | } | ||
246 | } | ||
247 | |||
248 | static void dice_create_proc(struct snd_dice *dice) | ||
249 | { | ||
250 | struct snd_info_entry *entry; | ||
251 | |||
252 | if (!snd_card_proc_new(dice->card, "dice", &entry)) | ||
253 | snd_info_set_text_ops(entry, dice, dice_proc_read); | ||
254 | } | ||
255 | |||
256 | #define OUI_WEISS 0x001c6a | 14 | #define OUI_WEISS 0x001c6a |
257 | 15 | ||
258 | #define DICE_CATEGORY_ID 0x04 | 16 | #define DICE_CATEGORY_ID 0x04 |
@@ -520,7 +278,7 @@ static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) | |||
520 | if (err < 0) | 278 | if (err < 0) |
521 | goto error; | 279 | goto error; |
522 | 280 | ||
523 | dice_create_proc(dice); | 281 | snd_dice_create_proc(dice); |
524 | 282 | ||
525 | err = snd_dice_stream_init(dice); | 283 | err = snd_dice_stream_init(dice); |
526 | if (err < 0) | 284 | if (err < 0) |
diff --git a/sound/firewire/dice/dice.h b/sound/firewire/dice/dice.h index dcc8c789cd43..969189a6604f 100644 --- a/sound/firewire/dice/dice.h +++ b/sound/firewire/dice/dice.h | |||
@@ -175,4 +175,6 @@ int snd_dice_create_pcm(struct snd_dice *dice); | |||
175 | 175 | ||
176 | int snd_dice_create_hwdep(struct snd_dice *dice); | 176 | int snd_dice_create_hwdep(struct snd_dice *dice); |
177 | 177 | ||
178 | void snd_dice_create_proc(struct snd_dice *dice); | ||
179 | |||
178 | #endif | 180 | #endif |