ALSA: usb-audio: Print more information in stream proc files

For more debug and usability information, add the entry showing the
DSD raw states and the channel mapping in each stream proc file.

Link: https://lore.kernel.org/r/20200419212134.14200-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2020-04-19 23:21:34 +02:00
parent aa08ff0f34
commit 093b8494f2
1 changed files with 53 additions and 0 deletions

View File

@ -54,6 +54,38 @@ void snd_usb_audio_create_proc(struct snd_usb_audio *chip)
proc_audio_usbid_read);
}
static const char * const channel_labels[] = {
[SNDRV_CHMAP_NA] = "N/A",
[SNDRV_CHMAP_MONO] = "MONO",
[SNDRV_CHMAP_FL] = "FL",
[SNDRV_CHMAP_FR] = "FR",
[SNDRV_CHMAP_FC] = "FC",
[SNDRV_CHMAP_LFE] = "LFE",
[SNDRV_CHMAP_RL] = "RL",
[SNDRV_CHMAP_RR] = "RR",
[SNDRV_CHMAP_FLC] = "FLC",
[SNDRV_CHMAP_FRC] = "FRC",
[SNDRV_CHMAP_RC] = "RC",
[SNDRV_CHMAP_SL] = "SL",
[SNDRV_CHMAP_SR] = "SR",
[SNDRV_CHMAP_TC] = "TC",
[SNDRV_CHMAP_TFL] = "TFL",
[SNDRV_CHMAP_TFC] = "TFC",
[SNDRV_CHMAP_TFR] = "TFR",
[SNDRV_CHMAP_TRL] = "TRL",
[SNDRV_CHMAP_TRC] = "TRC",
[SNDRV_CHMAP_TRR] = "TRR",
[SNDRV_CHMAP_TFLC] = "TFLC",
[SNDRV_CHMAP_TFRC] = "TFRC",
[SNDRV_CHMAP_LLFE] = "LLFE",
[SNDRV_CHMAP_RLFE] = "RLFE",
[SNDRV_CHMAP_TSL] = "TSL",
[SNDRV_CHMAP_TSR] = "TSR",
[SNDRV_CHMAP_BC] = "BC",
[SNDRV_CHMAP_RLC] = "RLC",
[SNDRV_CHMAP_RRC] = "RRC",
};
/*
* proc interface for list the supported pcm formats
*/
@ -97,6 +129,27 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s
snd_iprintf(buffer, " Data packet interval: %d us\n",
125 * (1 << fp->datainterval));
snd_iprintf(buffer, " Bits: %d\n", fp->fmt_bits);
if (fp->dsd_raw)
snd_iprintf(buffer, " DSD raw: DOP=%d, bitrev=%d\n",
fp->dsd_dop, fp->dsd_bitrev);
if (fp->chmap) {
const struct snd_pcm_chmap_elem *map = fp->chmap;
int c;
snd_iprintf(buffer, " Channel map:");
for (c = 0; c < map->channels; c++) {
if (map->map[c] >= sizeof(channel_labels) ||
!channel_labels[map->map[c]])
snd_iprintf(buffer, " --");
else
snd_iprintf(buffer, " %s",
channel_labels[map->map[c]]);
}
snd_iprintf(buffer, "\n");
}
// snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize);
// snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes);
}