diff options
| author | Wesley Cheng <[email protected]> | 2025-04-09 19:47:43 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2025-04-11 11:02:30 +0000 |
| commit | d893d5eaabfa948e983cc447bacf80a8306358da (patch) | |
| tree | c64c7d3fbb29825638d0038979d1c70e79a28a24 | |
| parent | ALSA: usb-audio: Check for support for requested audio format (diff) | |
| download | kernel-d893d5eaabfa948e983cc447bacf80a8306358da.tar.gz kernel-d893d5eaabfa948e983cc447bacf80a8306358da.zip | |
ALSA: usb-audio: Save UAC sample size information
Within the UAC descriptor, there is information describing the size of a
sample (bSubframeSize/bSubslotSize) and the number of relevant bits
(bBitResolution). Currently, fmt_bits carries only the bit resolution,
however, some offloading entities may also require the overall size of the
sample. Save this information in a separate parameter, as depending on the
UAC format type, the sample size can not easily be decoded from other
existing parameters.
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Wesley Cheng <[email protected]>
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
| -rw-r--r-- | sound/usb/card.h | 1 | ||||
| -rw-r--r-- | sound/usb/format.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h index 4f4f3f39b7fa..b65163c60176 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -15,6 +15,7 @@ struct audioformat { unsigned int channels; /* # channels */ unsigned int fmt_type; /* USB audio format type (1-3) */ unsigned int fmt_bits; /* number of significant bits */ + unsigned int fmt_sz; /* overall audio sub frame/slot size */ unsigned int frame_size; /* samples per frame for non-audio */ unsigned char iface; /* interface number */ unsigned char altsetting; /* corresponding alternate setting */ diff --git a/sound/usb/format.c b/sound/usb/format.c index 9d32b21a5fbb..8490d80ade36 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -85,6 +85,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, } fp->fmt_bits = sample_width; + fp->fmt_sz = sample_bytes; if ((pcm_formats == 0) && (format == 0 || format == BIT(UAC_FORMAT_TYPE_I_UNDEFINED))) { |
