diff options
author | Jussi Laako <jussi@sonarnerd.net> | 2019-02-17 17:17:21 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-02-18 03:36:09 -0500 |
commit | c7a13264918b9796f80c634f20fea56e1612572d (patch) | |
tree | d0d8757c02033712f513904f827962e0b0c3fded | |
parent | a06702ca023feccb7c1a5171987f5cac959427ed (diff) |
ALSA: usb-audio: Expose sample resolution through proc interface
At least some USB devices use (MSB-aligned) audio format larger
than the actual resolution of the device. In order to expose the
actual device resolution (bBitResolution), add extra field to the
procfs stream info interface.
Signed-off-by: Jussi Laako <jussi@sonarnerd.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/usb/card.h | 1 | ||||
-rw-r--r-- | sound/usb/format.c | 2 | ||||
-rw-r--r-- | sound/usb/proc.c | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h index ac785d15ced4..79fa2a19fb7b 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h | |||
@@ -14,6 +14,7 @@ struct audioformat { | |||
14 | u64 formats; /* ALSA format bits */ | 14 | u64 formats; /* ALSA format bits */ |
15 | unsigned int channels; /* # channels */ | 15 | unsigned int channels; /* # channels */ |
16 | unsigned int fmt_type; /* USB audio format type (1-3) */ | 16 | unsigned int fmt_type; /* USB audio format type (1-3) */ |
17 | unsigned int fmt_bits; /* number of significant bits */ | ||
17 | unsigned int frame_size; /* samples per frame for non-audio */ | 18 | unsigned int frame_size; /* samples per frame for non-audio */ |
18 | int iface; /* interface number */ | 19 | int iface; /* interface number */ |
19 | unsigned char altsetting; /* corresponding alternate setting */ | 20 | unsigned char altsetting; /* corresponding alternate setting */ |
diff --git a/sound/usb/format.c b/sound/usb/format.c index fd13ac11b136..3ee7d6f853b7 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c | |||
@@ -87,6 +87,8 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | fp->fmt_bits = sample_width; | ||
91 | |||
90 | if ((pcm_formats == 0) && | 92 | if ((pcm_formats == 0) && |
91 | (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { | 93 | (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { |
92 | /* some devices don't define this correctly... */ | 94 | /* some devices don't define this correctly... */ |
diff --git a/sound/usb/proc.c b/sound/usb/proc.c index e80c9d0749c9..ef9190530fd2 100644 --- a/sound/usb/proc.c +++ b/sound/usb/proc.c | |||
@@ -109,6 +109,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s | |||
109 | if (subs->speed != USB_SPEED_FULL) | 109 | if (subs->speed != USB_SPEED_FULL) |
110 | snd_iprintf(buffer, " Data packet interval: %d us\n", | 110 | snd_iprintf(buffer, " Data packet interval: %d us\n", |
111 | 125 * (1 << fp->datainterval)); | 111 | 125 * (1 << fp->datainterval)); |
112 | snd_iprintf(buffer, " Bits: %d\n", fp->fmt_bits); | ||
112 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); | 113 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); |
113 | // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); | 114 | // snd_iprintf(buffer, " EP Attribute = %#x\n", fp->attributes); |
114 | } | 115 | } |