]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
523f1dce DM |
2 | #ifndef CAIAQ_DEVICE_H |
3 | #define CAIAQ_DEVICE_H | |
4 | ||
5 | #include "../usbaudio.h" | |
6 | ||
7 | #define USB_VID_NATIVEINSTRUMENTS 0x17cc | |
8 | ||
6da7a2aa DM |
9 | #define USB_PID_RIGKONTROL2 0x1969 |
10 | #define USB_PID_RIGKONTROL3 0x1940 | |
11 | #define USB_PID_KORECONTROLLER 0x4711 | |
12 | #define USB_PID_KORECONTROLLER2 0x4712 | |
13 | #define USB_PID_AK1 0x0815 | |
14 | #define USB_PID_AUDIO2DJ 0x041c | |
15 | #define USB_PID_AUDIO4DJ 0x0839 | |
16 | #define USB_PID_AUDIO8DJ 0x1978 | |
17 | #define USB_PID_SESSIONIO 0x1915 | |
18 | #define USB_PID_GUITARRIGMOBILE 0x0d8d | |
19 | #define USB_PID_TRAKTORKONTROLX1 0x2305 | |
15c5ab60 | 20 | #define USB_PID_TRAKTORKONTROLS4 0xbaff |
df8d81a3 | 21 | #define USB_PID_TRAKTORAUDIO2 0x041d |
e653510a | 22 | #define USB_PID_MASCHINECONTROLLER 0x0808 |
523f1dce DM |
23 | |
24 | #define EP1_BUFSIZE 64 | |
6da7a2aa | 25 | #define EP4_BUFSIZE 512 |
523f1dce DM |
26 | #define CAIAQ_USB_STR_LEN 0xff |
27 | #define MAX_STREAMS 32 | |
28 | ||
523f1dce | 29 | #define MODNAME "snd-usb-caiaq" |
523f1dce DM |
30 | |
31 | #define EP1_CMD_GET_DEVICE_INFO 0x1 | |
32 | #define EP1_CMD_READ_ERP 0x2 | |
33 | #define EP1_CMD_READ_ANALOG 0x3 | |
34 | #define EP1_CMD_READ_IO 0x4 | |
35 | #define EP1_CMD_WRITE_IO 0x5 | |
36 | #define EP1_CMD_MIDI_READ 0x6 | |
37 | #define EP1_CMD_MIDI_WRITE 0x7 | |
38 | #define EP1_CMD_AUDIO_PARAMS 0x9 | |
39 | #define EP1_CMD_AUTO_MSG 0xb | |
8e3cd08e | 40 | #define EP1_CMD_DIMM_LEDS 0xc |
523f1dce DM |
41 | |
42 | struct caiaq_device_spec { | |
43 | unsigned short fw_version; | |
44 | unsigned char hw_subtype; | |
45 | unsigned char num_erp; | |
46 | unsigned char num_analog_in; | |
47 | unsigned char num_digital_in; | |
48 | unsigned char num_digital_out; | |
49 | unsigned char num_analog_audio_out; | |
50 | unsigned char num_analog_audio_in; | |
51 | unsigned char num_digital_audio_out; | |
52 | unsigned char num_digital_audio_in; | |
53 | unsigned char num_midi_out; | |
54 | unsigned char num_midi_in; | |
55 | unsigned char data_alignment; | |
56 | } __attribute__ ((packed)); | |
57 | ||
58 | struct snd_usb_caiaq_cb_info; | |
59 | ||
60 | struct snd_usb_caiaqdev { | |
61 | struct snd_usb_audio chip; | |
62 | ||
63 | struct urb ep1_in_urb; | |
64 | struct urb midi_out_urb; | |
65 | struct urb **data_urbs_in; | |
66 | struct urb **data_urbs_out; | |
67 | struct snd_usb_caiaq_cb_info *data_cb_info; | |
b18b493f | 68 | |
523f1dce DM |
69 | unsigned char ep1_in_buf[EP1_BUFSIZE]; |
70 | unsigned char ep1_out_buf[EP1_BUFSIZE]; | |
71 | unsigned char midi_out_buf[EP1_BUFSIZE]; | |
72 | ||
73 | struct caiaq_device_spec spec; | |
74 | spinlock_t spinlock; | |
75 | wait_queue_head_t ep1_wait_queue; | |
76 | wait_queue_head_t prepare_wait_queue; | |
77 | int spec_received, audio_parm_answer; | |
f3f80a92 | 78 | int midi_out_active; |
b18b493f | 79 | |
523f1dce DM |
80 | char vendor_name[CAIAQ_USB_STR_LEN]; |
81 | char product_name[CAIAQ_USB_STR_LEN]; | |
523f1dce DM |
82 | |
83 | int n_streams, n_audio_in, n_audio_out; | |
84 | int streaming, first_packet, output_running; | |
85 | int audio_in_buf_pos[MAX_STREAMS]; | |
86 | int audio_out_buf_pos[MAX_STREAMS]; | |
87 | int period_in_count[MAX_STREAMS]; | |
88 | int period_out_count[MAX_STREAMS]; | |
1313e704 | 89 | int input_panic, output_panic, warned; |
523f1dce | 90 | char *audio_in_buf, *audio_out_buf; |
9311c9b4 | 91 | unsigned int samplerates, bpp; |
da6094ea | 92 | unsigned long outurb_active_mask; |
523f1dce DM |
93 | |
94 | struct snd_pcm_substream *sub_playback[MAX_STREAMS]; | |
95 | struct snd_pcm_substream *sub_capture[MAX_STREAMS]; | |
96 | ||
8e3cd08e | 97 | /* Controls */ |
15c5ab60 DM |
98 | unsigned char control_state[256]; |
99 | unsigned char ep8_out_buf[2]; | |
8e3cd08e | 100 | |
523f1dce DM |
101 | /* Linux input */ |
102 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | |
103 | struct input_dev *input_dev; | |
b18b493f | 104 | char phys[64]; /* physical device path */ |
15c5ab60 | 105 | unsigned short keycode[128]; |
6da7a2aa DM |
106 | struct urb *ep4_in_urb; |
107 | unsigned char ep4_in_buf[EP4_BUFSIZE]; | |
523f1dce | 108 | #endif |
b18b493f | 109 | |
523f1dce DM |
110 | /* ALSA */ |
111 | struct snd_pcm *pcm; | |
112 | struct snd_pcm_hardware pcm_info; | |
113 | struct snd_rawmidi *rmidi; | |
114 | struct snd_rawmidi_substream *midi_receive_substream; | |
115 | struct snd_rawmidi_substream *midi_out_substream; | |
116 | }; | |
117 | ||
118 | struct snd_usb_caiaq_cb_info { | |
1c8470ce | 119 | struct snd_usb_caiaqdev *cdev; |
523f1dce DM |
120 | int index; |
121 | }; | |
122 | ||
123 | #define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) | |
f1f6b8f6 | 124 | #define caiaqdev_to_dev(d) (d->chip.card->dev) |
523f1dce | 125 | |
1c8470ce DM |
126 | int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, int rate, int depth, int bbp); |
127 | int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *cdev, int digital, int analog, int erp); | |
128 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev, | |
8e3cd08e DM |
129 | unsigned char command, |
130 | const unsigned char *buffer, | |
131 | int len); | |
d2724de1 HG |
132 | int snd_usb_caiaq_send_command_bank(struct snd_usb_caiaqdev *cdev, |
133 | unsigned char command, | |
134 | unsigned char bank, | |
135 | const unsigned char *buffer, | |
136 | int len); | |
523f1dce DM |
137 | |
138 | #endif /* CAIAQ_DEVICE_H */ |