aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/line6/toneport.c
diff options
context:
space:
mode:
authorMarkus Grabner <grabner@icg.tugraz.at>2010-08-23 01:08:25 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-31 15:28:16 -0700
commite1a164d7a3e05aae15eb603ee8f1b77446480a3b (patch)
tree829d6ed586e9fe3680be24faab8c61d5c596443e /drivers/staging/line6/toneport.c
parent1027f476f507ef7ed9919cd3e3d32310f3985da1 (diff)
Staging: line6: another upstream sync
Everything should be in sync now. Signed-off-by: Markus Grabner <grabner@icg.tugraz.at> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/line6/toneport.c')
-rw-r--r--drivers/staging/line6/toneport.c143
1 files changed, 77 insertions, 66 deletions
diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c
index 0e7e871507c..d4ac734d744 100644
--- a/drivers/staging/line6/toneport.c
+++ b/drivers/staging/line6/toneport.c
@@ -1,5 +1,5 @@
/*
- * Line6 Linux USB driver - 0.9.0
+ * Line6 Linux USB driver - 0.9.1beta
*
* Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
* Emil Myhrman (emil.myhrman@gmail.com)
@@ -19,13 +19,10 @@
#include "playback.h"
#include "toneport.h"
-
static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2);
-
#define TONEPORT_PCM_DELAY 1
-
static struct snd_ratden toneport_ratden = {
.num_min = 44100,
.num_max = 44100,
@@ -35,52 +32,49 @@ static struct snd_ratden toneport_ratden = {
static struct line6_pcm_properties toneport_pcm_properties = {
.snd_line6_playback_hw = {
- .info = (SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_INTERLEAVED |
- SNDRV_PCM_INFO_BLOCK_TRANSFER |
- SNDRV_PCM_INFO_MMAP_VALID |
- SNDRV_PCM_INFO_PAUSE |
+ .info = (SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_MMAP_VALID |
+ SNDRV_PCM_INFO_PAUSE |
#ifdef CONFIG_PM
- SNDRV_PCM_INFO_RESUME |
+ SNDRV_PCM_INFO_RESUME |
#endif
- SNDRV_PCM_INFO_SYNC_START),
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- .rates = SNDRV_PCM_RATE_KNOT,
- .rate_min = 44100,
- .rate_max = 44100,
- .channels_min = 2,
- .channels_max = 2,
- .buffer_bytes_max = 60000,
- .period_bytes_min = 64,
- .period_bytes_max = 8192,
- .periods_min = 1,
- .periods_max = 1024
- },
+ SNDRV_PCM_INFO_SYNC_START),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .rates = SNDRV_PCM_RATE_KNOT,
+ .rate_min = 44100,
+ .rate_max = 44100,
+ .channels_min = 2,
+ .channels_max = 2,
+ .buffer_bytes_max = 60000,
+ .period_bytes_min = 64,
+ .period_bytes_max = 8192,
+ .periods_min = 1,
+ .periods_max = 1024},
.snd_line6_capture_hw = {
- .info = (SNDRV_PCM_INFO_MMAP |
- SNDRV_PCM_INFO_INTERLEAVED |
- SNDRV_PCM_INFO_BLOCK_TRANSFER |
- SNDRV_PCM_INFO_MMAP_VALID |
+ .info = (SNDRV_PCM_INFO_MMAP |
+ SNDRV_PCM_INFO_INTERLEAVED |
+ SNDRV_PCM_INFO_BLOCK_TRANSFER |
+ SNDRV_PCM_INFO_MMAP_VALID |
#ifdef CONFIG_PM
- SNDRV_PCM_INFO_RESUME |
+ SNDRV_PCM_INFO_RESUME |
#endif
- SNDRV_PCM_INFO_SYNC_START),
- .formats = SNDRV_PCM_FMTBIT_S16_LE,
- .rates = SNDRV_PCM_RATE_KNOT,
- .rate_min = 44100,
- .rate_max = 44100,
- .channels_min = 2,
- .channels_max = 2,
- .buffer_bytes_max = 60000,
- .period_bytes_min = 64,
- .period_bytes_max = 8192,
- .periods_min = 1,
- .periods_max = 1024
- },
+ SNDRV_PCM_INFO_SYNC_START),
+ .formats = SNDRV_PCM_FMTBIT_S16_LE,
+ .rates = SNDRV_PCM_RATE_KNOT,
+ .rate_min = 44100,
+ .rate_max = 44100,
+ .channels_min = 2,
+ .channels_max = 2,
+ .buffer_bytes_max = 60000,
+ .period_bytes_min = 64,
+ .period_bytes_max = 8192,
+ .periods_min = 1,
+ .periods_max = 1024},
.snd_line6_rates = {
- .nrats = 1,
- .rats = &toneport_ratden
- },
+ .nrats = 1,
+ .rats = &toneport_ratden},
.bytes_per_frame = 4
};
@@ -93,24 +87,23 @@ static struct line6_pcm_properties toneport_pcm_properties = {
static int led_red = 0x00;
static int led_green = 0x26;
-struct ToneportSourceInfo
-{
+struct ToneportSourceInfo {
const char *name;
int code;
};
static const struct ToneportSourceInfo toneport_source_info[] = {
- { "Microphone", 0x0a01 },
- { "Line" , 0x0801 },
- { "Instrument", 0x0b01 },
- { "Inst & Mic", 0x0901 }
+ {"Microphone", 0x0a01},
+ {"Line", 0x0801},
+ {"Instrument", 0x0b01},
+ {"Inst & Mic", 0x0901}
};
static bool toneport_has_led(short product)
{
return
- (product == LINE6_DEVID_GUITARPORT) ||
- (product == LINE6_DEVID_TONEPORT_GX);
+ (product == LINE6_DEVID_GUITARPORT) ||
+ (product == LINE6_DEVID_TONEPORT_GX);
/* add your device here if you are missing support for the LEDs */
}
@@ -166,7 +159,6 @@ static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read,
static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read,
toneport_set_led_green);
-
static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2)
{
int ret;
@@ -209,10 +201,16 @@ static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol,
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- if(ucontrol->value.integer.value[0] == line6pcm->volume_monitor)
+ if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor)
return 0;
line6pcm->volume_monitor = ucontrol->value.integer.value[0];
+
+ if (line6pcm->volume_monitor > 0)
+ line6_pcm_start(line6pcm, MASK_PCM_MONITOR);
+ else
+ line6_pcm_stop(line6pcm, MASK_PCM_MONITOR);
+
return 1;
}
@@ -225,7 +223,7 @@ static int snd_toneport_source_info(struct snd_kcontrol *kcontrol,
uinfo->count = 1;
uinfo->value.enumerated.items = size;
- if(uinfo->value.enumerated.item >= size)
+ if (uinfo->value.enumerated.item >= size)
uinfo->value.enumerated.item = size - 1;
strcpy(uinfo->value.enumerated.name,
@@ -239,7 +237,8 @@ static int snd_toneport_source_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)line6pcm->line6;
+ struct usb_line6_toneport *toneport =
+ (struct usb_line6_toneport *)line6pcm->line6;
ucontrol->value.enumerated.item[0] = toneport->source;
return 0;
}
@@ -249,13 +248,15 @@ static int snd_toneport_source_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
- struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)line6pcm->line6;
+ struct usb_line6_toneport *toneport =
+ (struct usb_line6_toneport *)line6pcm->line6;
- if(ucontrol->value.enumerated.item[0] == toneport->source)
+ if (ucontrol->value.enumerated.item[0] == toneport->source)
return 0;
toneport->source = ucontrol->value.enumerated.item[0];
- toneport_send_cmd(toneport->line6.usbdev, toneport_source_info[toneport->source].code, 0x0000);
+ toneport_send_cmd(toneport->line6.usbdev,
+ toneport_source_info[toneport->source].code, 0x0000);
return 1;
}
@@ -321,10 +322,12 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
toneport_send_cmd(usbdev, 0x0301, 0x0000);
/* initialize source select: */
- switch(usbdev->descriptor.idProduct) {
+ switch (usbdev->descriptor.idProduct) {
case LINE6_DEVID_TONEPORT_UX1:
case LINE6_DEVID_PODSTUDIO_UX1:
- toneport_send_cmd(usbdev, toneport_source_info[toneport->source].code, 0x0000);
+ toneport_send_cmd(usbdev,
+ toneport_source_info[toneport->source].code,
+ 0x0000);
}
if (toneport_has_led(usbdev->descriptor.idProduct))
@@ -357,16 +360,22 @@ static int toneport_try_init(struct usb_interface *interface,
}
/* register monitor control: */
- err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_monitor, line6->line6pcm));
+ err =
+ snd_ctl_add(line6->card,
+ snd_ctl_new1(&toneport_control_monitor,
+ line6->line6pcm));
if (err < 0) {
return err;
}
/* register source select control: */
- switch(usbdev->descriptor.idProduct) {
+ switch (usbdev->descriptor.idProduct) {
case LINE6_DEVID_TONEPORT_UX1:
case LINE6_DEVID_PODSTUDIO_UX1:
- err = snd_ctl_add(line6->card, snd_ctl_new1(&toneport_control_source, line6->line6pcm));
+ err =
+ snd_ctl_add(line6->card,
+ snd_ctl_new1(&toneport_control_source,
+ line6->line6pcm));
if (err < 0) {
return err;
}
@@ -382,8 +391,10 @@ static int toneport_try_init(struct usb_interface *interface,
line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
if (toneport_has_led(usbdev->descriptor.idProduct)) {
- CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_red));
- CHECK_RETURN(device_create_file(&interface->dev, &dev_attr_led_green));
+ CHECK_RETURN(device_create_file
+ (&interface->dev, &dev_attr_led_red));
+ CHECK_RETURN(device_create_file
+ (&interface->dev, &dev_attr_led_green));
}
toneport_setup(toneport);