]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
ALSA: usb-audio: Save UAC sample size information
authorWesley Cheng <quic_wcheng@quicinc.com>
Wed, 9 Apr 2025 19:47:43 +0000 (12:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Apr 2025 11:02:30 +0000 (13:02 +0200)
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 <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250409194804.3773260-11-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/usb/card.h
sound/usb/format.c

index 4f4f3f39b7fa446c8f5a57f05fb7248d4250bdda..b65163c60176a785c5b8bf5b98bcf5b34cc06e1f 100644 (file)
@@ -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 */
index 9d32b21a5fbb0264cd2ab43d7a75c4c07922529a..8490d80ade361dc46e16af3468894c79f160f19c 100644 (file)
@@ -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))) {