Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #include <linux/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <sound/info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "usbaudio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "helper.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include "card.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "endpoint.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "proc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) /* convert our full speed USB rate into sampling rate in Hz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) static inline unsigned get_full_speed_hz(unsigned int usb_rate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	return (usb_rate * 125 + (1 << 12)) >> 13;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) /* convert our high speed USB rate into sampling rate in Hz */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) static inline unsigned get_high_speed_hz(unsigned int usb_rate)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	return (usb_rate * 125 + (1 << 9)) >> 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  * common proc files to show the usb device info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static void proc_audio_usbbus_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	struct snd_usb_audio *chip = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	if (!atomic_read(&chip->shutdown))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		snd_iprintf(buffer, "%03d/%03d\n", chip->dev->bus->busnum, chip->dev->devnum);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct snd_usb_audio *chip = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	if (!atomic_read(&chip->shutdown))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		snd_iprintf(buffer, "%04x:%04x\n", 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 			    USB_ID_VENDOR(chip->usb_id),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 			    USB_ID_PRODUCT(chip->usb_id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	snd_card_ro_proc_new(chip->card, "usbbus", chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			     proc_audio_usbbus_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	snd_card_ro_proc_new(chip->card, "usbid", chip,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 			     proc_audio_usbid_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) static const char * const channel_labels[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	[SNDRV_CHMAP_NA]	= "N/A",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	[SNDRV_CHMAP_MONO]	= "MONO",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	[SNDRV_CHMAP_FL]	= "FL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	[SNDRV_CHMAP_FR]	= "FR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	[SNDRV_CHMAP_FC]	= "FC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	[SNDRV_CHMAP_LFE]	= "LFE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	[SNDRV_CHMAP_RL]	= "RL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	[SNDRV_CHMAP_RR]	= "RR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	[SNDRV_CHMAP_FLC]	= "FLC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	[SNDRV_CHMAP_FRC]	= "FRC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	[SNDRV_CHMAP_RC]	= "RC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	[SNDRV_CHMAP_SL]	= "SL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	[SNDRV_CHMAP_SR]	= "SR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	[SNDRV_CHMAP_TC]	= "TC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	[SNDRV_CHMAP_TFL]	= "TFL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	[SNDRV_CHMAP_TFC]	= "TFC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	[SNDRV_CHMAP_TFR]	= "TFR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	[SNDRV_CHMAP_TRL]	= "TRL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	[SNDRV_CHMAP_TRC]	= "TRC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	[SNDRV_CHMAP_TRR]	= "TRR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	[SNDRV_CHMAP_TFLC]	= "TFLC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	[SNDRV_CHMAP_TFRC]	= "TFRC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	[SNDRV_CHMAP_LLFE]	= "LLFE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	[SNDRV_CHMAP_RLFE]	= "RLFE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	[SNDRV_CHMAP_TSL]	= "TSL",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	[SNDRV_CHMAP_TSR]	= "TSR",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	[SNDRV_CHMAP_BC]	= "BC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	[SNDRV_CHMAP_RLC]	= "RLC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	[SNDRV_CHMAP_RRC]	= "RRC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * proc interface for list the supported pcm formats
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	struct audioformat *fp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	static const char * const sync_types[4] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		"NONE", "ASYNC", "ADAPTIVE", "SYNC"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	list_for_each_entry(fp, &subs->fmt_list, list) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		snd_pcm_format_t fmt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		snd_iprintf(buffer, "  Interface %d\n", fp->iface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		snd_iprintf(buffer, "    Altset %d\n", fp->altsetting);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		snd_iprintf(buffer, "    Format:");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		pcm_for_each_format(fmt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			if (fp->formats & pcm_format_to_bits(fmt))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 				snd_iprintf(buffer, " %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 					    snd_pcm_format_name(fmt));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		snd_iprintf(buffer, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		snd_iprintf(buffer, "    Channels: %d\n", fp->channels);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 		snd_iprintf(buffer, "    Endpoint: %d %s (%s)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 			    fp->endpoint & USB_ENDPOINT_NUMBER_MASK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			    fp->endpoint & USB_DIR_IN ? "IN" : "OUT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 			    sync_types[(fp->ep_attr & USB_ENDPOINT_SYNCTYPE) >> 2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		if (fp->rates & SNDRV_PCM_RATE_CONTINUOUS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			snd_iprintf(buffer, "    Rates: %d - %d (continuous)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 				    fp->rate_min, fp->rate_max);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			unsigned int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			snd_iprintf(buffer, "    Rates: ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 			for (i = 0; i < fp->nr_rates; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 				if (i > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 					snd_iprintf(buffer, ", ");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 				snd_iprintf(buffer, "%d", fp->rate_table[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 			snd_iprintf(buffer, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		if (subs->speed != USB_SPEED_FULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 			snd_iprintf(buffer, "    Data packet interval: %d us\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 				    125 * (1 << fp->datainterval));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		snd_iprintf(buffer, "    Bits: %d\n", fp->fmt_bits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		if (fp->dsd_raw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 			snd_iprintf(buffer, "    DSD raw: DOP=%d, bitrev=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 				    fp->dsd_dop, fp->dsd_bitrev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		if (fp->chmap) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			const struct snd_pcm_chmap_elem *map = fp->chmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 			int c;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 			snd_iprintf(buffer, "    Channel map:");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			for (c = 0; c < map->channels; c++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 				if (map->map[c] >= ARRAY_SIZE(channel_labels) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 				    !channel_labels[map->map[c]])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 					snd_iprintf(buffer, " --");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 				else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 					snd_iprintf(buffer, " %s",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 						    channel_labels[map->map[c]]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			snd_iprintf(buffer, "\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 		// snd_iprintf(buffer, "    Max Packet Size = %d\n", fp->maxpacksize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		// snd_iprintf(buffer, "    EP Attribute = %#x\n", fp->attributes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) static void proc_dump_ep_status(struct snd_usb_substream *subs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 				struct snd_usb_endpoint *data_ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 				struct snd_usb_endpoint *sync_ep,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 				struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	if (!data_ep)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	snd_iprintf(buffer, "    Packet Size = %d\n", data_ep->curpacksize);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	snd_iprintf(buffer, "    Momentary freq = %u Hz (%#x.%04x)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		    subs->speed == USB_SPEED_FULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		    ? get_full_speed_hz(data_ep->freqm)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		    : get_high_speed_hz(data_ep->freqm),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		    data_ep->freqm >> 16, data_ep->freqm & 0xffff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	if (sync_ep && data_ep->freqshift != INT_MIN) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		int res = 16 - data_ep->freqshift;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		snd_iprintf(buffer, "    Feedback Format = %d.%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			    (sync_ep->syncmaxsize > 3 ? 32 : 24) - res, res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	if (subs->running) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		snd_iprintf(buffer, "  Status: Running\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		snd_iprintf(buffer, "    Interface = %d\n", subs->interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		snd_iprintf(buffer, "    Altset = %d\n", subs->altset_idx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		proc_dump_ep_status(subs, subs->data_endpoint, subs->sync_endpoint, buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		snd_iprintf(buffer, "  Status: Stop\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	struct snd_usb_stream *stream = entry->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	if (stream->substream[SNDRV_PCM_STREAM_PLAYBACK].num_formats) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		snd_iprintf(buffer, "\nPlayback:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	if (stream->substream[SNDRV_PCM_STREAM_CAPTURE].num_formats) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		snd_iprintf(buffer, "\nCapture:\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	char name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	struct snd_card *card = stream->chip->card;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	sprintf(name, "stream%d", stream->pcm_index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216)