aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/dice/dice-proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/firewire/dice/dice-proc.c')
-rw-r--r--sound/firewire/dice/dice-proc.c80
1 files changed, 72 insertions, 8 deletions
diff --git a/sound/firewire/dice/dice-proc.c b/sound/firewire/dice/dice-proc.c
index f5c1d1bced59..bb870fc73f99 100644
--- a/sound/firewire/dice/dice-proc.c
+++ b/sound/firewire/dice/dice-proc.c
@@ -148,12 +148,12 @@ static void dice_proc_read(struct snd_info_entry *entry,
148 >> CLOCK_RATE_SHIFT)); 148 >> CLOCK_RATE_SHIFT));
149 snd_iprintf(buffer, " ext status: %08x\n", buf.global.extended_status); 149 snd_iprintf(buffer, " ext status: %08x\n", buf.global.extended_status);
150 snd_iprintf(buffer, " sample rate: %u\n", buf.global.sample_rate); 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) { 151 if (quadlets >= 90) {
152 snd_iprintf(buffer, " version: %u.%u.%u.%u\n",
153 (buf.global.version >> 24) & 0xff,
154 (buf.global.version >> 16) & 0xff,
155 (buf.global.version >> 8) & 0xff,
156 (buf.global.version >> 0) & 0xff);
157 snd_iprintf(buffer, " clock caps:"); 157 snd_iprintf(buffer, " clock caps:");
158 for (i = 0; i <= 6; ++i) 158 for (i = 0; i <= 6; ++i)
159 if (buf.global.clock_caps & (1 << i)) 159 if (buf.global.clock_caps & (1 << i))
@@ -243,10 +243,74 @@ static void dice_proc_read(struct snd_info_entry *entry,
243 } 243 }
244} 244}
245 245
246void snd_dice_create_proc(struct snd_dice *dice) 246static void dice_proc_read_formation(struct snd_info_entry *entry,
247 struct snd_info_buffer *buffer)
248{
249 static const char *const rate_labels[] = {
250 [SND_DICE_RATE_MODE_LOW] = "low",
251 [SND_DICE_RATE_MODE_MIDDLE] = "middle",
252 [SND_DICE_RATE_MODE_HIGH] = "high",
253 };
254 struct snd_dice *dice = entry->private_data;
255 int i, j;
256
257 snd_iprintf(buffer, "Output stream from unit:\n");
258 for (i = 0; i < SND_DICE_RATE_MODE_COUNT; ++i)
259 snd_iprintf(buffer, "\t%s", rate_labels[i]);
260 snd_iprintf(buffer, "\tMIDI\n");
261 for (i = 0; i < MAX_STREAMS; ++i) {
262 snd_iprintf(buffer, "Tx %u:", i);
263 for (j = 0; j < SND_DICE_RATE_MODE_COUNT; ++j)
264 snd_iprintf(buffer, "\t%u", dice->tx_pcm_chs[i][j]);
265 snd_iprintf(buffer, "\t%u\n", dice->tx_midi_ports[i]);
266 }
267
268 snd_iprintf(buffer, "Input stream to unit:\n");
269 for (i = 0; i < SND_DICE_RATE_MODE_COUNT; ++i)
270 snd_iprintf(buffer, "\t%s", rate_labels[i]);
271 snd_iprintf(buffer, "\n");
272 for (i = 0; i < MAX_STREAMS; ++i) {
273 snd_iprintf(buffer, "Rx %u:", i);
274 for (j = 0; j < SND_DICE_RATE_MODE_COUNT; ++j)
275 snd_iprintf(buffer, "\t%u", dice->rx_pcm_chs[i][j]);
276 snd_iprintf(buffer, "\t%u\n", dice->rx_midi_ports[i]);
277 }
278}
279
280static void add_node(struct snd_dice *dice, struct snd_info_entry *root,
281 const char *name,
282 void (*op)(struct snd_info_entry *entry,
283 struct snd_info_buffer *buffer))
247{ 284{
248 struct snd_info_entry *entry; 285 struct snd_info_entry *entry;
249 286
250 if (!snd_card_proc_new(dice->card, "dice", &entry)) 287 entry = snd_info_create_card_entry(dice->card, name, root);
251 snd_info_set_text_ops(entry, dice, dice_proc_read); 288 if (!entry)
289 return;
290
291 snd_info_set_text_ops(entry, dice, op);
292 if (snd_info_register(entry) < 0)
293 snd_info_free_entry(entry);
294}
295
296void snd_dice_create_proc(struct snd_dice *dice)
297{
298 struct snd_info_entry *root;
299
300 /*
301 * All nodes are automatically removed at snd_card_disconnect(),
302 * by following to link list.
303 */
304 root = snd_info_create_card_entry(dice->card, "firewire",
305 dice->card->proc_root);
306 if (!root)
307 return;
308 root->mode = S_IFDIR | 0555;
309 if (snd_info_register(root) < 0) {
310 snd_info_free_entry(root);
311 return;
312 }
313
314 add_node(dice, root, "dice", dice_proc_read);
315 add_node(dice, root, "formation", dice_proc_read_formation);
252} 316}