aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/caiaq/caiaq-device.h
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.org>2007-03-26 13:11:24 -0400
committerJaroslav Kysela <perex@suse.cz>2007-05-11 10:55:53 -0400
commit523f1dce37434a9a6623bf46e7893e2b4b10ac3c (patch)
tree6f429b936089a79864c4b29d72011583f0f998e2 /sound/usb/caiaq/caiaq-device.h
parente24a121aa1070fc91b6461b8b88bb6ffa61b4b49 (diff)
[ALSA] Add Native Instrument usb audio device support
Add snd-usb-caiaq driver to support caiaq usb-audio devices from Native Instrument: * Native Instruments RigKontrol2 * Native Instruments Kore Controller * Native Instruments Audio Kontrol 1 * Native Instruments Audio 8 DJ Signed-off-by: Daniel Mack <daniel@caiaq.org> Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/usb/caiaq/caiaq-device.h')
-rw-r--r--sound/usb/caiaq/caiaq-device.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/sound/usb/caiaq/caiaq-device.h b/sound/usb/caiaq/caiaq-device.h
new file mode 100644
index 000000000000..088d5ec241f3
--- /dev/null
+++ b/sound/usb/caiaq/caiaq-device.h
@@ -0,0 +1,116 @@
1#ifndef CAIAQ_DEVICE_H
2#define CAIAQ_DEVICE_H
3
4#include "../usbaudio.h"
5
6#define USB_VID_NATIVEINSTRUMENTS 0x17cc
7
8#define USB_PID_RIGKONTROL2 0x1969
9#define USB_PID_KORECONTROLLER 0x4711
10#define USB_PID_AK1 0x0815
11#define USB_PID_AUDIO8DJ 0x1978
12
13#define EP1_BUFSIZE 64
14#define CAIAQ_USB_STR_LEN 0xff
15#define MAX_STREAMS 32
16
17//#define SND_USB_CAIAQ_DEBUG
18
19#define MODNAME "snd-usb-caiaq"
20#define log(x...) snd_printk(KERN_WARNING MODNAME" log: " x)
21
22#ifdef SND_USB_CAIAQ_DEBUG
23#define debug(x...) snd_printk(KERN_WARNING MODNAME " debug: " x)
24#else
25#define debug(x...) do { } while(0)
26#endif
27
28#define EP1_CMD_GET_DEVICE_INFO 0x1
29#define EP1_CMD_READ_ERP 0x2
30#define EP1_CMD_READ_ANALOG 0x3
31#define EP1_CMD_READ_IO 0x4
32#define EP1_CMD_WRITE_IO 0x5
33#define EP1_CMD_MIDI_READ 0x6
34#define EP1_CMD_MIDI_WRITE 0x7
35#define EP1_CMD_AUDIO_PARAMS 0x9
36#define EP1_CMD_AUTO_MSG 0xb
37
38struct caiaq_device_spec {
39 unsigned short fw_version;
40 unsigned char hw_subtype;
41 unsigned char num_erp;
42 unsigned char num_analog_in;
43 unsigned char num_digital_in;
44 unsigned char num_digital_out;
45 unsigned char num_analog_audio_out;
46 unsigned char num_analog_audio_in;
47 unsigned char num_digital_audio_out;
48 unsigned char num_digital_audio_in;
49 unsigned char num_midi_out;
50 unsigned char num_midi_in;
51 unsigned char data_alignment;
52} __attribute__ ((packed));
53
54struct snd_usb_caiaq_cb_info;
55
56struct snd_usb_caiaqdev {
57 struct snd_usb_audio chip;
58
59 struct urb ep1_in_urb;
60 struct urb midi_out_urb;
61 struct urb **data_urbs_in;
62 struct urb **data_urbs_out;
63 struct snd_usb_caiaq_cb_info *data_cb_info;
64
65 unsigned char ep1_in_buf[EP1_BUFSIZE];
66 unsigned char ep1_out_buf[EP1_BUFSIZE];
67 unsigned char midi_out_buf[EP1_BUFSIZE];
68
69 struct caiaq_device_spec spec;
70 spinlock_t spinlock;
71 wait_queue_head_t ep1_wait_queue;
72 wait_queue_head_t prepare_wait_queue;
73 int spec_received, audio_parm_answer;
74
75 char vendor_name[CAIAQ_USB_STR_LEN];
76 char product_name[CAIAQ_USB_STR_LEN];
77 char serial[CAIAQ_USB_STR_LEN];
78
79 int n_streams, n_audio_in, n_audio_out;
80 int streaming, first_packet, output_running;
81 int audio_in_buf_pos[MAX_STREAMS];
82 int audio_out_buf_pos[MAX_STREAMS];
83 int period_in_count[MAX_STREAMS];
84 int period_out_count[MAX_STREAMS];
85 int input_panic, output_panic;
86 char *audio_in_buf, *audio_out_buf;
87 unsigned int samplerates;
88
89 struct snd_pcm_substream *sub_playback[MAX_STREAMS];
90 struct snd_pcm_substream *sub_capture[MAX_STREAMS];
91
92 /* Linux input */
93#ifdef CONFIG_SND_USB_CAIAQ_INPUT
94 struct input_dev *input_dev;
95#endif
96
97 /* ALSA */
98 struct snd_pcm *pcm;
99 struct snd_pcm_hardware pcm_info;
100 struct snd_rawmidi *rmidi;
101 struct snd_rawmidi_substream *midi_receive_substream;
102 struct snd_rawmidi_substream *midi_out_substream;
103};
104
105struct snd_usb_caiaq_cb_info {
106 struct snd_usb_caiaqdev *dev;
107 int index;
108};
109
110#define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data)
111
112int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp);
113int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp);
114
115
116#endif /* CAIAQ_DEVICE_H */