Skip to content

Commit

Permalink
staging: line6: Move altsetting to properties
Browse files Browse the repository at this point in the history
The device type can now be used to determine the altsetting for the
interface.  Drop the conditional logic and make this value a property.

Signed-off-by: Chris Rorvick <chris@rorvick.com>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Chris Rorvick authored and Takashi Iwai committed Jan 12, 2015
1 parent b98a811 commit 7b9584f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 51 deletions.
74 changes: 23 additions & 51 deletions drivers/staging/line6/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,121 +67,141 @@ static const struct line6_properties line6_properties_table[] = {
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 5,
},
[LINE6_BASSPODXTLIVE] = {
.id = "BassPODxtLive",
.name = "BassPODxt Live",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 1,
},
[LINE6_BASSPODXTPRO] = {
.id = "BassPODxtPro",
.name = "BassPODxt Pro",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 5,
},
[LINE6_GUITARPORT] = {
.id = "GuitarPort",
.name = "GuitarPort",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* 1..4 seem to be ok */
},
[LINE6_POCKETPOD] = {
.id = "PocketPOD",
.name = "Pocket POD",
.capabilities = LINE6_CAP_CONTROL,
.altsetting = 0,
},
[LINE6_PODHD300] = {
.id = "PODHD300",
.name = "POD HD300",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 5,
},
[LINE6_PODHD400] = {
.id = "PODHD400",
.name = "POD HD400",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 5,
},
[LINE6_PODHD500_0] = {
.id = "PODHD500",
.name = "POD HD500",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 1,
},
[LINE6_PODHD500_1] = {
.id = "PODHD500",
.name = "POD HD500",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 1,
},
[LINE6_PODSTUDIO_GX] = {
.id = "PODStudioGX",
.name = "POD Studio GX",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* 1..4 seem to be ok */
},
[LINE6_PODSTUDIO_UX1] = {
.id = "PODStudioUX1",
.name = "POD Studio UX1",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* 1..4 seem to be ok */
},
[LINE6_PODSTUDIO_UX2] = {
.id = "PODStudioUX2",
.name = "POD Studio UX2",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* defaults to 44.1kHz, 16-bit */
},
[LINE6_PODXT] = {
.id = "PODxt",
.name = "PODxt",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 5,
},
[LINE6_PODXTLIVE_POD] = {
.id = "PODxtLive",
.name = "PODxt Live",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 1,
},
[LINE6_PODXTLIVE_VARIAX] = {
.id = "PODxtLive",
.name = "PODxt Live",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 1,
},
[LINE6_PODXTPRO] = {
.id = "PODxtPro",
.name = "PODxt Pro",
.capabilities = LINE6_CAP_CONTROL
| LINE6_CAP_PCM
| LINE6_CAP_HWMON,
.altsetting = 5,
},
[LINE6_TONEPORT_GX] = {
.id = "TonePortGX",
.name = "TonePort GX",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* 1..4 seem to be ok */
},
[LINE6_TONEPORT_UX1] = {
.id = "TonePortUX1",
.name = "TonePort UX1",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* 1..4 seem to be ok */
},
[LINE6_TONEPORT_UX2] = {
.id = "TonePortUX2",
.name = "TonePort UX2",
.capabilities = LINE6_CAP_PCM,
.altsetting = 2, /* defaults to 44.1kHz, 16-bit */
},
[LINE6_VARIAX] = {
.id = "Variax",
.name = "Variax Workbench",
.capabilities = LINE6_CAP_CONTROL,
.altsetting = 1,
}
};

Expand Down Expand Up @@ -703,7 +723,7 @@ static int line6_probe(struct usb_interface *interface,
struct usb_device *usbdev;
struct usb_line6 *line6;
const struct line6_properties *properties;
int interface_number, alternate = 0;
int interface_number;
int size = 0;
int ep_read = 0, ep_write = 0;
int ret;
Expand All @@ -729,56 +749,8 @@ static int line6_probe(struct usb_interface *interface,
/* query interface number */
interface_number = interface->cur_altsetting->desc.bInterfaceNumber;

switch (devtype) {
case LINE6_BASSPODXTLIVE:
case LINE6_PODXTLIVE_POD:
case LINE6_PODXTLIVE_VARIAX:
case LINE6_VARIAX:
alternate = 1;
break;

case LINE6_POCKETPOD:
alternate = 0;
break;

case LINE6_PODHD500_0:
alternate = 1;
break;

case LINE6_PODHD500_1:
alternate = 0;
break;

case LINE6_BASSPODXT:
case LINE6_BASSPODXTPRO:
case LINE6_PODXT:
case LINE6_PODXTPRO:
case LINE6_PODHD300:
case LINE6_PODHD400:
alternate = 5;
break;

case LINE6_GUITARPORT:
case LINE6_PODSTUDIO_GX:
case LINE6_PODSTUDIO_UX1:
case LINE6_TONEPORT_GX:
case LINE6_TONEPORT_UX1:
alternate = 2; /* 1..4 seem to be ok */
break;

case LINE6_TONEPORT_UX2:
case LINE6_PODSTUDIO_UX2:
/* defaults to 44.1kHz, 16-bit */
alternate = 2;
break;

default:
MISSING_CASE;
ret = -ENODEV;
goto err_put;
}

ret = usb_set_interface(usbdev, interface_number, alternate);
ret = usb_set_interface(usbdev, interface_number,
properties->altsetting);
if (ret < 0) {
dev_err(&interface->dev, "set_interface failed\n");
goto err_put;
Expand Down
2 changes: 2 additions & 0 deletions drivers/staging/line6/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ struct line6_properties {
line6usb driver.
*/
int capabilities;

int altsetting;
};

/**
Expand Down

0 comments on commit 7b9584f

Please sign in to comment.