#include "capture.h"
#include "driver.h"
#include "playback.h"
-#include "usbdefs.h"
enum line6_device_type {
LINE6_GUITARPORT,
};
struct usb_line6_toneport {
- /**
- Generic Line 6 USB data.
- */
+ /* Generic Line 6 USB data */
struct usb_line6 line6;
- /**
- Source selector.
- */
+ /* Source selector */
int source;
- /**
- Serial number of device.
- */
- int serial_number;
+ /* Serial number of device */
+ u32 serial_number;
- /**
- Firmware version (x 100).
- */
- int firmware_version;
+ /* Firmware version (x 100) */
+ u8 firmware_version;
- /**
- Timer for delayed PCM startup.
- */
+ /* Timer for delayed PCM startup */
struct timer_list timer;
- /**
- Device type.
- */
+ /* Device type */
enum line6_device_type type;
/* LED instances */
};
static struct line6_pcm_properties toneport_pcm_properties = {
- .snd_line6_playback_hw = {
+ .playback_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
.period_bytes_max = 8192,
.periods_min = 1,
.periods_max = 1024},
- .snd_line6_capture_hw = {
+ .capture_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
.period_bytes_max = 8192,
.periods_min = 1,
.periods_max = 1024},
- .snd_line6_rates = {
+ .rates = {
.nrats = 1,
.rats = &toneport_ratden},
.bytes_per_frame = 4
(void cmd_0x02(byte red, byte green)
*/
-static bool toneport_has_led(enum line6_device_type type)
+static bool toneport_has_led(struct usb_line6_toneport *toneport)
{
- return
- (type == LINE6_GUITARPORT) ||
- (type == LINE6_TONEPORT_GX);
+ switch (toneport->type) {
+ case LINE6_GUITARPORT:
+ case LINE6_TONEPORT_GX:
/* add your device here if you are missing support for the LEDs */
+ return true;
+
+ default:
+ return false;
+ }
}
static const char * const led_colors[2] = { "red", "green" };
}
}
+static bool toneport_has_source_select(struct usb_line6_toneport *toneport)
+{
+ switch (toneport->type) {
+ case LINE6_TONEPORT_UX1:
+ case LINE6_TONEPORT_UX2:
+ case LINE6_PODSTUDIO_UX1:
+ case LINE6_PODSTUDIO_UX2:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
/*
Setup Toneport device.
*/
toneport_send_cmd(usbdev, 0x0301, 0x0000);
/* initialize source select: */
- switch (toneport->type) {
- case LINE6_TONEPORT_UX1:
- case LINE6_TONEPORT_UX2:
- case LINE6_PODSTUDIO_UX1:
- case LINE6_PODSTUDIO_UX2:
+ if (toneport_has_source_select(toneport))
toneport_send_cmd(usbdev,
toneport_source_info[toneport->source].code,
0x0000);
- default:
- break;
- }
- if (toneport_has_led(toneport->type))
+ if (toneport_has_led(toneport))
toneport_update_led(toneport);
mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
del_timer_sync(&toneport->timer);
- if (toneport_has_led(toneport->type))
+ if (toneport_has_led(toneport))
toneport_remove_leds(toneport);
}
return err;
/* register source select control: */
- switch (toneport->type) {
- case LINE6_TONEPORT_UX1:
- case LINE6_TONEPORT_UX2:
- case LINE6_PODSTUDIO_UX1:
- case LINE6_PODSTUDIO_UX2:
+ if (toneport_has_source_select(toneport)) {
err =
snd_ctl_add(line6->card,
snd_ctl_new1(&toneport_control_source,
line6->line6pcm));
if (err < 0)
return err;
-
- default:
- break;
}
line6_read_serial_number(line6, &toneport->serial_number);
line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
- if (toneport_has_led(toneport->type)) {
+ if (toneport_has_led(toneport)) {
err = toneport_init_leds(toneport);
if (err < 0)
return err;
static int toneport_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
- return line6_probe(interface, id,
+ return line6_probe(interface, id, "Line6-TonePort",
&toneport_properties_table[id->driver_info],
toneport_init, sizeof(struct usb_line6_toneport));
}