2 * oxfw_proc.c - a part of driver for OXFW970/971 based devices
4 * Copyright (c) 2014 Takashi Sakamoto
6 * Licensed under the terms of the GNU General Public License, version 2.
11 static void proc_read_formation(struct snd_info_entry
*entry
,
12 struct snd_info_buffer
*buffer
)
14 struct snd_oxfw
*oxfw
= entry
->private_data
;
15 struct snd_oxfw_stream_formation formation
, curr
;
21 err
= snd_oxfw_stream_get_current_formation(oxfw
,
22 AVC_GENERAL_PLUG_DIR_IN
,
27 snd_iprintf(buffer
, "Input Stream to device:\n");
28 snd_iprintf(buffer
, "\tRate\tPCM\tMIDI\n");
29 for (i
= 0; i
< SND_OXFW_STREAM_FORMAT_ENTRIES
; i
++) {
30 format
= oxfw
->rx_stream_formats
[i
];
34 err
= snd_oxfw_stream_parse_format(format
, &formation
);
38 if (memcmp(&formation
, &curr
, sizeof(curr
)) == 0)
43 snd_iprintf(buffer
, "%c\t%d\t%d\t%d\n", flag
,
44 formation
.rate
, formation
.pcm
, formation
.midi
);
47 if (!oxfw
->has_output
)
51 err
= snd_oxfw_stream_get_current_formation(oxfw
,
52 AVC_GENERAL_PLUG_DIR_OUT
,
57 snd_iprintf(buffer
, "Output Stream from device:\n");
58 snd_iprintf(buffer
, "\tRate\tPCM\tMIDI\n");
59 for (i
= 0; i
< SND_OXFW_STREAM_FORMAT_ENTRIES
; i
++) {
60 format
= oxfw
->tx_stream_formats
[i
];
64 err
= snd_oxfw_stream_parse_format(format
, &formation
);
68 if (memcmp(&formation
, &curr
, sizeof(curr
)) == 0)
73 snd_iprintf(buffer
, "%c\t%d\t%d\t%d\n", flag
,
74 formation
.rate
, formation
.pcm
, formation
.midi
);
78 static void add_node(struct snd_oxfw
*oxfw
, struct snd_info_entry
*root
,
80 void (*op
)(struct snd_info_entry
*e
,
81 struct snd_info_buffer
*b
))
83 struct snd_info_entry
*entry
;
85 entry
= snd_info_create_card_entry(oxfw
->card
, name
, root
);
89 snd_info_set_text_ops(entry
, oxfw
, op
);
90 if (snd_info_register(entry
) < 0)
91 snd_info_free_entry(entry
);
94 void snd_oxfw_proc_init(struct snd_oxfw
*oxfw
)
96 struct snd_info_entry
*root
;
99 * All nodes are automatically removed at snd_card_disconnect(),
100 * by following to link list.
102 root
= snd_info_create_card_entry(oxfw
->card
, "firewire",
103 oxfw
->card
->proc_root
);
106 root
->mode
= S_IFDIR
| S_IRUGO
| S_IXUGO
;
107 if (snd_info_register(root
) < 0) {
108 snd_info_free_entry(root
);
112 add_node(oxfw
, root
, "formation", proc_read_formation
);