]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
staging/line6: refactor device information and add POD HD 500
authorMarkus Grabner <grabner@icg.tugraz.at>
Mon, 5 Dec 2011 22:51:53 +0000 (23:51 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 8 Dec 2011 20:33:49 +0000 (12:33 -0800)
This patch refactors the device information code and adds preliminary support for the POD HD 500 device.

Signed-off-by: Markus Grabner <grabner@icg.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/line6/driver.c
drivers/staging/line6/driver.h
drivers/staging/line6/midi.c
drivers/staging/line6/pcm.c
drivers/staging/line6/usbdefs.h

index a2f48ee463eef2611cbe2862bcb5aaf7c38a7115..6a1959e16e00f0344cddd3519164dba9ba4ec56c 100644 (file)
@@ -38,6 +38,8 @@ static const struct usb_device_id line6_id_table[] = {
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_BASSPODXTPRO)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_GUITARPORT)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_POCKETPOD)},
+       {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD300)},
+       {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD500)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_GX)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX1)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODSTUDIO_UX2)},
@@ -50,7 +52,6 @@ static const struct usb_device_id line6_id_table[] = {
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX1)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_TONEPORT_UX2)},
        {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_VARIAX)},
-       {USB_DEVICE(LINE6_VENDOR_ID, LINE6_DEVID_PODHD300)},
        {},
 };
 
@@ -58,24 +59,25 @@ MODULE_DEVICE_TABLE(usb, line6_id_table);
 
 /* *INDENT-OFF* */
 static struct line6_properties line6_properties_table[] = {
-       { "BassPODxt",     "BassPODxt",        LINE6_BIT_BASSPODXT,     LINE6_BIT_CONTROL_PCM_HWMON },
-       { "BassPODxtLive", "BassPODxt Live",   LINE6_BIT_BASSPODXTLIVE, LINE6_BIT_CONTROL_PCM_HWMON },
-       { "BassPODxtPro",  "BassPODxt Pro",    LINE6_BIT_BASSPODXTPRO,  LINE6_BIT_CONTROL_PCM_HWMON },
-       { "GuitarPort",    "GuitarPort",       LINE6_BIT_GUITARPORT,    LINE6_BIT_PCM               },
-       { "PocketPOD",     "Pocket POD",       LINE6_BIT_POCKETPOD,     LINE6_BIT_CONTROL           },
-       { "PODStudioGX",   "POD Studio GX",    LINE6_BIT_PODSTUDIO_GX,  LINE6_BIT_PCM               },
-       { "PODStudioUX1",  "POD Studio UX1",   LINE6_BIT_PODSTUDIO_UX1, LINE6_BIT_PCM               },
-       { "PODStudioUX2",  "POD Studio UX2",   LINE6_BIT_PODSTUDIO_UX2, LINE6_BIT_PCM               },
-       { "PODX3",         "POD X3",           LINE6_BIT_PODX3,         LINE6_BIT_PCM               },
-       { "PODX3Live",     "POD X3 Live",      LINE6_BIT_PODX3LIVE,     LINE6_BIT_PCM               },
-       { "PODxt",         "PODxt",            LINE6_BIT_PODXT,         LINE6_BIT_CONTROL_PCM_HWMON },
-       { "PODxtLive",     "PODxt Live",       LINE6_BIT_PODXTLIVE,     LINE6_BIT_CONTROL_PCM_HWMON },
-       { "PODxtPro",      "PODxt Pro",        LINE6_BIT_PODXTPRO,      LINE6_BIT_CONTROL_PCM_HWMON },
-       { "TonePortGX",    "TonePort GX",      LINE6_BIT_TONEPORT_GX,   LINE6_BIT_PCM               },
-       { "TonePortUX1",   "TonePort UX1",     LINE6_BIT_TONEPORT_UX1,  LINE6_BIT_PCM               },
-       { "TonePortUX2",   "TonePort UX2",     LINE6_BIT_TONEPORT_UX2,  LINE6_BIT_PCM               },
-       { "Variax",        "Variax Workbench", LINE6_BIT_VARIAX,        LINE6_BIT_CONTROL           },
-       { "PODHD300",      "POD HD300",        LINE6_BIT_PODHD300,      LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_BASSPODXT,     "BassPODxt",     "BassPODxt",        LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_BASSPODXTLIVE, "BassPODxtLive", "BassPODxt Live",   LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_BASSPODXTPRO,  "BassPODxtPro",  "BassPODxt Pro",    LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_GUITARPORT,    "GuitarPort",    "GuitarPort",       LINE6_BIT_PCM               },
+       { LINE6_BIT_POCKETPOD,     "PocketPOD",     "Pocket POD",       LINE6_BIT_CONTROL           },
+       { LINE6_BIT_PODHD300,      "PODHD300",      "POD HD300",        LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_PODHD500,      "PODHD500",      "POD HD500",        LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_PODSTUDIO_GX,  "PODStudioGX",   "POD Studio GX",    LINE6_BIT_PCM               },
+       { LINE6_BIT_PODSTUDIO_UX1, "PODStudioUX1",  "POD Studio UX1",   LINE6_BIT_PCM               },
+       { LINE6_BIT_PODSTUDIO_UX2, "PODStudioUX2",  "POD Studio UX2",   LINE6_BIT_PCM               },
+       { LINE6_BIT_PODX3,         "PODX3",         "POD X3",           LINE6_BIT_PCM               },
+       { LINE6_BIT_PODX3LIVE,     "PODX3Live",     "POD X3 Live",      LINE6_BIT_PCM               },
+       { LINE6_BIT_PODXT,         "PODxt",         "PODxt",            LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_PODXTLIVE,     "PODxtLive",     "PODxt Live",       LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_PODXTPRO,      "PODxtPro",      "PODxt Pro",        LINE6_BIT_CONTROL_PCM_HWMON },
+       { LINE6_BIT_TONEPORT_GX,   "TonePortGX",    "TonePort GX",      LINE6_BIT_PCM               },
+       { LINE6_BIT_TONEPORT_UX1,  "TonePortUX1",   "TonePort UX1",     LINE6_BIT_PCM               },
+       { LINE6_BIT_TONEPORT_UX2,  "TonePortUX2",   "TonePort UX2",     LINE6_BIT_PCM               },
+       { LINE6_BIT_VARIAX,        "Variax",        "Variax Workbench", LINE6_BIT_CONTROL           },
 };
 /* *INDENT-ON* */
 
@@ -441,6 +443,7 @@ static void line6_data_received(struct urb *urb)
                        break;
 
                case LINE6_DEVID_PODHD300:
+               case LINE6_DEVID_PODHD500:
                        break; /* let userspace handle MIDI */
 
                case LINE6_DEVID_PODXTLIVE:
@@ -800,6 +803,7 @@ static int line6_probe(struct usb_interface *interface,
                }
                break;
 
+       case LINE6_DEVID_PODHD500:
        case LINE6_DEVID_PODX3:
        case LINE6_DEVID_PODX3LIVE:
                switch (interface_number) {
@@ -878,6 +882,12 @@ static int line6_probe(struct usb_interface *interface,
                ep_write = 0x03;
                break;
 
+       case LINE6_DEVID_PODHD500:
+               size = sizeof(struct usb_line6_podhd);
+               ep_read = 0x81;
+               ep_write = 0x01;
+               break;
+
        case LINE6_DEVID_POCKETPOD:
                size = sizeof(struct usb_line6_pod);
                ep_read = 0x82;
@@ -1031,6 +1041,7 @@ static int line6_probe(struct usb_interface *interface,
                break;
 
        case LINE6_DEVID_PODHD300:
+       case LINE6_DEVID_PODHD500:
                ret = line6_podhd_init(interface,
                                       (struct usb_line6_podhd *)line6);
                break;
@@ -1158,6 +1169,7 @@ static void line6_disconnect(struct usb_interface *interface)
                        break;
 
                case LINE6_DEVID_PODHD300:
+               case LINE6_DEVID_PODHD500:
                        line6_podhd_disconnect(interface);
                        break;
 
index 553192f49317dff756dc82adc8e7b9211a0eda57..117bf9943568419ad7233c1e7fcf30ca08616fb1 100644 (file)
@@ -87,6 +87,11 @@ static const int SYSEX_EXTRA_SIZE = sizeof(line6_midi_id) + 4;
         Common properties of Line6 devices.
 */
 struct line6_properties {
+       /**
+                Bit identifying this device in the line6usb driver.
+       */
+       int device_bit;
+
        /**
                 Card id string (maximum 16 characters).
                 This can be used to address the device in ALSA programs as
@@ -99,11 +104,6 @@ struct line6_properties {
        */
        const char *name;
 
-       /**
-                Bit identifying this device in the line6usb driver.
-       */
-       int device_bit;
-
        /**
                 Bit vector defining this device's capabilities in the
                 line6usb driver.
index 3013fb522bde7a417b664943ccb1bf325edcded2..13d02939c3cb2ce7541756254241174670d4e862 100644 (file)
@@ -173,6 +173,7 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
 
        case LINE6_DEVID_VARIAX:
        case LINE6_DEVID_PODHD300:
+       case LINE6_DEVID_PODHD500:
                break;
 
        default:
@@ -404,8 +405,19 @@ int line6_init_midi(struct usb_line6 *line6)
        }
 
        line6midi->line6 = line6;
-       line6midi->midi_mask_transmit = 1;
-       line6midi->midi_mask_receive = 4;
+
+       switch(line6->product) {
+       case LINE6_DEVID_PODHD300:
+       case LINE6_DEVID_PODHD500:
+               line6midi->midi_mask_transmit = 1;
+               line6midi->midi_mask_receive = 1;
+               break;
+
+       default:
+               line6midi->midi_mask_transmit = 1;
+               line6midi->midi_mask_receive = 4;
+       }
+
        line6->line6midi = line6midi;
 
        err = snd_device_new(line6->card, SNDRV_DEV_RAWMIDI, line6midi,
index a70c0876842f3b0c11fc8da015fea9fbb77fc139..c3e5002c2af510bdfc821df39d68cec6d9ff6e8f 100644 (file)
@@ -367,6 +367,7 @@ int line6_init_pcm(struct usb_line6 *line6,
                ep_write = 0x01;
                break;
 
+       case LINE6_DEVID_PODHD500:
        case LINE6_DEVID_PODX3:
        case LINE6_DEVID_PODX3LIVE:
                ep_read = 0x86;
index 4e133641fa793b84c6e251629d32ba8f89b38d55..aff9e5caea468f745d887b736a5bb7c051ac856a 100644 (file)
@@ -24,6 +24,8 @@
 #define LINE6_DEVID_BASSPODXTPRO  0x4252
 #define LINE6_DEVID_GUITARPORT    0x4750
 #define LINE6_DEVID_POCKETPOD     0x5051
+#define LINE6_DEVID_PODHD300      0x5057
+#define LINE6_DEVID_PODHD500      0x414D
 #define LINE6_DEVID_PODSTUDIO_GX  0x4153
 #define LINE6_DEVID_PODSTUDIO_UX1 0x4150
 #define LINE6_DEVID_PODSTUDIO_UX2 0x4151
 #define LINE6_DEVID_TONEPORT_UX1  0x4141
 #define LINE6_DEVID_TONEPORT_UX2  0x4142
 #define LINE6_DEVID_VARIAX        0x534d
-#define LINE6_DEVID_PODHD300      0x5057
 
-#define LINE6_BIT_BASSPODXT       (1 <<  0)
-#define LINE6_BIT_BASSPODXTLIVE   (1 <<  1)
-#define LINE6_BIT_BASSPODXTPRO    (1 <<  2)
-#define LINE6_BIT_GUITARPORT      (1 <<  3)
-#define LINE6_BIT_POCKETPOD       (1 <<  4)
-#define LINE6_BIT_PODSTUDIO_GX    (1 <<  5)
-#define LINE6_BIT_PODSTUDIO_UX1   (1 <<  6)
-#define LINE6_BIT_PODSTUDIO_UX2   (1 <<  7)
-#define LINE6_BIT_PODX3           (1 <<  8)
-#define LINE6_BIT_PODX3LIVE       (1 <<  9)
-#define LINE6_BIT_PODXT           (1 << 10)
-#define LINE6_BIT_PODXTLIVE       (1 << 11)
-#define LINE6_BIT_PODXTPRO        (1 << 12)
-#define LINE6_BIT_TONEPORT_GX     (1 << 13)
-#define LINE6_BIT_TONEPORT_UX1    (1 << 14)
-#define LINE6_BIT_TONEPORT_UX2    (1 << 15)
-#define LINE6_BIT_VARIAX          (1 << 16)
-#define LINE6_BIT_PODHD300        (1 << 17)
+enum {
+       LINE6_ID_BASSPODXT,
+       LINE6_ID_BASSPODXTLIVE,
+       LINE6_ID_BASSPODXTPRO,
+       LINE6_ID_GUITARPORT,
+       LINE6_ID_POCKETPOD,
+       LINE6_ID_PODHD300,
+       LINE6_ID_PODHD500,
+       LINE6_ID_PODSTUDIO_GX,
+       LINE6_ID_PODSTUDIO_UX1,
+       LINE6_ID_PODSTUDIO_UX2,
+       LINE6_ID_PODX3,
+       LINE6_ID_PODX3LIVE,
+       LINE6_ID_PODXT,
+       LINE6_ID_PODXTLIVE,
+       LINE6_ID_PODXTPRO,
+       LINE6_ID_TONEPORT_GX,
+       LINE6_ID_TONEPORT_UX1,
+       LINE6_ID_TONEPORT_UX2,
+       LINE6_ID_VARIAX
+};
+
+#define LINE6_BIT(x) LINE6_BIT_ ## x = 1 << LINE6_ID_ ## x
+
+enum {
+       LINE6_BIT(BASSPODXT),
+       LINE6_BIT(BASSPODXTLIVE),
+       LINE6_BIT(BASSPODXTPRO),
+       LINE6_BIT(GUITARPORT),
+       LINE6_BIT(POCKETPOD),
+       LINE6_BIT(PODHD300),
+       LINE6_BIT(PODHD500),
+       LINE6_BIT(PODSTUDIO_GX),
+       LINE6_BIT(PODSTUDIO_UX1),
+       LINE6_BIT(PODSTUDIO_UX2),
+       LINE6_BIT(PODX3),
+       LINE6_BIT(PODX3LIVE),
+       LINE6_BIT(PODXT),
+       LINE6_BIT(PODXTLIVE),
+       LINE6_BIT(PODXTPRO),
+       LINE6_BIT(TONEPORT_GX),
+       LINE6_BIT(TONEPORT_UX1),
+       LINE6_BIT(TONEPORT_UX2),
+       LINE6_BIT(VARIAX),
 
-#define LINE6_BITS_PRO         (LINE6_BIT_BASSPODXTPRO | \
-                                LINE6_BIT_PODXTPRO)
-#define LINE6_BITS_LIVE                (LINE6_BIT_BASSPODXTLIVE | \
-                                LINE6_BIT_PODXTLIVE | \
-                                LINE6_BIT_PODX3LIVE)
-#define LINE6_BITS_PODXTALL    (LINE6_BIT_PODXT | \
-                                LINE6_BIT_PODXTLIVE | \
-                                LINE6_BIT_PODXTPRO)
-#define LINE6_BITS_BASSPODXTALL        (LINE6_BIT_BASSPODXT | \
-                                LINE6_BIT_BASSPODXTLIVE | \
-                                LINE6_BIT_BASSPODXTPRO)
+       LINE6_BITS_PRO = LINE6_BIT_BASSPODXTPRO | LINE6_BIT_PODXTPRO,
+       LINE6_BITS_LIVE = LINE6_BIT_BASSPODXTLIVE | LINE6_BIT_PODXTLIVE | LINE6_BIT_PODX3LIVE,
+       LINE6_BITS_PODXTALL = LINE6_BIT_PODXT | LINE6_BIT_PODXTLIVE | LINE6_BIT_PODXTPRO,
+       LINE6_BITS_PODX3ALL = LINE6_BIT_PODX3 | LINE6_BIT_PODX3LIVE,
+       LINE6_BITS_PODHDALL = LINE6_BIT_PODHD300 | LINE6_BIT_PODHD500,
+       LINE6_BITS_BASSPODXTALL = LINE6_BIT_BASSPODXT | LINE6_BIT_BASSPODXTLIVE | LINE6_BIT_BASSPODXTPRO
+};
 
 /* device supports settings parameter via USB */
-#define LINE6_BIT_CONTROL      (1 << 0)
+#define LINE6_BIT_CONTROL (1 << 0)
 /* device supports PCM input/output via USB */
-#define LINE6_BIT_PCM          (1 << 1)
+#define LINE6_BIT_PCM (1 << 1)
 /* device support hardware monitoring */
-#define LINE6_BIT_HWMON                (1 << 2)
+#define LINE6_BIT_HWMON (1 << 2)
 
 #define LINE6_BIT_CONTROL_PCM_HWMON    (LINE6_BIT_CONTROL |    \
                                         LINE6_BIT_PCM |        \
                                         LINE6_BIT_HWMON)
 
-#define LINE6_FALLBACK_INTERVAL                10
-#define LINE6_FALLBACK_MAXPACKETSIZE   16
+#define LINE6_FALLBACK_INTERVAL 10
+#define LINE6_FALLBACK_MAXPACKETSIZE 16
 
 #endif