Thread (40 messages) 40 messages, 2 authors, 2024-08-28
STALE671d
Revisions (38)
  1. v3 [diff vs current]
  2. v4 [diff vs current]
  3. v5 [diff vs current]
  4. v6 [diff vs current]
  5. v7 [diff vs current]
  6. v8 [diff vs current]
  7. v9 [diff vs current]
  8. v10 [diff vs current]
  9. v11 [diff vs current]
  10. v12 [diff vs current]
  11. v13 [diff vs current]
  12. v14 [diff vs current]
  13. v15 [diff vs current]
  14. v16 [diff vs current]
  15. v17 [diff vs current]
  16. v18 [diff vs current]
  17. v19 [diff vs current]
  18. v20 [diff vs current]
  19. v21 [diff vs current]
  20. v22 [diff vs current]
  21. v23 [diff vs current]
  22. v24 [diff vs current]
  23. v25 current
  24. v26 [diff vs current]
  25. v27 [diff vs current]
  26. v28 [diff vs current]
  27. v28 [diff vs current]
  28. v28 [diff vs current]
  29. v29 [diff vs current]
  30. v30 [diff vs current]
  31. v31 [diff vs current]
  32. v32 [diff vs current]
  33. v33 [diff vs current]
  34. v34 [diff vs current]
  35. v35 [diff vs current]
  36. v36 [diff vs current]
  37. v37 [diff vs current]
  38. v38 [diff vs current]

[PATCH v25 25/33] ALSA: usb-audio: Save UAC sample size information

From: Wesley Cheng <hidden>
Date: 2024-08-23 20:01:52
Also in: alsa-devel, linux-arm-msm, linux-doc, linux-input, linux-sound, linux-usb, lkml
Subsystem: sound, the rest · Maintainers: Jaroslav Kysela, Takashi Iwai, Linus Torvalds

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
exisiting parameters.

Signed-off-by: Wesley Cheng <redacted>
---
 sound/usb/card.h   | 1 +
 sound/usb/format.c | 1 +
 2 files changed, 2 insertions(+)
diff --git a/sound/usb/card.h b/sound/usb/card.h
index 6e9d5f5c88eb..4eb416e7f2ba 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 3b45d0ee7693..5fde543536a8 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -80,6 +80,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 == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help