ALSA: hda - Introduce get_delay codec PCM ops
[firefly-linux-kernel-4.4.55.git] / sound / usb / format.c
index e831ee4238bbd79b2761c942dd900d2623f0912d..20c775170959815effee98518a0ef03d451826d8 100644 (file)
  */
 static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
                                     struct audioformat *fp,
-                                    int format, void *_fmt,
+                                    unsigned int format, void *_fmt,
                                     int protocol)
 {
        int sample_width, sample_bytes;
-       u64 pcm_formats;
+       u64 pcm_formats = 0;
 
        switch (protocol) {
        case UAC_VERSION_1:
@@ -63,14 +63,17 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
                struct uac_format_type_i_ext_descriptor *fmt = _fmt;
                sample_width = fmt->bBitResolution;
                sample_bytes = fmt->bSubslotSize;
+
+               if (format & UAC2_FORMAT_TYPE_I_RAW_DATA)
+                       pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL;
+
                format <<= 1;
                break;
        }
        }
 
-       pcm_formats = 0;
-
-       if (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED)) {
+       if ((pcm_formats == 0) &&
+           (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) {
                /* some devices don't define this correctly... */
                snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n",
                            chip->dev->devnum, fp->iface, fp->altsetting);
@@ -277,7 +280,7 @@ static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,
        struct usb_device *dev = chip->dev;
        unsigned char tmp[2], *data;
        int nr_triplets, data_size, ret = 0;
-       int clock = snd_usb_clock_find_source(chip, fp->clock);
+       int clock = snd_usb_clock_find_source(chip, fp->clock, false);
 
        if (clock < 0) {
                snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n",
@@ -353,7 +356,7 @@ err:
  * parse the format type I and III descriptors
  */
 static int parse_audio_format_i(struct snd_usb_audio *chip,
-                               struct audioformat *fp, int format,
+                               struct audioformat *fp, unsigned int format,
                                struct uac_format_type_i_continuous_descriptor *fmt,
                                struct usb_host_interface *iface)
 {
@@ -473,8 +476,9 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip,
        return ret;
 }
 
-int snd_usb_parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fp,
-                              int format, struct uac_format_type_i_continuous_descriptor *fmt,
+int snd_usb_parse_audio_format(struct snd_usb_audio *chip,
+                              struct audioformat *fp, unsigned int format,
+                              struct uac_format_type_i_continuous_descriptor *fmt,
                               int stream, struct usb_host_interface *iface)
 {
        int err;