Skip to content

Commit

Permalink
ALSA: usb-audio: Add native DSD support for Mytek DACs
Browse files Browse the repository at this point in the history
Add new mostly generic code with Mytek VID to support native DSD mode.

This implementation should be easier to maintain when manufacturers
release new products.

Signed-off-by: Jussi Laako <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
jlaako authored and tiwai committed Jun 13, 2018
1 parent c7273bd commit 3a572d9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions sound/usb/card.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ struct audioformat {
struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */
bool dsd_dop; /* add DOP headers in case of DSD samples */
bool dsd_bitrev; /* reverse the bits of each DSD sample */
bool dsd_raw; /* altsetting is raw DSD */
};

struct snd_usb_substream;
Expand Down
5 changes: 4 additions & 1 deletion sound/usb/format.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
sample_width = fmt->bBitResolution;
sample_bytes = fmt->bSubslotSize;

if (format & UAC2_FORMAT_TYPE_I_RAW_DATA)
if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) {
pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL;
/* flag potentially raw DSD capable altsettings */
fp->dsd_raw = true;
}

format <<= 1;
break;
Expand Down
13 changes: 13 additions & 0 deletions sound/usb/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,6 +1443,19 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
return SNDRV_PCM_FMTBIT_DSD_U32_BE;
}

/* Mostly generic method to detect many DSD-capable implementations -
* from XMOS/Thesycon
*/
switch (USB_ID_VENDOR(chip->usb_id)) {
case 0x25ce: /* Mytek devices */
if (fp->dsd_raw)
return SNDRV_PCM_FMTBIT_DSD_U32_BE;
break;
default:
break;

}

return 0;
}

Expand Down

0 comments on commit 3a572d9

Please sign in to comment.