Merge branch 'topic/usb-caiaq' into for-linus
Takashi Iwai [Mon, 23 Mar 2009 23:36:23 +0000 (00:36 +0100)]
1  2 
sound/usb/caiaq/caiaq-device.c

  #endif
  
  MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
- MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10");
+ MODULE_DESCRIPTION("caiaq USB audio, version 1.3.13");
  MODULE_LICENSE("GPL");
  MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
                         "{Native Instruments, RigKontrol3},"
                         "{Native Instruments, Kore Controller},"
                         "{Native Instruments, Kore Controller 2},"
                         "{Native Instruments, Audio Kontrol 1},"
+                        "{Native Instruments, Audio 4 DJ},"
                         "{Native Instruments, Audio 8 DJ},"
-                        "{Native Instruments, Session I/O}}");
+                        "{Native Instruments, Session I/O},"
+                        "{Native Instruments, GuitarRig mobile}");
  
  static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
  static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
@@@ -116,6 -118,16 +118,16 @@@ static struct usb_device_id snd_usb_id_
                .idVendor =     USB_VID_NATIVEINSTRUMENTS,
                .idProduct =    USB_PID_SESSIONIO
        },
+       {
+               .match_flags =  USB_DEVICE_ID_MATCH_DEVICE,
+               .idVendor =     USB_VID_NATIVEINSTRUMENTS,
+               .idProduct =    USB_PID_GUITARRIGMOBILE
+       },
+       {
+               .match_flags =  USB_DEVICE_ID_MATCH_DEVICE,
+               .idVendor =     USB_VID_NATIVEINSTRUMENTS,
+               .idProduct =    USB_PID_AUDIO4DJ
+       },
        { /* terminator */ }
  };
  
@@@ -239,6 -251,8 +251,8 @@@ int snd_usb_caiaq_set_audio_params (str
                
        if (dev->audio_parm_answer != 1) 
                debug("unable to set the device's audio params\n");
+       else
+               dev->bpp = bpp;
  
        return dev->audio_parm_answer == 1 ? 0 : -EINVAL;
  }
@@@ -300,6 -314,12 +314,12 @@@ static void __devinit setup_card(struc
                }
  
                break;
+       case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ):
+               /* Audio 4 DJ - default input mode to phono */
+               dev->control_state[0] = 2;
+               snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO,
+                       dev->control_state, 1);
+               break;
        }
        
        if (dev->spec.num_analog_audio_out +
                log("Unable to set up control system (ret=%d)\n", ret);
  }
  
 -static struct snd_card* create_card(struct usb_device* usb_dev)
 +static int create_card(struct usb_device* usb_dev, struct snd_card **cardp)
  {
        int devnum;
 +      int err;
        struct snd_card *card;
        struct snd_usb_caiaqdev *dev;
  
                        break;
  
        if (devnum >= SNDRV_CARDS)
 -              return NULL;
 +              return -ENODEV;
  
 -      card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, 
 -                                      sizeof(struct snd_usb_caiaqdev));
 -      if (!card)
 -              return NULL;
 +      err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, 
 +                            sizeof(struct snd_usb_caiaqdev), &card);
 +      if (err < 0)
 +              return err;
  
        dev = caiaqdev(card);
        dev->chip.dev = usb_dev;
        spin_lock_init(&dev->spinlock);
        snd_card_set_dev(card, &usb_dev->dev);
  
 -      return card;
 +      *cardp = card;
 +      return 0;
  }
  
  static int __devinit init_card(struct snd_usb_caiaqdev *dev)
@@@ -443,10 -461,10 +463,10 @@@ static int __devinit snd_probe(struct u
        struct snd_card *card;
        struct usb_device *device = interface_to_usbdev(intf);
        
 -      card = create_card(device);
 +      ret = create_card(device, &card);
        
 -      if (!card)
 -              return -ENOMEM;
 +      if (ret < 0)
 +              return ret;
                        
        usb_set_intfdata(intf, card);
        ret = init_card(caiaqdev(card));