1 // SPDX-License-Identifier: GPL-2.0-only
3 * oxfw_proc.c - a part of driver for OXFW970/971 based devices
5 * Copyright (c) 2014 Takashi Sakamoto
10 static void proc_read_formation(struct snd_info_entry
*entry
,
11 struct snd_info_buffer
*buffer
)
13 struct snd_oxfw
*oxfw
= entry
->private_data
;
14 struct snd_oxfw_stream_formation formation
, curr
;
20 err
= snd_oxfw_stream_get_current_formation(oxfw
,
21 AVC_GENERAL_PLUG_DIR_IN
,
26 snd_iprintf(buffer
, "Input Stream to device:\n");
27 snd_iprintf(buffer
, "\tRate\tPCM\tMIDI\n");
28 for (i
= 0; i
< SND_OXFW_STREAM_FORMAT_ENTRIES
; i
++) {
29 format
= oxfw
->rx_stream_formats
[i
];
33 err
= snd_oxfw_stream_parse_format(format
, &formation
);
37 if (memcmp(&formation
, &curr
, sizeof(curr
)) == 0)
42 snd_iprintf(buffer
, "%c\t%d\t%d\t%d\n", flag
,
43 formation
.rate
, formation
.pcm
, formation
.midi
);
46 if (!oxfw
->has_output
)
50 err
= snd_oxfw_stream_get_current_formation(oxfw
,
51 AVC_GENERAL_PLUG_DIR_OUT
,
56 snd_iprintf(buffer
, "Output Stream from device:\n");
57 snd_iprintf(buffer
, "\tRate\tPCM\tMIDI\n");
58 for (i
= 0; i
< SND_OXFW_STREAM_FORMAT_ENTRIES
; i
++) {
59 format
= oxfw
->tx_stream_formats
[i
];
63 err
= snd_oxfw_stream_parse_format(format
, &formation
);
67 if (memcmp(&formation
, &curr
, sizeof(curr
)) == 0)
72 snd_iprintf(buffer
, "%c\t%d\t%d\t%d\n", flag
,
73 formation
.rate
, formation
.pcm
, formation
.midi
);
77 static void add_node(struct snd_oxfw
*oxfw
, struct snd_info_entry
*root
,
79 void (*op
)(struct snd_info_entry
*e
,
80 struct snd_info_buffer
*b
))
82 struct snd_info_entry
*entry
;
84 entry
= snd_info_create_card_entry(oxfw
->card
, name
, root
);
86 snd_info_set_text_ops(entry
, oxfw
, op
);
89 void snd_oxfw_proc_init(struct snd_oxfw
*oxfw
)
91 struct snd_info_entry
*root
;
94 * All nodes are automatically removed at snd_card_disconnect(),
95 * by following to link list.
97 root
= snd_info_create_card_entry(oxfw
->card
, "firewire",
98 oxfw
->card
->proc_root
);
101 root
->mode
= S_IFDIR
| 0555;
103 add_node(oxfw
, root
, "formation", proc_read_formation
);