alsa-project / alsa-lib

The Advanced Linux Sound Architecture (ALSA) - library
GNU Lesser General Public License v2.1
357 stars 176 forks source link

DSD hardware quirks and usb vendor id hardcoding #266

Closed soholt closed 1 year ago

soholt commented 2 years ago

I am using tinyusb for UAC2 audio class and line 492 https://github.com/hathach/tinyusb/blob/master/src/class/audio/audio.h allows: "AUDIO_DATA_FORMAT_TYPE_I_RAW_DATA = 0x80000000" cat /proc/asound/ reports it as "Format: SPECIAL", but I wanted to be "SPECIAL DSD_U32_xx", so for fun I tried: 0x80000001 which reported as = S32_LE SPECIAL, 0x80000002 = U8 SPECIAL, 0x80000003 = U8 S32_LE SPECIAL 0x800000ff = U8 S32_LE FLOAT_LE MU_LAW A_LAW SPECIAL - seem to recursively add more

Then I found quirks line 1582 https://github.com/torvalds/linux/blob/master/sound/usb/quirks.c "The UAC standards don't have a designated bit field to denote DSD-capable interfaces, hence all hardware that is known to support this format has to be listed here."

So if I change my usb vendor id to XMOS 0x20b1, only then "Format: SPECIAL" becomes "Format: SPECIAL DSD_U32_BE"

I have no idea if range 0x80000001++ is used for anything or if it could be used for DSD formats like:

0x80000001 = SPECIAL DSD_U8 0x80000002 = SPECIAL DSD_U16_LE 0x80000003 = SPECIAL DSD_U16_BE 0x80000004 = SPECIAL DSD_U32_LE 0x80000005 = SPECIAL DSD_U32_BE

so no future hardcoding is required.

Thanks, Gin

perexg commented 1 year ago

The kernel related changes should be discussed in the alsa-devel mailing list - https://www.alsa-project.org .