diff options
author | Andrej Krutak <dev@andree.sk> | 2016-09-18 21:59:32 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-09-20 00:03:47 +0300 |
commit | a16039cbf1a1ee7e76d7d100f9e613998919ab91 (patch) | |
tree | a12d4bd94723c8ea609b71973bc3aa499322bbb6 /sound/usb/line6/driver.h | |
parent | cfa769695d2bc50b729db6a5973398b24d126c79 (diff) | |
download | linux-a16039cbf1a1ee7e76d7d100f9e613998919ab91.tar.xz |
ALSA: line6: Add hwdep interface to access the POD control messages
We must do it this way, because e.g. POD X3 won't play any sound unless
the host listens on the bulk EP, so we cannot export it only via libusb.
The driver currently doesn't use the bulk EP messages in other way,
in future it could e.g. sense/modify volume(s).
Signed-off-by: Andrej Krutak <dev@andree.sk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6/driver.h')
-rw-r--r-- | sound/usb/line6/driver.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h index 88cf1e750060..7e3a3aada222 100644 --- a/sound/usb/line6/driver.h +++ b/sound/usb/line6/driver.h @@ -12,8 +12,9 @@ #ifndef DRIVER_H #define DRIVER_H -#include <linux/spinlock.h> #include <linux/usb.h> +#include <linux/mutex.h> +#include <linux/kfifo.h> #include <sound/core.h> #include "midi.h" @@ -32,7 +33,16 @@ #define LINE6_TIMEOUT 1 #define LINE6_BUFSIZE_LISTEN 64 -#define LINE6_MESSAGE_MAXLEN 256 +#define LINE6_MIDI_MESSAGE_MAXLEN 256 + +#define LINE6_RAW_MESSAGES_MAXCOUNT_ORDER 7 +/* 4k packets are common, BUFSIZE * MAXCOUNT should be bigger... */ +#define LINE6_RAW_MESSAGES_MAXCOUNT (1 << LINE6_RAW_MESSAGES_MAXCOUNT_ORDER) + + +#if LINE6_BUFSIZE_LISTEN > 65535 +#error "Use dynamic fifo instead" +#endif /* Line 6 MIDI control commands @@ -156,6 +166,15 @@ struct usb_line6 { /* Length of message to be processed, generated from MIDI layer */ int message_length; + /* Circular buffer for non-MIDI control messages */ + struct { + struct mutex read_lock; + wait_queue_head_t wait_queue; + unsigned int active:1; + STRUCT_KFIFO_REC_2(LINE6_BUFSIZE_LISTEN * LINE6_RAW_MESSAGES_MAXCOUNT) + fifo; + } messages; + /* If MIDI is supported, buffer_message contains the pre-processed data; * otherwise the data is only in urb_listen (buffer_incoming). */ |