hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/sound/usb/proc.c
....@@ -1,18 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License as published by
4
- * the Free Software Foundation; either version 2 of the License, or
5
- * (at your option) any later version.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software
14
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
- *
163 */
174
185 #include <linux/init.h>
....@@ -61,12 +48,43 @@
6148
6249 void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
6350 {
64
- struct snd_info_entry *entry;
65
- if (!snd_card_proc_new(chip->card, "usbbus", &entry))
66
- snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read);
67
- if (!snd_card_proc_new(chip->card, "usbid", &entry))
68
- snd_info_set_text_ops(entry, chip, proc_audio_usbid_read);
51
+ snd_card_ro_proc_new(chip->card, "usbbus", chip,
52
+ proc_audio_usbbus_read);
53
+ snd_card_ro_proc_new(chip->card, "usbid", chip,
54
+ proc_audio_usbid_read);
6955 }
56
+
57
+static const char * const channel_labels[] = {
58
+ [SNDRV_CHMAP_NA] = "N/A",
59
+ [SNDRV_CHMAP_MONO] = "MONO",
60
+ [SNDRV_CHMAP_FL] = "FL",
61
+ [SNDRV_CHMAP_FR] = "FR",
62
+ [SNDRV_CHMAP_FC] = "FC",
63
+ [SNDRV_CHMAP_LFE] = "LFE",
64
+ [SNDRV_CHMAP_RL] = "RL",
65
+ [SNDRV_CHMAP_RR] = "RR",
66
+ [SNDRV_CHMAP_FLC] = "FLC",
67
+ [SNDRV_CHMAP_FRC] = "FRC",
68
+ [SNDRV_CHMAP_RC] = "RC",
69
+ [SNDRV_CHMAP_SL] = "SL",
70
+ [SNDRV_CHMAP_SR] = "SR",
71
+ [SNDRV_CHMAP_TC] = "TC",
72
+ [SNDRV_CHMAP_TFL] = "TFL",
73
+ [SNDRV_CHMAP_TFC] = "TFC",
74
+ [SNDRV_CHMAP_TFR] = "TFR",
75
+ [SNDRV_CHMAP_TRL] = "TRL",
76
+ [SNDRV_CHMAP_TRC] = "TRC",
77
+ [SNDRV_CHMAP_TRR] = "TRR",
78
+ [SNDRV_CHMAP_TFLC] = "TFLC",
79
+ [SNDRV_CHMAP_TFRC] = "TFRC",
80
+ [SNDRV_CHMAP_LLFE] = "LLFE",
81
+ [SNDRV_CHMAP_RLFE] = "RLFE",
82
+ [SNDRV_CHMAP_TSL] = "TSL",
83
+ [SNDRV_CHMAP_TSR] = "TSR",
84
+ [SNDRV_CHMAP_BC] = "BC",
85
+ [SNDRV_CHMAP_RLC] = "RLC",
86
+ [SNDRV_CHMAP_RRC] = "RRC",
87
+};
7088
7189 /*
7290 * proc interface for list the supported pcm formats
....@@ -84,7 +102,7 @@
84102 snd_iprintf(buffer, " Interface %d\n", fp->iface);
85103 snd_iprintf(buffer, " Altset %d\n", fp->altsetting);
86104 snd_iprintf(buffer, " Format:");
87
- for (fmt = 0; fmt <= SNDRV_PCM_FORMAT_LAST; ++fmt)
105
+ pcm_for_each_format(fmt)
88106 if (fp->formats & pcm_format_to_bits(fmt))
89107 snd_iprintf(buffer, " %s",
90108 snd_pcm_format_name(fmt));
....@@ -110,6 +128,28 @@
110128 if (subs->speed != USB_SPEED_FULL)
111129 snd_iprintf(buffer, " Data packet interval: %d us\n",
112130 125 * (1 << fp->datainterval));
131
+ snd_iprintf(buffer, " Bits: %d\n", fp->fmt_bits);
132
+
133
+ if (fp->dsd_raw)
134
+ snd_iprintf(buffer, " DSD raw: DOP=%d, bitrev=%d\n",
135
+ fp->dsd_dop, fp->dsd_bitrev);
136
+
137
+ if (fp->chmap) {
138
+ const struct snd_pcm_chmap_elem *map = fp->chmap;
139
+ int c;
140
+
141
+ snd_iprintf(buffer, " Channel map:");
142
+ for (c = 0; c < map->channels; c++) {
143
+ if (map->map[c] >= ARRAY_SIZE(channel_labels) ||
144
+ !channel_labels[map->map[c]])
145
+ snd_iprintf(buffer, " --");
146
+ else
147
+ snd_iprintf(buffer, " %s",
148
+ channel_labels[map->map[c]]);
149
+ }
150
+ snd_iprintf(buffer, "\n");
151
+ }
152
+
113153 // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize);
114154 // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes);
115155 }
....@@ -167,12 +207,10 @@
167207
168208 void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
169209 {
170
- struct snd_info_entry *entry;
171210 char name[32];
172211 struct snd_card *card = stream->chip->card;
173212
174213 sprintf(name, "stream%d", stream->pcm_index);
175
- if (!snd_card_proc_new(card, name, &entry))
176
- snd_info_set_text_ops(entry, stream, proc_pcm_format_read);
214
+ snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read);
177215 }
178216