caiaq endianness fix
[linux-2.6.git] / sound / usb / caiaq / caiaq-device.c
index dc2e7f7..a972f77 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/usb.h>
 #include <linux/input.h>
 #include <linux/spinlock.h>
-#include <sound/driver.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
 #endif
 
 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
-MODULE_DESCRIPTION("caiaq USB audio, version 1.3.0");
+MODULE_DESCRIPTION("caiaq USB audio, version 1.3.6");
 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 8 DJ}}");
 
@@ -96,6 +96,11 @@ static struct usb_device_id snd_usb_id_table[] = {
                .idProduct =    USB_PID_KORECONTROLLER
        },
        {
+               .match_flags =  USB_DEVICE_ID_MATCH_DEVICE,
+               .idVendor =     USB_VID_NATIVEINSTRUMENTS,
+               .idProduct =    USB_PID_KORECONTROLLER2
+       },
+       {
                .match_flags =  USB_DEVICE_ID_MATCH_DEVICE,
                .idVendor =     USB_VID_NATIVEINSTRUMENTS,
                .idProduct =    USB_PID_AK1
@@ -240,7 +245,7 @@ int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev,
                                          tmp, sizeof(tmp));
 }
 
-static void setup_card(struct snd_usb_caiaqdev *dev)
+static void __devinit setup_card(struct snd_usb_caiaqdev *dev)
 {
        int ret;
        char val[4];
@@ -291,13 +296,21 @@ static void setup_card(struct snd_usb_caiaqdev *dev)
                break;
        }
        
-       ret = snd_usb_caiaq_audio_init(dev);
-       if (ret < 0)
-               log("Unable to set up audio system (ret=%d)\n", ret);
+       if (dev->spec.num_analog_audio_out +
+           dev->spec.num_analog_audio_in +
+           dev->spec.num_digital_audio_out +
+           dev->spec.num_digital_audio_in > 0) {
+               ret = snd_usb_caiaq_audio_init(dev);
+               if (ret < 0)
+                       log("Unable to set up audio system (ret=%d)\n", ret);
+       }
        
-       ret = snd_usb_caiaq_midi_init(dev);
-       if (ret < 0)
-               log("Unable to set up MIDI system (ret=%d)\n", ret);
+       if (dev->spec.num_midi_in +
+           dev->spec.num_midi_out > 0) {
+               ret = snd_usb_caiaq_midi_init(dev);
+               if (ret < 0)
+                       log("Unable to set up MIDI system (ret=%d)\n", ret);
+       }
 
 #ifdef CONFIG_SND_USB_CAIAQ_INPUT
        ret = snd_usb_caiaq_input_init(dev);
@@ -338,15 +351,15 @@ static struct snd_card* create_card(struct usb_device* usb_dev)
        dev = caiaqdev(card);
        dev->chip.dev = usb_dev;
        dev->chip.card = card;
-       dev->chip.usb_id = USB_ID(usb_dev->descriptor.idVendor,
-                                       usb_dev->descriptor.idProduct);
+       dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor),
+                                 le16_to_cpu(usb_dev->descriptor.idProduct));
        spin_lock_init(&dev->spinlock);
        snd_card_set_dev(card, &usb_dev->dev);
 
        return card;
 }
 
-static int init_card(struct snd_usb_caiaqdev *dev)
+static int __devinit init_card(struct snd_usb_caiaqdev *dev)
 {
        char *c;
        struct usb_device *usb_dev = dev->chip.dev;
@@ -415,7 +428,7 @@ static int init_card(struct snd_usb_caiaqdev *dev)
        return 0;
 }
 
-static int snd_probe(struct usb_interface *intf, 
+static int __devinit snd_probe(struct usb_interface *intf, 
                     const struct usb_device_id *id)
 {
        int ret;
@@ -443,7 +456,7 @@ static void snd_disconnect(struct usb_interface *intf)
        struct snd_usb_caiaqdev *dev;
        struct snd_card *card = dev_get_drvdata(&intf->dev);
 
-       debug("snd_disconnect(%p)\n", intf);
+       debug("%s(%p)\n", __func__, intf);
 
        if (!card)
                return;