diff options
author | Daniel Mack <zonque@gmail.com> | 2013-03-03 14:46:21 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-03-04 03:57:17 -0500 |
commit | 1c8470ce311c6b2b49a71a02961c360d04ed28b2 (patch) | |
tree | 34aca4afee14e143a0e3f6150888f3af4655fe22 /sound/usb/caiaq | |
parent | 6dbe51c251a327e012439c4772097a13df43c5b8 (diff) |
ALSA: snd-usb-caiaq: rename 'dev' to 'cdev'
This is needed in order to make the device namespace cleaner, and will
help when moving this driver over to dev_*() logging.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/caiaq')
-rw-r--r-- | sound/usb/caiaq/audio.c | 410 | ||||
-rw-r--r-- | sound/usb/caiaq/audio.h | 4 | ||||
-rw-r--r-- | sound/usb/caiaq/control.c | 66 | ||||
-rw-r--r-- | sound/usb/caiaq/control.h | 2 | ||||
-rw-r--r-- | sound/usb/caiaq/device.c | 210 | ||||
-rw-r--r-- | sound/usb/caiaq/device.h | 8 | ||||
-rw-r--r-- | sound/usb/caiaq/input.c | 320 | ||||
-rw-r--r-- | sound/usb/caiaq/input.h | 6 | ||||
-rw-r--r-- | sound/usb/caiaq/midi.c | 54 | ||||
-rw-r--r-- | sound/usb/caiaq/midi.h | 5 |
10 files changed, 543 insertions, 542 deletions
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index fde9a7a29cb6..75d8ba9143f6 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -39,8 +39,8 @@ | |||
39 | #define ENDPOINT_CAPTURE 2 | 39 | #define ENDPOINT_CAPTURE 2 |
40 | #define ENDPOINT_PLAYBACK 6 | 40 | #define ENDPOINT_PLAYBACK 6 |
41 | 41 | ||
42 | #define MAKE_CHECKBYTE(dev,stream,i) \ | 42 | #define MAKE_CHECKBYTE(cdev,stream,i) \ |
43 | (stream << 1) | (~(i / (dev->n_streams * BYTES_PER_SAMPLE_USB)) & 1) | 43 | (stream << 1) | (~(i / (cdev->n_streams * BYTES_PER_SAMPLE_USB)) & 1) |
44 | 44 | ||
45 | static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { | 45 | static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { |
46 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 46 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
@@ -60,32 +60,32 @@ static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { | |||
60 | }; | 60 | }; |
61 | 61 | ||
62 | static void | 62 | static void |
63 | activate_substream(struct snd_usb_caiaqdev *dev, | 63 | activate_substream(struct snd_usb_caiaqdev *cdev, |
64 | struct snd_pcm_substream *sub) | 64 | struct snd_pcm_substream *sub) |
65 | { | 65 | { |
66 | spin_lock(&dev->spinlock); | 66 | spin_lock(&cdev->spinlock); |
67 | 67 | ||
68 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 68 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
69 | dev->sub_playback[sub->number] = sub; | 69 | cdev->sub_playback[sub->number] = sub; |
70 | else | 70 | else |
71 | dev->sub_capture[sub->number] = sub; | 71 | cdev->sub_capture[sub->number] = sub; |
72 | 72 | ||
73 | spin_unlock(&dev->spinlock); | 73 | spin_unlock(&cdev->spinlock); |
74 | } | 74 | } |
75 | 75 | ||
76 | static void | 76 | static void |
77 | deactivate_substream(struct snd_usb_caiaqdev *dev, | 77 | deactivate_substream(struct snd_usb_caiaqdev *cdev, |
78 | struct snd_pcm_substream *sub) | 78 | struct snd_pcm_substream *sub) |
79 | { | 79 | { |
80 | unsigned long flags; | 80 | unsigned long flags; |
81 | spin_lock_irqsave(&dev->spinlock, flags); | 81 | spin_lock_irqsave(&cdev->spinlock, flags); |
82 | 82 | ||
83 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 83 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
84 | dev->sub_playback[sub->number] = NULL; | 84 | cdev->sub_playback[sub->number] = NULL; |
85 | else | 85 | else |
86 | dev->sub_capture[sub->number] = NULL; | 86 | cdev->sub_capture[sub->number] = NULL; |
87 | 87 | ||
88 | spin_unlock_irqrestore(&dev->spinlock, flags); | 88 | spin_unlock_irqrestore(&cdev->spinlock, flags); |
89 | } | 89 | } |
90 | 90 | ||
91 | static int | 91 | static int |
@@ -98,28 +98,28 @@ all_substreams_zero(struct snd_pcm_substream **subs) | |||
98 | return 1; | 98 | return 1; |
99 | } | 99 | } |
100 | 100 | ||
101 | static int stream_start(struct snd_usb_caiaqdev *dev) | 101 | static int stream_start(struct snd_usb_caiaqdev *cdev) |
102 | { | 102 | { |
103 | int i, ret; | 103 | int i, ret; |
104 | 104 | ||
105 | debug("%s(%p)\n", __func__, dev); | 105 | debug("%s(%p)\n", __func__, cdev); |
106 | 106 | ||
107 | if (dev->streaming) | 107 | if (cdev->streaming) |
108 | return -EINVAL; | 108 | return -EINVAL; |
109 | 109 | ||
110 | memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); | 110 | memset(cdev->sub_playback, 0, sizeof(cdev->sub_playback)); |
111 | memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); | 111 | memset(cdev->sub_capture, 0, sizeof(cdev->sub_capture)); |
112 | dev->input_panic = 0; | 112 | cdev->input_panic = 0; |
113 | dev->output_panic = 0; | 113 | cdev->output_panic = 0; |
114 | dev->first_packet = 4; | 114 | cdev->first_packet = 4; |
115 | dev->streaming = 1; | 115 | cdev->streaming = 1; |
116 | dev->warned = 0; | 116 | cdev->warned = 0; |
117 | 117 | ||
118 | for (i = 0; i < N_URBS; i++) { | 118 | for (i = 0; i < N_URBS; i++) { |
119 | ret = usb_submit_urb(dev->data_urbs_in[i], GFP_ATOMIC); | 119 | ret = usb_submit_urb(cdev->data_urbs_in[i], GFP_ATOMIC); |
120 | if (ret) { | 120 | if (ret) { |
121 | log("unable to trigger read #%d! (ret %d)\n", i, ret); | 121 | log("unable to trigger read #%d! (ret %d)\n", i, ret); |
122 | dev->streaming = 0; | 122 | cdev->streaming = 0; |
123 | return -EPIPE; | 123 | return -EPIPE; |
124 | } | 124 | } |
125 | } | 125 | } |
@@ -127,46 +127,46 @@ static int stream_start(struct snd_usb_caiaqdev *dev) | |||
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
130 | static void stream_stop(struct snd_usb_caiaqdev *dev) | 130 | static void stream_stop(struct snd_usb_caiaqdev *cdev) |
131 | { | 131 | { |
132 | int i; | 132 | int i; |
133 | 133 | ||
134 | debug("%s(%p)\n", __func__, dev); | 134 | debug("%s(%p)\n", __func__, cdev); |
135 | if (!dev->streaming) | 135 | if (!cdev->streaming) |
136 | return; | 136 | return; |
137 | 137 | ||
138 | dev->streaming = 0; | 138 | cdev->streaming = 0; |
139 | 139 | ||
140 | for (i = 0; i < N_URBS; i++) { | 140 | for (i = 0; i < N_URBS; i++) { |
141 | usb_kill_urb(dev->data_urbs_in[i]); | 141 | usb_kill_urb(cdev->data_urbs_in[i]); |
142 | 142 | ||
143 | if (test_bit(i, &dev->outurb_active_mask)) | 143 | if (test_bit(i, &cdev->outurb_active_mask)) |
144 | usb_kill_urb(dev->data_urbs_out[i]); | 144 | usb_kill_urb(cdev->data_urbs_out[i]); |
145 | } | 145 | } |
146 | 146 | ||
147 | dev->outurb_active_mask = 0; | 147 | cdev->outurb_active_mask = 0; |
148 | } | 148 | } |
149 | 149 | ||
150 | static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream) | 150 | static int snd_usb_caiaq_substream_open(struct snd_pcm_substream *substream) |
151 | { | 151 | { |
152 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); | 152 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(substream); |
153 | debug("%s(%p)\n", __func__, substream); | 153 | debug("%s(%p)\n", __func__, substream); |
154 | substream->runtime->hw = dev->pcm_info; | 154 | substream->runtime->hw = cdev->pcm_info; |
155 | snd_pcm_limit_hw_rates(substream->runtime); | 155 | snd_pcm_limit_hw_rates(substream->runtime); |
156 | return 0; | 156 | return 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream) | 159 | static int snd_usb_caiaq_substream_close(struct snd_pcm_substream *substream) |
160 | { | 160 | { |
161 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); | 161 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(substream); |
162 | 162 | ||
163 | debug("%s(%p)\n", __func__, substream); | 163 | debug("%s(%p)\n", __func__, substream); |
164 | if (all_substreams_zero(dev->sub_playback) && | 164 | if (all_substreams_zero(cdev->sub_playback) && |
165 | all_substreams_zero(dev->sub_capture)) { | 165 | all_substreams_zero(cdev->sub_capture)) { |
166 | /* when the last client has stopped streaming, | 166 | /* when the last client has stopped streaming, |
167 | * all sample rates are allowed again */ | 167 | * all sample rates are allowed again */ |
168 | stream_stop(dev); | 168 | stream_stop(cdev); |
169 | dev->pcm_info.rates = dev->samplerates; | 169 | cdev->pcm_info.rates = cdev->samplerates; |
170 | } | 170 | } |
171 | 171 | ||
172 | return 0; | 172 | return 0; |
@@ -181,9 +181,9 @@ static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub, | |||
181 | 181 | ||
182 | static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) | 182 | static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) |
183 | { | 183 | { |
184 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); | 184 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub); |
185 | debug("%s(%p)\n", __func__, sub); | 185 | debug("%s(%p)\n", __func__, sub); |
186 | deactivate_substream(dev, sub); | 186 | deactivate_substream(cdev, sub); |
187 | return snd_pcm_lib_free_pages(sub); | 187 | return snd_pcm_lib_free_pages(sub); |
188 | } | 188 | } |
189 | 189 | ||
@@ -199,7 +199,7 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) | |||
199 | { | 199 | { |
200 | int bytes_per_sample, bpp, ret, i; | 200 | int bytes_per_sample, bpp, ret, i; |
201 | int index = substream->number; | 201 | int index = substream->number; |
202 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(substream); | 202 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(substream); |
203 | struct snd_pcm_runtime *runtime = substream->runtime; | 203 | struct snd_pcm_runtime *runtime = substream->runtime; |
204 | 204 | ||
205 | debug("%s(%p)\n", __func__, substream); | 205 | debug("%s(%p)\n", __func__, substream); |
@@ -207,7 +207,7 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) | |||
207 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 207 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
208 | int out_pos; | 208 | int out_pos; |
209 | 209 | ||
210 | switch (dev->spec.data_alignment) { | 210 | switch (cdev->spec.data_alignment) { |
211 | case 0: | 211 | case 0: |
212 | case 2: | 212 | case 2: |
213 | out_pos = BYTES_PER_SAMPLE + 1; | 213 | out_pos = BYTES_PER_SAMPLE + 1; |
@@ -218,12 +218,12 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) | |||
218 | break; | 218 | break; |
219 | } | 219 | } |
220 | 220 | ||
221 | dev->period_out_count[index] = out_pos; | 221 | cdev->period_out_count[index] = out_pos; |
222 | dev->audio_out_buf_pos[index] = out_pos; | 222 | cdev->audio_out_buf_pos[index] = out_pos; |
223 | } else { | 223 | } else { |
224 | int in_pos; | 224 | int in_pos; |
225 | 225 | ||
226 | switch (dev->spec.data_alignment) { | 226 | switch (cdev->spec.data_alignment) { |
227 | case 0: | 227 | case 0: |
228 | in_pos = BYTES_PER_SAMPLE + 2; | 228 | in_pos = BYTES_PER_SAMPLE + 2; |
229 | break; | 229 | break; |
@@ -236,44 +236,44 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) | |||
236 | break; | 236 | break; |
237 | } | 237 | } |
238 | 238 | ||
239 | dev->period_in_count[index] = in_pos; | 239 | cdev->period_in_count[index] = in_pos; |
240 | dev->audio_in_buf_pos[index] = in_pos; | 240 | cdev->audio_in_buf_pos[index] = in_pos; |
241 | } | 241 | } |
242 | 242 | ||
243 | if (dev->streaming) | 243 | if (cdev->streaming) |
244 | return 0; | 244 | return 0; |
245 | 245 | ||
246 | /* the first client that opens a stream defines the sample rate | 246 | /* the first client that opens a stream defines the sample rate |
247 | * setting for all subsequent calls, until the last client closed. */ | 247 | * setting for all subsequent calls, until the last client closed. */ |
248 | for (i=0; i < ARRAY_SIZE(rates); i++) | 248 | for (i=0; i < ARRAY_SIZE(rates); i++) |
249 | if (runtime->rate == rates[i]) | 249 | if (runtime->rate == rates[i]) |
250 | dev->pcm_info.rates = 1 << i; | 250 | cdev->pcm_info.rates = 1 << i; |
251 | 251 | ||
252 | snd_pcm_limit_hw_rates(runtime); | 252 | snd_pcm_limit_hw_rates(runtime); |
253 | 253 | ||
254 | bytes_per_sample = BYTES_PER_SAMPLE; | 254 | bytes_per_sample = BYTES_PER_SAMPLE; |
255 | if (dev->spec.data_alignment >= 2) | 255 | if (cdev->spec.data_alignment >= 2) |
256 | bytes_per_sample++; | 256 | bytes_per_sample++; |
257 | 257 | ||
258 | bpp = ((runtime->rate / 8000) + CLOCK_DRIFT_TOLERANCE) | 258 | bpp = ((runtime->rate / 8000) + CLOCK_DRIFT_TOLERANCE) |
259 | * bytes_per_sample * CHANNELS_PER_STREAM * dev->n_streams; | 259 | * bytes_per_sample * CHANNELS_PER_STREAM * cdev->n_streams; |
260 | 260 | ||
261 | if (bpp > MAX_ENDPOINT_SIZE) | 261 | if (bpp > MAX_ENDPOINT_SIZE) |
262 | bpp = MAX_ENDPOINT_SIZE; | 262 | bpp = MAX_ENDPOINT_SIZE; |
263 | 263 | ||
264 | ret = snd_usb_caiaq_set_audio_params(dev, runtime->rate, | 264 | ret = snd_usb_caiaq_set_audio_params(cdev, runtime->rate, |
265 | runtime->sample_bits, bpp); | 265 | runtime->sample_bits, bpp); |
266 | if (ret) | 266 | if (ret) |
267 | return ret; | 267 | return ret; |
268 | 268 | ||
269 | ret = stream_start(dev); | 269 | ret = stream_start(cdev); |
270 | if (ret) | 270 | if (ret) |
271 | return ret; | 271 | return ret; |
272 | 272 | ||
273 | dev->output_running = 0; | 273 | cdev->output_running = 0; |
274 | wait_event_timeout(dev->prepare_wait_queue, dev->output_running, HZ); | 274 | wait_event_timeout(cdev->prepare_wait_queue, cdev->output_running, HZ); |
275 | if (!dev->output_running) { | 275 | if (!cdev->output_running) { |
276 | stream_stop(dev); | 276 | stream_stop(cdev); |
277 | return -EPIPE; | 277 | return -EPIPE; |
278 | } | 278 | } |
279 | 279 | ||
@@ -282,18 +282,18 @@ static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) | |||
282 | 282 | ||
283 | static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream *sub, int cmd) | 283 | static int snd_usb_caiaq_pcm_trigger(struct snd_pcm_substream *sub, int cmd) |
284 | { | 284 | { |
285 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); | 285 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub); |
286 | 286 | ||
287 | debug("%s(%p) cmd %d\n", __func__, sub, cmd); | 287 | debug("%s(%p) cmd %d\n", __func__, sub, cmd); |
288 | 288 | ||
289 | switch (cmd) { | 289 | switch (cmd) { |
290 | case SNDRV_PCM_TRIGGER_START: | 290 | case SNDRV_PCM_TRIGGER_START: |
291 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 291 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
292 | activate_substream(dev, sub); | 292 | activate_substream(cdev, sub); |
293 | break; | 293 | break; |
294 | case SNDRV_PCM_TRIGGER_STOP: | 294 | case SNDRV_PCM_TRIGGER_STOP: |
295 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 295 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
296 | deactivate_substream(dev, sub); | 296 | deactivate_substream(cdev, sub); |
297 | break; | 297 | break; |
298 | default: | 298 | default: |
299 | return -EINVAL; | 299 | return -EINVAL; |
@@ -306,25 +306,25 @@ static snd_pcm_uframes_t | |||
306 | snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) | 306 | snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub) |
307 | { | 307 | { |
308 | int index = sub->number; | 308 | int index = sub->number; |
309 | struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub); | 309 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub); |
310 | snd_pcm_uframes_t ptr; | 310 | snd_pcm_uframes_t ptr; |
311 | 311 | ||
312 | spin_lock(&dev->spinlock); | 312 | spin_lock(&cdev->spinlock); |
313 | 313 | ||
314 | if (dev->input_panic || dev->output_panic) { | 314 | if (cdev->input_panic || cdev->output_panic) { |
315 | ptr = SNDRV_PCM_POS_XRUN; | 315 | ptr = SNDRV_PCM_POS_XRUN; |
316 | goto unlock; | 316 | goto unlock; |
317 | } | 317 | } |
318 | 318 | ||
319 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) | 319 | if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) |
320 | ptr = bytes_to_frames(sub->runtime, | 320 | ptr = bytes_to_frames(sub->runtime, |
321 | dev->audio_out_buf_pos[index]); | 321 | cdev->audio_out_buf_pos[index]); |
322 | else | 322 | else |
323 | ptr = bytes_to_frames(sub->runtime, | 323 | ptr = bytes_to_frames(sub->runtime, |
324 | dev->audio_in_buf_pos[index]); | 324 | cdev->audio_in_buf_pos[index]); |
325 | 325 | ||
326 | unlock: | 326 | unlock: |
327 | spin_unlock(&dev->spinlock); | 327 | spin_unlock(&cdev->spinlock); |
328 | return ptr; | 328 | return ptr; |
329 | } | 329 | } |
330 | 330 | ||
@@ -340,21 +340,21 @@ static struct snd_pcm_ops snd_usb_caiaq_ops = { | |||
340 | .pointer = snd_usb_caiaq_pcm_pointer | 340 | .pointer = snd_usb_caiaq_pcm_pointer |
341 | }; | 341 | }; |
342 | 342 | ||
343 | static void check_for_elapsed_periods(struct snd_usb_caiaqdev *dev, | 343 | static void check_for_elapsed_periods(struct snd_usb_caiaqdev *cdev, |
344 | struct snd_pcm_substream **subs) | 344 | struct snd_pcm_substream **subs) |
345 | { | 345 | { |
346 | int stream, pb, *cnt; | 346 | int stream, pb, *cnt; |
347 | struct snd_pcm_substream *sub; | 347 | struct snd_pcm_substream *sub; |
348 | 348 | ||
349 | for (stream = 0; stream < dev->n_streams; stream++) { | 349 | for (stream = 0; stream < cdev->n_streams; stream++) { |
350 | sub = subs[stream]; | 350 | sub = subs[stream]; |
351 | if (!sub) | 351 | if (!sub) |
352 | continue; | 352 | continue; |
353 | 353 | ||
354 | pb = snd_pcm_lib_period_bytes(sub); | 354 | pb = snd_pcm_lib_period_bytes(sub); |
355 | cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | 355 | cnt = (sub->stream == SNDRV_PCM_STREAM_PLAYBACK) ? |
356 | &dev->period_out_count[stream] : | 356 | &cdev->period_out_count[stream] : |
357 | &dev->period_in_count[stream]; | 357 | &cdev->period_in_count[stream]; |
358 | 358 | ||
359 | if (*cnt >= pb) { | 359 | if (*cnt >= pb) { |
360 | snd_pcm_period_elapsed(sub); | 360 | snd_pcm_period_elapsed(sub); |
@@ -363,7 +363,7 @@ static void check_for_elapsed_periods(struct snd_usb_caiaqdev *dev, | |||
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | static void read_in_urb_mode0(struct snd_usb_caiaqdev *dev, | 366 | static void read_in_urb_mode0(struct snd_usb_caiaqdev *cdev, |
367 | const struct urb *urb, | 367 | const struct urb *urb, |
368 | const struct usb_iso_packet_descriptor *iso) | 368 | const struct usb_iso_packet_descriptor *iso) |
369 | { | 369 | { |
@@ -371,27 +371,27 @@ static void read_in_urb_mode0(struct snd_usb_caiaqdev *dev, | |||
371 | struct snd_pcm_substream *sub; | 371 | struct snd_pcm_substream *sub; |
372 | int stream, i; | 372 | int stream, i; |
373 | 373 | ||
374 | if (all_substreams_zero(dev->sub_capture)) | 374 | if (all_substreams_zero(cdev->sub_capture)) |
375 | return; | 375 | return; |
376 | 376 | ||
377 | for (i = 0; i < iso->actual_length;) { | 377 | for (i = 0; i < iso->actual_length;) { |
378 | for (stream = 0; stream < dev->n_streams; stream++, i++) { | 378 | for (stream = 0; stream < cdev->n_streams; stream++, i++) { |
379 | sub = dev->sub_capture[stream]; | 379 | sub = cdev->sub_capture[stream]; |
380 | if (sub) { | 380 | if (sub) { |
381 | struct snd_pcm_runtime *rt = sub->runtime; | 381 | struct snd_pcm_runtime *rt = sub->runtime; |
382 | char *audio_buf = rt->dma_area; | 382 | char *audio_buf = rt->dma_area; |
383 | int sz = frames_to_bytes(rt, rt->buffer_size); | 383 | int sz = frames_to_bytes(rt, rt->buffer_size); |
384 | audio_buf[dev->audio_in_buf_pos[stream]++] | 384 | audio_buf[cdev->audio_in_buf_pos[stream]++] |
385 | = usb_buf[i]; | 385 | = usb_buf[i]; |
386 | dev->period_in_count[stream]++; | 386 | cdev->period_in_count[stream]++; |
387 | if (dev->audio_in_buf_pos[stream] == sz) | 387 | if (cdev->audio_in_buf_pos[stream] == sz) |
388 | dev->audio_in_buf_pos[stream] = 0; | 388 | cdev->audio_in_buf_pos[stream] = 0; |
389 | } | 389 | } |
390 | } | 390 | } |
391 | } | 391 | } |
392 | } | 392 | } |
393 | 393 | ||
394 | static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, | 394 | static void read_in_urb_mode2(struct snd_usb_caiaqdev *cdev, |
395 | const struct urb *urb, | 395 | const struct urb *urb, |
396 | const struct usb_iso_packet_descriptor *iso) | 396 | const struct usb_iso_packet_descriptor *iso) |
397 | { | 397 | { |
@@ -401,44 +401,44 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, | |||
401 | int stream, i; | 401 | int stream, i; |
402 | 402 | ||
403 | for (i = 0; i < iso->actual_length;) { | 403 | for (i = 0; i < iso->actual_length;) { |
404 | if (i % (dev->n_streams * BYTES_PER_SAMPLE_USB) == 0) { | 404 | if (i % (cdev->n_streams * BYTES_PER_SAMPLE_USB) == 0) { |
405 | for (stream = 0; | 405 | for (stream = 0; |
406 | stream < dev->n_streams; | 406 | stream < cdev->n_streams; |
407 | stream++, i++) { | 407 | stream++, i++) { |
408 | if (dev->first_packet) | 408 | if (cdev->first_packet) |
409 | continue; | 409 | continue; |
410 | 410 | ||
411 | check_byte = MAKE_CHECKBYTE(dev, stream, i); | 411 | check_byte = MAKE_CHECKBYTE(cdev, stream, i); |
412 | 412 | ||
413 | if ((usb_buf[i] & 0x3f) != check_byte) | 413 | if ((usb_buf[i] & 0x3f) != check_byte) |
414 | dev->input_panic = 1; | 414 | cdev->input_panic = 1; |
415 | 415 | ||
416 | if (usb_buf[i] & 0x80) | 416 | if (usb_buf[i] & 0x80) |
417 | dev->output_panic = 1; | 417 | cdev->output_panic = 1; |
418 | } | 418 | } |
419 | } | 419 | } |
420 | dev->first_packet = 0; | 420 | cdev->first_packet = 0; |
421 | 421 | ||
422 | for (stream = 0; stream < dev->n_streams; stream++, i++) { | 422 | for (stream = 0; stream < cdev->n_streams; stream++, i++) { |
423 | sub = dev->sub_capture[stream]; | 423 | sub = cdev->sub_capture[stream]; |
424 | if (dev->input_panic) | 424 | if (cdev->input_panic) |
425 | usb_buf[i] = 0; | 425 | usb_buf[i] = 0; |
426 | 426 | ||
427 | if (sub) { | 427 | if (sub) { |
428 | struct snd_pcm_runtime *rt = sub->runtime; | 428 | struct snd_pcm_runtime *rt = sub->runtime; |
429 | char *audio_buf = rt->dma_area; | 429 | char *audio_buf = rt->dma_area; |
430 | int sz = frames_to_bytes(rt, rt->buffer_size); | 430 | int sz = frames_to_bytes(rt, rt->buffer_size); |
431 | audio_buf[dev->audio_in_buf_pos[stream]++] = | 431 | audio_buf[cdev->audio_in_buf_pos[stream]++] = |
432 | usb_buf[i]; | 432 | usb_buf[i]; |
433 | dev->period_in_count[stream]++; | 433 | cdev->period_in_count[stream]++; |
434 | if (dev->audio_in_buf_pos[stream] == sz) | 434 | if (cdev->audio_in_buf_pos[stream] == sz) |
435 | dev->audio_in_buf_pos[stream] = 0; | 435 | cdev->audio_in_buf_pos[stream] = 0; |
436 | } | 436 | } |
437 | } | 437 | } |
438 | } | 438 | } |
439 | } | 439 | } |
440 | 440 | ||
441 | static void read_in_urb_mode3(struct snd_usb_caiaqdev *dev, | 441 | static void read_in_urb_mode3(struct snd_usb_caiaqdev *cdev, |
442 | const struct urb *urb, | 442 | const struct urb *urb, |
443 | const struct usb_iso_packet_descriptor *iso) | 443 | const struct usb_iso_packet_descriptor *iso) |
444 | { | 444 | { |
@@ -450,12 +450,12 @@ static void read_in_urb_mode3(struct snd_usb_caiaqdev *dev, | |||
450 | return; | 450 | return; |
451 | 451 | ||
452 | for (i = 0; i < iso->actual_length;) { | 452 | for (i = 0; i < iso->actual_length;) { |
453 | for (stream = 0; stream < dev->n_streams; stream++) { | 453 | for (stream = 0; stream < cdev->n_streams; stream++) { |
454 | struct snd_pcm_substream *sub = dev->sub_capture[stream]; | 454 | struct snd_pcm_substream *sub = cdev->sub_capture[stream]; |
455 | char *audio_buf = NULL; | 455 | char *audio_buf = NULL; |
456 | int c, n, sz = 0; | 456 | int c, n, sz = 0; |
457 | 457 | ||
458 | if (sub && !dev->input_panic) { | 458 | if (sub && !cdev->input_panic) { |
459 | struct snd_pcm_runtime *rt = sub->runtime; | 459 | struct snd_pcm_runtime *rt = sub->runtime; |
460 | audio_buf = rt->dma_area; | 460 | audio_buf = rt->dma_area; |
461 | sz = frames_to_bytes(rt, rt->buffer_size); | 461 | sz = frames_to_bytes(rt, rt->buffer_size); |
@@ -465,23 +465,23 @@ static void read_in_urb_mode3(struct snd_usb_caiaqdev *dev, | |||
465 | /* 3 audio data bytes, followed by 1 check byte */ | 465 | /* 3 audio data bytes, followed by 1 check byte */ |
466 | if (audio_buf) { | 466 | if (audio_buf) { |
467 | for (n = 0; n < BYTES_PER_SAMPLE; n++) { | 467 | for (n = 0; n < BYTES_PER_SAMPLE; n++) { |
468 | audio_buf[dev->audio_in_buf_pos[stream]++] = usb_buf[i+n]; | 468 | audio_buf[cdev->audio_in_buf_pos[stream]++] = usb_buf[i+n]; |
469 | 469 | ||
470 | if (dev->audio_in_buf_pos[stream] == sz) | 470 | if (cdev->audio_in_buf_pos[stream] == sz) |
471 | dev->audio_in_buf_pos[stream] = 0; | 471 | cdev->audio_in_buf_pos[stream] = 0; |
472 | } | 472 | } |
473 | 473 | ||
474 | dev->period_in_count[stream] += BYTES_PER_SAMPLE; | 474 | cdev->period_in_count[stream] += BYTES_PER_SAMPLE; |
475 | } | 475 | } |
476 | 476 | ||
477 | i += BYTES_PER_SAMPLE; | 477 | i += BYTES_PER_SAMPLE; |
478 | 478 | ||
479 | if (usb_buf[i] != ((stream << 1) | c) && | 479 | if (usb_buf[i] != ((stream << 1) | c) && |
480 | !dev->first_packet) { | 480 | !cdev->first_packet) { |
481 | if (!dev->input_panic) | 481 | if (!cdev->input_panic) |
482 | printk(" EXPECTED: %02x got %02x, c %d, stream %d, i %d\n", | 482 | printk(" EXPECTED: %02x got %02x, c %d, stream %d, i %d\n", |
483 | ((stream << 1) | c), usb_buf[i], c, stream, i); | 483 | ((stream << 1) | c), usb_buf[i], c, stream, i); |
484 | dev->input_panic = 1; | 484 | cdev->input_panic = 1; |
485 | } | 485 | } |
486 | 486 | ||
487 | i++; | 487 | i++; |
@@ -489,41 +489,41 @@ static void read_in_urb_mode3(struct snd_usb_caiaqdev *dev, | |||
489 | } | 489 | } |
490 | } | 490 | } |
491 | 491 | ||
492 | if (dev->first_packet > 0) | 492 | if (cdev->first_packet > 0) |
493 | dev->first_packet--; | 493 | cdev->first_packet--; |
494 | } | 494 | } |
495 | 495 | ||
496 | static void read_in_urb(struct snd_usb_caiaqdev *dev, | 496 | static void read_in_urb(struct snd_usb_caiaqdev *cdev, |
497 | const struct urb *urb, | 497 | const struct urb *urb, |
498 | const struct usb_iso_packet_descriptor *iso) | 498 | const struct usb_iso_packet_descriptor *iso) |
499 | { | 499 | { |
500 | if (!dev->streaming) | 500 | if (!cdev->streaming) |
501 | return; | 501 | return; |
502 | 502 | ||
503 | if (iso->actual_length < dev->bpp) | 503 | if (iso->actual_length < cdev->bpp) |
504 | return; | 504 | return; |
505 | 505 | ||
506 | switch (dev->spec.data_alignment) { | 506 | switch (cdev->spec.data_alignment) { |
507 | case 0: | 507 | case 0: |
508 | read_in_urb_mode0(dev, urb, iso); | 508 | read_in_urb_mode0(cdev, urb, iso); |
509 | break; | 509 | break; |
510 | case 2: | 510 | case 2: |
511 | read_in_urb_mode2(dev, urb, iso); | 511 | read_in_urb_mode2(cdev, urb, iso); |
512 | break; | 512 | break; |
513 | case 3: | 513 | case 3: |
514 | read_in_urb_mode3(dev, urb, iso); | 514 | read_in_urb_mode3(cdev, urb, iso); |
515 | break; | 515 | break; |
516 | } | 516 | } |
517 | 517 | ||
518 | if ((dev->input_panic || dev->output_panic) && !dev->warned) { | 518 | if ((cdev->input_panic || cdev->output_panic) && !cdev->warned) { |
519 | debug("streaming error detected %s %s\n", | 519 | debug("streaming error detected %s %s\n", |
520 | dev->input_panic ? "(input)" : "", | 520 | cdev->input_panic ? "(input)" : "", |
521 | dev->output_panic ? "(output)" : ""); | 521 | cdev->output_panic ? "(output)" : ""); |
522 | dev->warned = 1; | 522 | cdev->warned = 1; |
523 | } | 523 | } |
524 | } | 524 | } |
525 | 525 | ||
526 | static void fill_out_urb_mode_0(struct snd_usb_caiaqdev *dev, | 526 | static void fill_out_urb_mode_0(struct snd_usb_caiaqdev *cdev, |
527 | struct urb *urb, | 527 | struct urb *urb, |
528 | const struct usb_iso_packet_descriptor *iso) | 528 | const struct usb_iso_packet_descriptor *iso) |
529 | { | 529 | { |
@@ -532,32 +532,32 @@ static void fill_out_urb_mode_0(struct snd_usb_caiaqdev *dev, | |||
532 | int stream, i; | 532 | int stream, i; |
533 | 533 | ||
534 | for (i = 0; i < iso->length;) { | 534 | for (i = 0; i < iso->length;) { |
535 | for (stream = 0; stream < dev->n_streams; stream++, i++) { | 535 | for (stream = 0; stream < cdev->n_streams; stream++, i++) { |
536 | sub = dev->sub_playback[stream]; | 536 | sub = cdev->sub_playback[stream]; |
537 | if (sub) { | 537 | if (sub) { |
538 | struct snd_pcm_runtime *rt = sub->runtime; | 538 | struct snd_pcm_runtime *rt = sub->runtime; |
539 | char *audio_buf = rt->dma_area; | 539 | char *audio_buf = rt->dma_area; |
540 | int sz = frames_to_bytes(rt, rt->buffer_size); | 540 | int sz = frames_to_bytes(rt, rt->buffer_size); |
541 | usb_buf[i] = | 541 | usb_buf[i] = |
542 | audio_buf[dev->audio_out_buf_pos[stream]]; | 542 | audio_buf[cdev->audio_out_buf_pos[stream]]; |
543 | dev->period_out_count[stream]++; | 543 | cdev->period_out_count[stream]++; |
544 | dev->audio_out_buf_pos[stream]++; | 544 | cdev->audio_out_buf_pos[stream]++; |
545 | if (dev->audio_out_buf_pos[stream] == sz) | 545 | if (cdev->audio_out_buf_pos[stream] == sz) |
546 | dev->audio_out_buf_pos[stream] = 0; | 546 | cdev->audio_out_buf_pos[stream] = 0; |
547 | } else | 547 | } else |
548 | usb_buf[i] = 0; | 548 | usb_buf[i] = 0; |
549 | } | 549 | } |
550 | 550 | ||
551 | /* fill in the check bytes */ | 551 | /* fill in the check bytes */ |
552 | if (dev->spec.data_alignment == 2 && | 552 | if (cdev->spec.data_alignment == 2 && |
553 | i % (dev->n_streams * BYTES_PER_SAMPLE_USB) == | 553 | i % (cdev->n_streams * BYTES_PER_SAMPLE_USB) == |
554 | (dev->n_streams * CHANNELS_PER_STREAM)) | 554 | (cdev->n_streams * CHANNELS_PER_STREAM)) |
555 | for (stream = 0; stream < dev->n_streams; stream++, i++) | 555 | for (stream = 0; stream < cdev->n_streams; stream++, i++) |
556 | usb_buf[i] = MAKE_CHECKBYTE(dev, stream, i); | 556 | usb_buf[i] = MAKE_CHECKBYTE(cdev, stream, i); |
557 | } | 557 | } |
558 | } | 558 | } |
559 | 559 | ||
560 | static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *dev, | 560 | static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *cdev, |
561 | struct urb *urb, | 561 | struct urb *urb, |
562 | const struct usb_iso_packet_descriptor *iso) | 562 | const struct usb_iso_packet_descriptor *iso) |
563 | { | 563 | { |
@@ -565,8 +565,8 @@ static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *dev, | |||
565 | int stream, i; | 565 | int stream, i; |
566 | 566 | ||
567 | for (i = 0; i < iso->length;) { | 567 | for (i = 0; i < iso->length;) { |
568 | for (stream = 0; stream < dev->n_streams; stream++) { | 568 | for (stream = 0; stream < cdev->n_streams; stream++) { |
569 | struct snd_pcm_substream *sub = dev->sub_playback[stream]; | 569 | struct snd_pcm_substream *sub = cdev->sub_playback[stream]; |
570 | char *audio_buf = NULL; | 570 | char *audio_buf = NULL; |
571 | int c, n, sz = 0; | 571 | int c, n, sz = 0; |
572 | 572 | ||
@@ -579,17 +579,17 @@ static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *dev, | |||
579 | for (c = 0; c < CHANNELS_PER_STREAM; c++) { | 579 | for (c = 0; c < CHANNELS_PER_STREAM; c++) { |
580 | for (n = 0; n < BYTES_PER_SAMPLE; n++) { | 580 | for (n = 0; n < BYTES_PER_SAMPLE; n++) { |
581 | if (audio_buf) { | 581 | if (audio_buf) { |
582 | usb_buf[i+n] = audio_buf[dev->audio_out_buf_pos[stream]++]; | 582 | usb_buf[i+n] = audio_buf[cdev->audio_out_buf_pos[stream]++]; |
583 | 583 | ||
584 | if (dev->audio_out_buf_pos[stream] == sz) | 584 | if (cdev->audio_out_buf_pos[stream] == sz) |
585 | dev->audio_out_buf_pos[stream] = 0; | 585 | cdev->audio_out_buf_pos[stream] = 0; |
586 | } else { | 586 | } else { |
587 | usb_buf[i+n] = 0; | 587 | usb_buf[i+n] = 0; |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | if (audio_buf) | 591 | if (audio_buf) |
592 | dev->period_out_count[stream] += BYTES_PER_SAMPLE; | 592 | cdev->period_out_count[stream] += BYTES_PER_SAMPLE; |
593 | 593 | ||
594 | i += BYTES_PER_SAMPLE; | 594 | i += BYTES_PER_SAMPLE; |
595 | 595 | ||
@@ -600,17 +600,17 @@ static void fill_out_urb_mode_3(struct snd_usb_caiaqdev *dev, | |||
600 | } | 600 | } |
601 | } | 601 | } |
602 | 602 | ||
603 | static inline void fill_out_urb(struct snd_usb_caiaqdev *dev, | 603 | static inline void fill_out_urb(struct snd_usb_caiaqdev *cdev, |
604 | struct urb *urb, | 604 | struct urb *urb, |
605 | const struct usb_iso_packet_descriptor *iso) | 605 | const struct usb_iso_packet_descriptor *iso) |
606 | { | 606 | { |
607 | switch (dev->spec.data_alignment) { | 607 | switch (cdev->spec.data_alignment) { |
608 | case 0: | 608 | case 0: |
609 | case 2: | 609 | case 2: |
610 | fill_out_urb_mode_0(dev, urb, iso); | 610 | fill_out_urb_mode_0(cdev, urb, iso); |
611 | break; | 611 | break; |
612 | case 3: | 612 | case 3: |
613 | fill_out_urb_mode_3(dev, urb, iso); | 613 | fill_out_urb_mode_3(cdev, urb, iso); |
614 | break; | 614 | break; |
615 | } | 615 | } |
616 | } | 616 | } |
@@ -618,7 +618,7 @@ static inline void fill_out_urb(struct snd_usb_caiaqdev *dev, | |||
618 | static void read_completed(struct urb *urb) | 618 | static void read_completed(struct urb *urb) |
619 | { | 619 | { |
620 | struct snd_usb_caiaq_cb_info *info = urb->context; | 620 | struct snd_usb_caiaq_cb_info *info = urb->context; |
621 | struct snd_usb_caiaqdev *dev; | 621 | struct snd_usb_caiaqdev *cdev; |
622 | struct urb *out = NULL; | 622 | struct urb *out = NULL; |
623 | int i, frame, len, send_it = 0, outframe = 0; | 623 | int i, frame, len, send_it = 0, outframe = 0; |
624 | size_t offset = 0; | 624 | size_t offset = 0; |
@@ -626,15 +626,15 @@ static void read_completed(struct urb *urb) | |||
626 | if (urb->status || !info) | 626 | if (urb->status || !info) |
627 | return; | 627 | return; |
628 | 628 | ||
629 | dev = info->dev; | 629 | cdev = info->cdev; |
630 | 630 | ||
631 | if (!dev->streaming) | 631 | if (!cdev->streaming) |
632 | return; | 632 | return; |
633 | 633 | ||
634 | /* find an unused output urb that is unused */ | 634 | /* find an unused output urb that is unused */ |
635 | for (i = 0; i < N_URBS; i++) | 635 | for (i = 0; i < N_URBS; i++) |
636 | if (test_and_set_bit(i, &dev->outurb_active_mask) == 0) { | 636 | if (test_and_set_bit(i, &cdev->outurb_active_mask) == 0) { |
637 | out = dev->data_urbs_out[i]; | 637 | out = cdev->data_urbs_out[i]; |
638 | break; | 638 | break; |
639 | } | 639 | } |
640 | 640 | ||
@@ -656,12 +656,12 @@ static void read_completed(struct urb *urb) | |||
656 | offset += len; | 656 | offset += len; |
657 | 657 | ||
658 | if (len > 0) { | 658 | if (len > 0) { |
659 | spin_lock(&dev->spinlock); | 659 | spin_lock(&cdev->spinlock); |
660 | fill_out_urb(dev, out, &out->iso_frame_desc[outframe]); | 660 | fill_out_urb(cdev, out, &out->iso_frame_desc[outframe]); |
661 | read_in_urb(dev, urb, &urb->iso_frame_desc[frame]); | 661 | read_in_urb(cdev, urb, &urb->iso_frame_desc[frame]); |
662 | spin_unlock(&dev->spinlock); | 662 | spin_unlock(&cdev->spinlock); |
663 | check_for_elapsed_periods(dev, dev->sub_playback); | 663 | check_for_elapsed_periods(cdev, cdev->sub_playback); |
664 | check_for_elapsed_periods(dev, dev->sub_capture); | 664 | check_for_elapsed_periods(cdev, cdev->sub_capture); |
665 | send_it = 1; | 665 | send_it = 1; |
666 | } | 666 | } |
667 | 667 | ||
@@ -674,7 +674,7 @@ static void read_completed(struct urb *urb) | |||
674 | usb_submit_urb(out, GFP_ATOMIC); | 674 | usb_submit_urb(out, GFP_ATOMIC); |
675 | } else { | 675 | } else { |
676 | struct snd_usb_caiaq_cb_info *oinfo = out->context; | 676 | struct snd_usb_caiaq_cb_info *oinfo = out->context; |
677 | clear_bit(oinfo->index, &dev->outurb_active_mask); | 677 | clear_bit(oinfo->index, &cdev->outurb_active_mask); |
678 | } | 678 | } |
679 | 679 | ||
680 | requeue: | 680 | requeue: |
@@ -693,21 +693,21 @@ requeue: | |||
693 | static void write_completed(struct urb *urb) | 693 | static void write_completed(struct urb *urb) |
694 | { | 694 | { |
695 | struct snd_usb_caiaq_cb_info *info = urb->context; | 695 | struct snd_usb_caiaq_cb_info *info = urb->context; |
696 | struct snd_usb_caiaqdev *dev = info->dev; | 696 | struct snd_usb_caiaqdev *cdev = info->cdev; |
697 | 697 | ||
698 | if (!dev->output_running) { | 698 | if (!cdev->output_running) { |
699 | dev->output_running = 1; | 699 | cdev->output_running = 1; |
700 | wake_up(&dev->prepare_wait_queue); | 700 | wake_up(&cdev->prepare_wait_queue); |
701 | } | 701 | } |
702 | 702 | ||
703 | clear_bit(info->index, &dev->outurb_active_mask); | 703 | clear_bit(info->index, &cdev->outurb_active_mask); |
704 | } | 704 | } |
705 | 705 | ||
706 | static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret) | 706 | static struct urb **alloc_urbs(struct snd_usb_caiaqdev *cdev, int dir, int *ret) |
707 | { | 707 | { |
708 | int i, frame; | 708 | int i, frame; |
709 | struct urb **urbs; | 709 | struct urb **urbs; |
710 | struct usb_device *usb_dev = dev->chip.dev; | 710 | struct usb_device *usb_dev = cdev->chip.dev; |
711 | unsigned int pipe; | 711 | unsigned int pipe; |
712 | 712 | ||
713 | pipe = (dir == SNDRV_PCM_STREAM_PLAYBACK) ? | 713 | pipe = (dir == SNDRV_PCM_STREAM_PLAYBACK) ? |
@@ -749,7 +749,7 @@ static struct urb **alloc_urbs(struct snd_usb_caiaqdev *dev, int dir, int *ret) | |||
749 | urbs[i]->pipe = pipe; | 749 | urbs[i]->pipe = pipe; |
750 | urbs[i]->transfer_buffer_length = FRAMES_PER_URB | 750 | urbs[i]->transfer_buffer_length = FRAMES_PER_URB |
751 | * BYTES_PER_FRAME; | 751 | * BYTES_PER_FRAME; |
752 | urbs[i]->context = &dev->data_cb_info[i]; | 752 | urbs[i]->context = &cdev->data_cb_info[i]; |
753 | urbs[i]->interval = 1; | 753 | urbs[i]->interval = 1; |
754 | urbs[i]->transfer_flags = URB_ISO_ASAP; | 754 | urbs[i]->transfer_flags = URB_ISO_ASAP; |
755 | urbs[i]->number_of_packets = FRAMES_PER_URB; | 755 | urbs[i]->number_of_packets = FRAMES_PER_URB; |
@@ -780,110 +780,110 @@ static void free_urbs(struct urb **urbs) | |||
780 | kfree(urbs); | 780 | kfree(urbs); |
781 | } | 781 | } |
782 | 782 | ||
783 | int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) | 783 | int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev) |
784 | { | 784 | { |
785 | int i, ret; | 785 | int i, ret; |
786 | 786 | ||
787 | dev->n_audio_in = max(dev->spec.num_analog_audio_in, | 787 | cdev->n_audio_in = max(cdev->spec.num_analog_audio_in, |
788 | dev->spec.num_digital_audio_in) / | 788 | cdev->spec.num_digital_audio_in) / |
789 | CHANNELS_PER_STREAM; | 789 | CHANNELS_PER_STREAM; |
790 | dev->n_audio_out = max(dev->spec.num_analog_audio_out, | 790 | cdev->n_audio_out = max(cdev->spec.num_analog_audio_out, |
791 | dev->spec.num_digital_audio_out) / | 791 | cdev->spec.num_digital_audio_out) / |
792 | CHANNELS_PER_STREAM; | 792 | CHANNELS_PER_STREAM; |
793 | dev->n_streams = max(dev->n_audio_in, dev->n_audio_out); | 793 | cdev->n_streams = max(cdev->n_audio_in, cdev->n_audio_out); |
794 | 794 | ||
795 | debug("dev->n_audio_in = %d\n", dev->n_audio_in); | 795 | debug("cdev->n_audio_in = %d\n", cdev->n_audio_in); |
796 | debug("dev->n_audio_out = %d\n", dev->n_audio_out); | 796 | debug("cdev->n_audio_out = %d\n", cdev->n_audio_out); |
797 | debug("dev->n_streams = %d\n", dev->n_streams); | 797 | debug("cdev->n_streams = %d\n", cdev->n_streams); |
798 | 798 | ||
799 | if (dev->n_streams > MAX_STREAMS) { | 799 | if (cdev->n_streams > MAX_STREAMS) { |
800 | log("unable to initialize device, too many streams.\n"); | 800 | log("unable to initialize device, too many streams.\n"); |
801 | return -EINVAL; | 801 | return -EINVAL; |
802 | } | 802 | } |
803 | 803 | ||
804 | ret = snd_pcm_new(dev->chip.card, dev->product_name, 0, | 804 | ret = snd_pcm_new(cdev->chip.card, cdev->product_name, 0, |
805 | dev->n_audio_out, dev->n_audio_in, &dev->pcm); | 805 | cdev->n_audio_out, cdev->n_audio_in, &cdev->pcm); |
806 | 806 | ||
807 | if (ret < 0) { | 807 | if (ret < 0) { |
808 | log("snd_pcm_new() returned %d\n", ret); | 808 | log("snd_pcm_new() returned %d\n", ret); |
809 | return ret; | 809 | return ret; |
810 | } | 810 | } |
811 | 811 | ||
812 | dev->pcm->private_data = dev; | 812 | cdev->pcm->private_data = cdev; |
813 | strlcpy(dev->pcm->name, dev->product_name, sizeof(dev->pcm->name)); | 813 | strlcpy(cdev->pcm->name, cdev->product_name, sizeof(cdev->pcm->name)); |
814 | 814 | ||
815 | memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); | 815 | memset(cdev->sub_playback, 0, sizeof(cdev->sub_playback)); |
816 | memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); | 816 | memset(cdev->sub_capture, 0, sizeof(cdev->sub_capture)); |
817 | 817 | ||
818 | memcpy(&dev->pcm_info, &snd_usb_caiaq_pcm_hardware, | 818 | memcpy(&cdev->pcm_info, &snd_usb_caiaq_pcm_hardware, |
819 | sizeof(snd_usb_caiaq_pcm_hardware)); | 819 | sizeof(snd_usb_caiaq_pcm_hardware)); |
820 | 820 | ||
821 | /* setup samplerates */ | 821 | /* setup samplerates */ |
822 | dev->samplerates = dev->pcm_info.rates; | 822 | cdev->samplerates = cdev->pcm_info.rates; |
823 | switch (dev->chip.usb_id) { | 823 | switch (cdev->chip.usb_id) { |
824 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 824 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
825 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | 825 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): |
826 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): | 826 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): |
827 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): | 827 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): |
828 | dev->samplerates |= SNDRV_PCM_RATE_192000; | 828 | cdev->samplerates |= SNDRV_PCM_RATE_192000; |
829 | /* fall thru */ | 829 | /* fall thru */ |
830 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO2DJ): | 830 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO2DJ): |
831 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | 831 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
832 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): | 832 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
833 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORAUDIO2): | 833 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORAUDIO2): |
834 | dev->samplerates |= SNDRV_PCM_RATE_88200; | 834 | cdev->samplerates |= SNDRV_PCM_RATE_88200; |
835 | break; | 835 | break; |
836 | } | 836 | } |
837 | 837 | ||
838 | snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_PLAYBACK, | 838 | snd_pcm_set_ops(cdev->pcm, SNDRV_PCM_STREAM_PLAYBACK, |
839 | &snd_usb_caiaq_ops); | 839 | &snd_usb_caiaq_ops); |
840 | snd_pcm_set_ops(dev->pcm, SNDRV_PCM_STREAM_CAPTURE, | 840 | snd_pcm_set_ops(cdev->pcm, SNDRV_PCM_STREAM_CAPTURE, |
841 | &snd_usb_caiaq_ops); | 841 | &snd_usb_caiaq_ops); |
842 | 842 | ||
843 | snd_pcm_lib_preallocate_pages_for_all(dev->pcm, | 843 | snd_pcm_lib_preallocate_pages_for_all(cdev->pcm, |
844 | SNDRV_DMA_TYPE_CONTINUOUS, | 844 | SNDRV_DMA_TYPE_CONTINUOUS, |
845 | snd_dma_continuous_data(GFP_KERNEL), | 845 | snd_dma_continuous_data(GFP_KERNEL), |
846 | MAX_BUFFER_SIZE, MAX_BUFFER_SIZE); | 846 | MAX_BUFFER_SIZE, MAX_BUFFER_SIZE); |
847 | 847 | ||
848 | dev->data_cb_info = | 848 | cdev->data_cb_info = |
849 | kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS, | 849 | kmalloc(sizeof(struct snd_usb_caiaq_cb_info) * N_URBS, |
850 | GFP_KERNEL); | 850 | GFP_KERNEL); |
851 | 851 | ||
852 | if (!dev->data_cb_info) | 852 | if (!cdev->data_cb_info) |
853 | return -ENOMEM; | 853 | return -ENOMEM; |
854 | 854 | ||
855 | dev->outurb_active_mask = 0; | 855 | cdev->outurb_active_mask = 0; |
856 | BUILD_BUG_ON(N_URBS > (sizeof(dev->outurb_active_mask) * 8)); | 856 | BUILD_BUG_ON(N_URBS > (sizeof(cdev->outurb_active_mask) * 8)); |
857 | 857 | ||
858 | for (i = 0; i < N_URBS; i++) { | 858 | for (i = 0; i < N_URBS; i++) { |
859 | dev->data_cb_info[i].dev = dev; | 859 | cdev->data_cb_info[i].cdev = cdev; |
860 | dev->data_cb_info[i].index = i; | 860 | cdev->data_cb_info[i].index = i; |
861 | } | 861 | } |
862 | 862 | ||
863 | dev->data_urbs_in = alloc_urbs(dev, SNDRV_PCM_STREAM_CAPTURE, &ret); | 863 | cdev->data_urbs_in = alloc_urbs(cdev, SNDRV_PCM_STREAM_CAPTURE, &ret); |
864 | if (ret < 0) { | 864 | if (ret < 0) { |
865 | kfree(dev->data_cb_info); | 865 | kfree(cdev->data_cb_info); |
866 | free_urbs(dev->data_urbs_in); | 866 | free_urbs(cdev->data_urbs_in); |
867 | return ret; | 867 | return ret; |
868 | } | 868 | } |
869 | 869 | ||
870 | dev->data_urbs_out = alloc_urbs(dev, SNDRV_PCM_STREAM_PLAYBACK, &ret); | 870 | cdev->data_urbs_out = alloc_urbs(cdev, SNDRV_PCM_STREAM_PLAYBACK, &ret); |
871 | if (ret < 0) { | 871 | if (ret < 0) { |
872 | kfree(dev->data_cb_info); | 872 | kfree(cdev->data_cb_info); |
873 | free_urbs(dev->data_urbs_in); | 873 | free_urbs(cdev->data_urbs_in); |
874 | free_urbs(dev->data_urbs_out); | 874 | free_urbs(cdev->data_urbs_out); |
875 | return ret; | 875 | return ret; |
876 | } | 876 | } |
877 | 877 | ||
878 | return 0; | 878 | return 0; |
879 | } | 879 | } |
880 | 880 | ||
881 | void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev) | 881 | void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *cdev) |
882 | { | 882 | { |
883 | debug("%s(%p)\n", __func__, dev); | 883 | debug("%s(%p)\n", __func__, cdev); |
884 | stream_stop(dev); | 884 | stream_stop(cdev); |
885 | free_urbs(dev->data_urbs_in); | 885 | free_urbs(cdev->data_urbs_in); |
886 | free_urbs(dev->data_urbs_out); | 886 | free_urbs(cdev->data_urbs_out); |
887 | kfree(dev->data_cb_info); | 887 | kfree(cdev->data_cb_info); |
888 | } | 888 | } |
889 | 889 | ||
diff --git a/sound/usb/caiaq/audio.h b/sound/usb/caiaq/audio.h index 8ab1f8d9529e..bdf155300a8a 100644 --- a/sound/usb/caiaq/audio.h +++ b/sound/usb/caiaq/audio.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef CAIAQ_AUDIO_H | 1 | #ifndef CAIAQ_AUDIO_H |
2 | #define CAIAQ_AUDIO_H | 2 | #define CAIAQ_AUDIO_H |
3 | 3 | ||
4 | int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev); | 4 | int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev); |
5 | void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *dev); | 5 | void snd_usb_caiaq_audio_free(struct snd_usb_caiaqdev *cdev); |
6 | 6 | ||
7 | #endif /* CAIAQ_AUDIO_H */ | 7 | #endif /* CAIAQ_AUDIO_H */ |
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c index adb8d03267a0..2c5195948b2c 100644 --- a/sound/usb/caiaq/control.c +++ b/sound/usb/caiaq/control.c | |||
@@ -32,7 +32,7 @@ static int control_info(struct snd_kcontrol *kcontrol, | |||
32 | struct snd_ctl_elem_info *uinfo) | 32 | struct snd_ctl_elem_info *uinfo) |
33 | { | 33 | { |
34 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); | 34 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); |
35 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 35 | struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); |
36 | int pos = kcontrol->private_value; | 36 | int pos = kcontrol->private_value; |
37 | int is_intval = pos & CNT_INTVAL; | 37 | int is_intval = pos & CNT_INTVAL; |
38 | int maxval = 63; | 38 | int maxval = 63; |
@@ -40,7 +40,7 @@ static int control_info(struct snd_kcontrol *kcontrol, | |||
40 | uinfo->count = 1; | 40 | uinfo->count = 1; |
41 | pos &= ~CNT_INTVAL; | 41 | pos &= ~CNT_INTVAL; |
42 | 42 | ||
43 | switch (dev->chip.usb_id) { | 43 | switch (cdev->chip.usb_id) { |
44 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): | 44 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
45 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | 45 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
46 | if (pos == 0) { | 46 | if (pos == 0) { |
@@ -78,15 +78,15 @@ static int control_get(struct snd_kcontrol *kcontrol, | |||
78 | struct snd_ctl_elem_value *ucontrol) | 78 | struct snd_ctl_elem_value *ucontrol) |
79 | { | 79 | { |
80 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); | 80 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); |
81 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 81 | struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); |
82 | int pos = kcontrol->private_value; | 82 | int pos = kcontrol->private_value; |
83 | 83 | ||
84 | if (pos & CNT_INTVAL) | 84 | if (pos & CNT_INTVAL) |
85 | ucontrol->value.integer.value[0] | 85 | ucontrol->value.integer.value[0] |
86 | = dev->control_state[pos & ~CNT_INTVAL]; | 86 | = cdev->control_state[pos & ~CNT_INTVAL]; |
87 | else | 87 | else |
88 | ucontrol->value.integer.value[0] | 88 | ucontrol->value.integer.value[0] |
89 | = !!(dev->control_state[pos / 8] & (1 << pos % 8)); | 89 | = !!(cdev->control_state[pos / 8] & (1 << pos % 8)); |
90 | 90 | ||
91 | return 0; | 91 | return 0; |
92 | } | 92 | } |
@@ -95,43 +95,43 @@ static int control_put(struct snd_kcontrol *kcontrol, | |||
95 | struct snd_ctl_elem_value *ucontrol) | 95 | struct snd_ctl_elem_value *ucontrol) |
96 | { | 96 | { |
97 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); | 97 | struct snd_usb_audio *chip = snd_kcontrol_chip(kcontrol); |
98 | struct snd_usb_caiaqdev *dev = caiaqdev(chip->card); | 98 | struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); |
99 | int pos = kcontrol->private_value; | 99 | int pos = kcontrol->private_value; |
100 | int v = ucontrol->value.integer.value[0]; | 100 | int v = ucontrol->value.integer.value[0]; |
101 | unsigned char cmd = EP1_CMD_WRITE_IO; | 101 | unsigned char cmd = EP1_CMD_WRITE_IO; |
102 | 102 | ||
103 | if (dev->chip.usb_id == | 103 | if (cdev->chip.usb_id == |
104 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) | 104 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) |
105 | cmd = EP1_CMD_DIMM_LEDS; | 105 | cmd = EP1_CMD_DIMM_LEDS; |
106 | 106 | ||
107 | if (pos & CNT_INTVAL) { | 107 | if (pos & CNT_INTVAL) { |
108 | int i = pos & ~CNT_INTVAL; | 108 | int i = pos & ~CNT_INTVAL; |
109 | 109 | ||
110 | dev->control_state[i] = v; | 110 | cdev->control_state[i] = v; |
111 | 111 | ||
112 | if (dev->chip.usb_id == | 112 | if (cdev->chip.usb_id == |
113 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) { | 113 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4)) { |
114 | int actual_len; | 114 | int actual_len; |
115 | 115 | ||
116 | dev->ep8_out_buf[0] = i; | 116 | cdev->ep8_out_buf[0] = i; |
117 | dev->ep8_out_buf[1] = v; | 117 | cdev->ep8_out_buf[1] = v; |
118 | 118 | ||
119 | usb_bulk_msg(dev->chip.dev, | 119 | usb_bulk_msg(cdev->chip.dev, |
120 | usb_sndbulkpipe(dev->chip.dev, 8), | 120 | usb_sndbulkpipe(cdev->chip.dev, 8), |
121 | dev->ep8_out_buf, sizeof(dev->ep8_out_buf), | 121 | cdev->ep8_out_buf, sizeof(cdev->ep8_out_buf), |
122 | &actual_len, 200); | 122 | &actual_len, 200); |
123 | } else { | 123 | } else { |
124 | snd_usb_caiaq_send_command(dev, cmd, | 124 | snd_usb_caiaq_send_command(cdev, cmd, |
125 | dev->control_state, sizeof(dev->control_state)); | 125 | cdev->control_state, sizeof(cdev->control_state)); |
126 | } | 126 | } |
127 | } else { | 127 | } else { |
128 | if (v) | 128 | if (v) |
129 | dev->control_state[pos / 8] |= 1 << (pos % 8); | 129 | cdev->control_state[pos / 8] |= 1 << (pos % 8); |
130 | else | 130 | else |
131 | dev->control_state[pos / 8] &= ~(1 << (pos % 8)); | 131 | cdev->control_state[pos / 8] &= ~(1 << (pos % 8)); |
132 | 132 | ||
133 | snd_usb_caiaq_send_command(dev, cmd, | 133 | snd_usb_caiaq_send_command(cdev, cmd, |
134 | dev->control_state, sizeof(dev->control_state)); | 134 | cdev->control_state, sizeof(cdev->control_state)); |
135 | } | 135 | } |
136 | 136 | ||
137 | return 1; | 137 | return 1; |
@@ -490,7 +490,7 @@ static struct caiaq_controller kontrols4_controller[] = { | |||
490 | }; | 490 | }; |
491 | 491 | ||
492 | static int add_controls(struct caiaq_controller *c, int num, | 492 | static int add_controls(struct caiaq_controller *c, int num, |
493 | struct snd_usb_caiaqdev *dev) | 493 | struct snd_usb_caiaqdev *cdev) |
494 | { | 494 | { |
495 | int i, ret; | 495 | int i, ret; |
496 | struct snd_kcontrol *kc; | 496 | struct snd_kcontrol *kc; |
@@ -498,8 +498,8 @@ static int add_controls(struct caiaq_controller *c, int num, | |||
498 | for (i = 0; i < num; i++, c++) { | 498 | for (i = 0; i < num; i++, c++) { |
499 | kcontrol_template.name = c->name; | 499 | kcontrol_template.name = c->name; |
500 | kcontrol_template.private_value = c->index; | 500 | kcontrol_template.private_value = c->index; |
501 | kc = snd_ctl_new1(&kcontrol_template, dev); | 501 | kc = snd_ctl_new1(&kcontrol_template, cdev); |
502 | ret = snd_ctl_add(dev->chip.card, kc); | 502 | ret = snd_ctl_add(cdev->chip.card, kc); |
503 | if (ret < 0) | 503 | if (ret < 0) |
504 | return ret; | 504 | return ret; |
505 | } | 505 | } |
@@ -507,50 +507,50 @@ static int add_controls(struct caiaq_controller *c, int num, | |||
507 | return 0; | 507 | return 0; |
508 | } | 508 | } |
509 | 509 | ||
510 | int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) | 510 | int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *cdev) |
511 | { | 511 | { |
512 | int ret = 0; | 512 | int ret = 0; |
513 | 513 | ||
514 | switch (dev->chip.usb_id) { | 514 | switch (cdev->chip.usb_id) { |
515 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 515 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
516 | ret = add_controls(ak1_controller, | 516 | ret = add_controls(ak1_controller, |
517 | ARRAY_SIZE(ak1_controller), dev); | 517 | ARRAY_SIZE(ak1_controller), cdev); |
518 | break; | 518 | break; |
519 | 519 | ||
520 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): | 520 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): |
521 | ret = add_controls(rk2_controller, | 521 | ret = add_controls(rk2_controller, |
522 | ARRAY_SIZE(rk2_controller), dev); | 522 | ARRAY_SIZE(rk2_controller), cdev); |
523 | break; | 523 | break; |
524 | 524 | ||
525 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | 525 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): |
526 | ret = add_controls(rk3_controller, | 526 | ret = add_controls(rk3_controller, |
527 | ARRAY_SIZE(rk3_controller), dev); | 527 | ARRAY_SIZE(rk3_controller), cdev); |
528 | break; | 528 | break; |
529 | 529 | ||
530 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): | 530 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): |
531 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): | 531 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): |
532 | ret = add_controls(kore_controller, | 532 | ret = add_controls(kore_controller, |
533 | ARRAY_SIZE(kore_controller), dev); | 533 | ARRAY_SIZE(kore_controller), cdev); |
534 | break; | 534 | break; |
535 | 535 | ||
536 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): | 536 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
537 | ret = add_controls(a8dj_controller, | 537 | ret = add_controls(a8dj_controller, |
538 | ARRAY_SIZE(a8dj_controller), dev); | 538 | ARRAY_SIZE(a8dj_controller), cdev); |
539 | break; | 539 | break; |
540 | 540 | ||
541 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): | 541 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
542 | ret = add_controls(a4dj_controller, | 542 | ret = add_controls(a4dj_controller, |
543 | ARRAY_SIZE(a4dj_controller), dev); | 543 | ARRAY_SIZE(a4dj_controller), cdev); |
544 | break; | 544 | break; |
545 | 545 | ||
546 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 546 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
547 | ret = add_controls(kontrolx1_controller, | 547 | ret = add_controls(kontrolx1_controller, |
548 | ARRAY_SIZE(kontrolx1_controller), dev); | 548 | ARRAY_SIZE(kontrolx1_controller), cdev); |
549 | break; | 549 | break; |
550 | 550 | ||
551 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): | 551 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): |
552 | ret = add_controls(kontrols4_controller, | 552 | ret = add_controls(kontrols4_controller, |
553 | ARRAY_SIZE(kontrols4_controller), dev); | 553 | ARRAY_SIZE(kontrols4_controller), cdev); |
554 | break; | 554 | break; |
555 | } | 555 | } |
556 | 556 | ||
diff --git a/sound/usb/caiaq/control.h b/sound/usb/caiaq/control.h index 2e7ab1aa4fb3..501c4883aef6 100644 --- a/sound/usb/caiaq/control.h +++ b/sound/usb/caiaq/control.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef CAIAQ_CONTROL_H | 1 | #ifndef CAIAQ_CONTROL_H |
2 | #define CAIAQ_CONTROL_H | 2 | #define CAIAQ_CONTROL_H |
3 | 3 | ||
4 | int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev); | 4 | int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *cdev); |
5 | 5 | ||
6 | #endif /* CAIAQ_CONTROL_H */ | 6 | #endif /* CAIAQ_CONTROL_H */ |
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c index e4d6dbb0342d..45c3853b2a65 100644 --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c | |||
@@ -158,67 +158,67 @@ static struct usb_device_id snd_usb_id_table[] = { | |||
158 | static void usb_ep1_command_reply_dispatch (struct urb* urb) | 158 | static void usb_ep1_command_reply_dispatch (struct urb* urb) |
159 | { | 159 | { |
160 | int ret; | 160 | int ret; |
161 | struct snd_usb_caiaqdev *dev = urb->context; | 161 | struct snd_usb_caiaqdev *cdev = urb->context; |
162 | unsigned char *buf = urb->transfer_buffer; | 162 | unsigned char *buf = urb->transfer_buffer; |
163 | 163 | ||
164 | if (urb->status || !dev) { | 164 | if (urb->status || !cdev) { |
165 | log("received EP1 urb->status = %i\n", urb->status); | 165 | log("received EP1 urb->status = %i\n", urb->status); |
166 | return; | 166 | return; |
167 | } | 167 | } |
168 | 168 | ||
169 | switch(buf[0]) { | 169 | switch(buf[0]) { |
170 | case EP1_CMD_GET_DEVICE_INFO: | 170 | case EP1_CMD_GET_DEVICE_INFO: |
171 | memcpy(&dev->spec, buf+1, sizeof(struct caiaq_device_spec)); | 171 | memcpy(&cdev->spec, buf+1, sizeof(struct caiaq_device_spec)); |
172 | dev->spec.fw_version = le16_to_cpu(dev->spec.fw_version); | 172 | cdev->spec.fw_version = le16_to_cpu(cdev->spec.fw_version); |
173 | debug("device spec (firmware %d): audio: %d in, %d out, " | 173 | debug("device spec (firmware %d): audio: %d in, %d out, " |
174 | "MIDI: %d in, %d out, data alignment %d\n", | 174 | "MIDI: %d in, %d out, data alignment %d\n", |
175 | dev->spec.fw_version, | 175 | cdev->spec.fw_version, |
176 | dev->spec.num_analog_audio_in, | 176 | cdev->spec.num_analog_audio_in, |
177 | dev->spec.num_analog_audio_out, | 177 | cdev->spec.num_analog_audio_out, |
178 | dev->spec.num_midi_in, | 178 | cdev->spec.num_midi_in, |
179 | dev->spec.num_midi_out, | 179 | cdev->spec.num_midi_out, |
180 | dev->spec.data_alignment); | 180 | cdev->spec.data_alignment); |
181 | 181 | ||
182 | dev->spec_received++; | 182 | cdev->spec_received++; |
183 | wake_up(&dev->ep1_wait_queue); | 183 | wake_up(&cdev->ep1_wait_queue); |
184 | break; | 184 | break; |
185 | case EP1_CMD_AUDIO_PARAMS: | 185 | case EP1_CMD_AUDIO_PARAMS: |
186 | dev->audio_parm_answer = buf[1]; | 186 | cdev->audio_parm_answer = buf[1]; |
187 | wake_up(&dev->ep1_wait_queue); | 187 | wake_up(&cdev->ep1_wait_queue); |
188 | break; | 188 | break; |
189 | case EP1_CMD_MIDI_READ: | 189 | case EP1_CMD_MIDI_READ: |
190 | snd_usb_caiaq_midi_handle_input(dev, buf[1], buf + 3, buf[2]); | 190 | snd_usb_caiaq_midi_handle_input(cdev, buf[1], buf + 3, buf[2]); |
191 | break; | 191 | break; |
192 | case EP1_CMD_READ_IO: | 192 | case EP1_CMD_READ_IO: |
193 | if (dev->chip.usb_id == | 193 | if (cdev->chip.usb_id == |
194 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) { | 194 | USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ)) { |
195 | if (urb->actual_length > sizeof(dev->control_state)) | 195 | if (urb->actual_length > sizeof(cdev->control_state)) |
196 | urb->actual_length = sizeof(dev->control_state); | 196 | urb->actual_length = sizeof(cdev->control_state); |
197 | memcpy(dev->control_state, buf + 1, urb->actual_length); | 197 | memcpy(cdev->control_state, buf + 1, urb->actual_length); |
198 | wake_up(&dev->ep1_wait_queue); | 198 | wake_up(&cdev->ep1_wait_queue); |
199 | break; | 199 | break; |
200 | } | 200 | } |
201 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 201 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT |
202 | case EP1_CMD_READ_ERP: | 202 | case EP1_CMD_READ_ERP: |
203 | case EP1_CMD_READ_ANALOG: | 203 | case EP1_CMD_READ_ANALOG: |
204 | snd_usb_caiaq_input_dispatch(dev, buf, urb->actual_length); | 204 | snd_usb_caiaq_input_dispatch(cdev, buf, urb->actual_length); |
205 | #endif | 205 | #endif |
206 | break; | 206 | break; |
207 | } | 207 | } |
208 | 208 | ||
209 | dev->ep1_in_urb.actual_length = 0; | 209 | cdev->ep1_in_urb.actual_length = 0; |
210 | ret = usb_submit_urb(&dev->ep1_in_urb, GFP_ATOMIC); | 210 | ret = usb_submit_urb(&cdev->ep1_in_urb, GFP_ATOMIC); |
211 | if (ret < 0) | 211 | if (ret < 0) |
212 | log("unable to submit urb. OOM!?\n"); | 212 | log("unable to submit urb. OOM!?\n"); |
213 | } | 213 | } |
214 | 214 | ||
215 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, | 215 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev, |
216 | unsigned char command, | 216 | unsigned char command, |
217 | const unsigned char *buffer, | 217 | const unsigned char *buffer, |
218 | int len) | 218 | int len) |
219 | { | 219 | { |
220 | int actual_len; | 220 | int actual_len; |
221 | struct usb_device *usb_dev = dev->chip.dev; | 221 | struct usb_device *usb_dev = cdev->chip.dev; |
222 | 222 | ||
223 | if (!usb_dev) | 223 | if (!usb_dev) |
224 | return -EIO; | 224 | return -EIO; |
@@ -227,14 +227,14 @@ int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, | |||
227 | len = EP1_BUFSIZE - 1; | 227 | len = EP1_BUFSIZE - 1; |
228 | 228 | ||
229 | if (buffer && len > 0) | 229 | if (buffer && len > 0) |
230 | memcpy(dev->ep1_out_buf+1, buffer, len); | 230 | memcpy(cdev->ep1_out_buf+1, buffer, len); |
231 | 231 | ||
232 | dev->ep1_out_buf[0] = command; | 232 | cdev->ep1_out_buf[0] = command; |
233 | return usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, 1), | 233 | return usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, 1), |
234 | dev->ep1_out_buf, len+1, &actual_len, 200); | 234 | cdev->ep1_out_buf, len+1, &actual_len, 200); |
235 | } | 235 | } |
236 | 236 | ||
237 | int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, | 237 | int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, |
238 | int rate, int depth, int bpp) | 238 | int rate, int depth, int bpp) |
239 | { | 239 | { |
240 | int ret; | 240 | int ret; |
@@ -262,46 +262,46 @@ int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, | |||
262 | debug("setting audio params: %d Hz, %d bits, %d bpp\n", | 262 | debug("setting audio params: %d Hz, %d bits, %d bpp\n", |
263 | rate, depth, bpp); | 263 | rate, depth, bpp); |
264 | 264 | ||
265 | dev->audio_parm_answer = -1; | 265 | cdev->audio_parm_answer = -1; |
266 | ret = snd_usb_caiaq_send_command(dev, EP1_CMD_AUDIO_PARAMS, | 266 | ret = snd_usb_caiaq_send_command(cdev, EP1_CMD_AUDIO_PARAMS, |
267 | tmp, sizeof(tmp)); | 267 | tmp, sizeof(tmp)); |
268 | 268 | ||
269 | if (ret) | 269 | if (ret) |
270 | return ret; | 270 | return ret; |
271 | 271 | ||
272 | if (!wait_event_timeout(dev->ep1_wait_queue, | 272 | if (!wait_event_timeout(cdev->ep1_wait_queue, |
273 | dev->audio_parm_answer >= 0, HZ)) | 273 | cdev->audio_parm_answer >= 0, HZ)) |
274 | return -EPIPE; | 274 | return -EPIPE; |
275 | 275 | ||
276 | if (dev->audio_parm_answer != 1) | 276 | if (cdev->audio_parm_answer != 1) |
277 | debug("unable to set the device's audio params\n"); | 277 | debug("unable to set the device's audio params\n"); |
278 | else | 278 | else |
279 | dev->bpp = bpp; | 279 | cdev->bpp = bpp; |
280 | 280 | ||
281 | return dev->audio_parm_answer == 1 ? 0 : -EINVAL; | 281 | return cdev->audio_parm_answer == 1 ? 0 : -EINVAL; |
282 | } | 282 | } |
283 | 283 | ||
284 | int snd_usb_caiaq_set_auto_msg(struct snd_usb_caiaqdev *dev, | 284 | int snd_usb_caiaq_set_auto_msg(struct snd_usb_caiaqdev *cdev, |
285 | int digital, int analog, int erp) | 285 | int digital, int analog, int erp) |
286 | { | 286 | { |
287 | char tmp[3] = { digital, analog, erp }; | 287 | char tmp[3] = { digital, analog, erp }; |
288 | return snd_usb_caiaq_send_command(dev, EP1_CMD_AUTO_MSG, | 288 | return snd_usb_caiaq_send_command(cdev, EP1_CMD_AUTO_MSG, |
289 | tmp, sizeof(tmp)); | 289 | tmp, sizeof(tmp)); |
290 | } | 290 | } |
291 | 291 | ||
292 | static void setup_card(struct snd_usb_caiaqdev *dev) | 292 | static void setup_card(struct snd_usb_caiaqdev *cdev) |
293 | { | 293 | { |
294 | int ret; | 294 | int ret; |
295 | char val[4]; | 295 | char val[4]; |
296 | 296 | ||
297 | /* device-specific startup specials */ | 297 | /* device-specific startup specials */ |
298 | switch (dev->chip.usb_id) { | 298 | switch (cdev->chip.usb_id) { |
299 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): | 299 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): |
300 | /* RigKontrol2 - display centered dash ('-') */ | 300 | /* RigKontrol2 - display centered dash ('-') */ |
301 | val[0] = 0x00; | 301 | val[0] = 0x00; |
302 | val[1] = 0x00; | 302 | val[1] = 0x00; |
303 | val[2] = 0x01; | 303 | val[2] = 0x01; |
304 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 3); | 304 | snd_usb_caiaq_send_command(cdev, EP1_CMD_WRITE_IO, val, 3); |
305 | break; | 305 | break; |
306 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | 306 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): |
307 | /* RigKontrol2 - display two centered dashes ('--') */ | 307 | /* RigKontrol2 - display two centered dashes ('--') */ |
@@ -309,67 +309,67 @@ static void setup_card(struct snd_usb_caiaqdev *dev) | |||
309 | val[1] = 0x40; | 309 | val[1] = 0x40; |
310 | val[2] = 0x40; | 310 | val[2] = 0x40; |
311 | val[3] = 0x00; | 311 | val[3] = 0x00; |
312 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 4); | 312 | snd_usb_caiaq_send_command(cdev, EP1_CMD_WRITE_IO, val, 4); |
313 | break; | 313 | break; |
314 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 314 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
315 | /* Audio Kontrol 1 - make USB-LED stop blinking */ | 315 | /* Audio Kontrol 1 - make USB-LED stop blinking */ |
316 | val[0] = 0x00; | 316 | val[0] = 0x00; |
317 | snd_usb_caiaq_send_command(dev, EP1_CMD_WRITE_IO, val, 1); | 317 | snd_usb_caiaq_send_command(cdev, EP1_CMD_WRITE_IO, val, 1); |
318 | break; | 318 | break; |
319 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): | 319 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
320 | /* Audio 8 DJ - trigger read of current settings */ | 320 | /* Audio 8 DJ - trigger read of current settings */ |
321 | dev->control_state[0] = 0xff; | 321 | cdev->control_state[0] = 0xff; |
322 | snd_usb_caiaq_set_auto_msg(dev, 1, 0, 0); | 322 | snd_usb_caiaq_set_auto_msg(cdev, 1, 0, 0); |
323 | snd_usb_caiaq_send_command(dev, EP1_CMD_READ_IO, NULL, 0); | 323 | snd_usb_caiaq_send_command(cdev, EP1_CMD_READ_IO, NULL, 0); |
324 | 324 | ||
325 | if (!wait_event_timeout(dev->ep1_wait_queue, | 325 | if (!wait_event_timeout(cdev->ep1_wait_queue, |
326 | dev->control_state[0] != 0xff, HZ)) | 326 | cdev->control_state[0] != 0xff, HZ)) |
327 | return; | 327 | return; |
328 | 328 | ||
329 | /* fix up some defaults */ | 329 | /* fix up some defaults */ |
330 | if ((dev->control_state[1] != 2) || | 330 | if ((cdev->control_state[1] != 2) || |
331 | (dev->control_state[2] != 3) || | 331 | (cdev->control_state[2] != 3) || |
332 | (dev->control_state[4] != 2)) { | 332 | (cdev->control_state[4] != 2)) { |
333 | dev->control_state[1] = 2; | 333 | cdev->control_state[1] = 2; |
334 | dev->control_state[2] = 3; | 334 | cdev->control_state[2] = 3; |
335 | dev->control_state[4] = 2; | 335 | cdev->control_state[4] = 2; |
336 | snd_usb_caiaq_send_command(dev, | 336 | snd_usb_caiaq_send_command(cdev, |
337 | EP1_CMD_WRITE_IO, dev->control_state, 6); | 337 | EP1_CMD_WRITE_IO, cdev->control_state, 6); |
338 | } | 338 | } |
339 | 339 | ||
340 | break; | 340 | break; |
341 | } | 341 | } |
342 | 342 | ||
343 | if (dev->spec.num_analog_audio_out + | 343 | if (cdev->spec.num_analog_audio_out + |
344 | dev->spec.num_analog_audio_in + | 344 | cdev->spec.num_analog_audio_in + |
345 | dev->spec.num_digital_audio_out + | 345 | cdev->spec.num_digital_audio_out + |
346 | dev->spec.num_digital_audio_in > 0) { | 346 | cdev->spec.num_digital_audio_in > 0) { |
347 | ret = snd_usb_caiaq_audio_init(dev); | 347 | ret = snd_usb_caiaq_audio_init(cdev); |
348 | if (ret < 0) | 348 | if (ret < 0) |
349 | log("Unable to set up audio system (ret=%d)\n", ret); | 349 | log("Unable to set up audio system (ret=%d)\n", ret); |
350 | } | 350 | } |
351 | 351 | ||
352 | if (dev->spec.num_midi_in + | 352 | if (cdev->spec.num_midi_in + |
353 | dev->spec.num_midi_out > 0) { | 353 | cdev->spec.num_midi_out > 0) { |
354 | ret = snd_usb_caiaq_midi_init(dev); | 354 | ret = snd_usb_caiaq_midi_init(cdev); |
355 | if (ret < 0) | 355 | if (ret < 0) |
356 | log("Unable to set up MIDI system (ret=%d)\n", ret); | 356 | log("Unable to set up MIDI system (ret=%d)\n", ret); |
357 | } | 357 | } |
358 | 358 | ||
359 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 359 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT |
360 | ret = snd_usb_caiaq_input_init(dev); | 360 | ret = snd_usb_caiaq_input_init(cdev); |
361 | if (ret < 0) | 361 | if (ret < 0) |
362 | log("Unable to set up input system (ret=%d)\n", ret); | 362 | log("Unable to set up input system (ret=%d)\n", ret); |
363 | #endif | 363 | #endif |
364 | 364 | ||
365 | /* finally, register the card and all its sub-instances */ | 365 | /* finally, register the card and all its sub-instances */ |
366 | ret = snd_card_register(dev->chip.card); | 366 | ret = snd_card_register(cdev->chip.card); |
367 | if (ret < 0) { | 367 | if (ret < 0) { |
368 | log("snd_card_register() returned %d\n", ret); | 368 | log("snd_card_register() returned %d\n", ret); |
369 | snd_card_free(dev->chip.card); | 369 | snd_card_free(cdev->chip.card); |
370 | } | 370 | } |
371 | 371 | ||
372 | ret = snd_usb_caiaq_control_init(dev); | 372 | ret = snd_usb_caiaq_control_init(cdev); |
373 | if (ret < 0) | 373 | if (ret < 0) |
374 | log("Unable to set up control system (ret=%d)\n", ret); | 374 | log("Unable to set up control system (ret=%d)\n", ret); |
375 | } | 375 | } |
@@ -381,7 +381,7 @@ static int create_card(struct usb_device *usb_dev, | |||
381 | int devnum; | 381 | int devnum; |
382 | int err; | 382 | int err; |
383 | struct snd_card *card; | 383 | struct snd_card *card; |
384 | struct snd_usb_caiaqdev *dev; | 384 | struct snd_usb_caiaqdev *cdev; |
385 | 385 | ||
386 | for (devnum = 0; devnum < SNDRV_CARDS; devnum++) | 386 | for (devnum = 0; devnum < SNDRV_CARDS; devnum++) |
387 | if (enable[devnum] && !snd_card_used[devnum]) | 387 | if (enable[devnum] && !snd_card_used[devnum]) |
@@ -395,23 +395,23 @@ static int create_card(struct usb_device *usb_dev, | |||
395 | if (err < 0) | 395 | if (err < 0) |
396 | return err; | 396 | return err; |
397 | 397 | ||
398 | dev = caiaqdev(card); | 398 | cdev = caiaqdev(card); |
399 | dev->chip.dev = usb_dev; | 399 | cdev->chip.dev = usb_dev; |
400 | dev->chip.card = card; | 400 | cdev->chip.card = card; |
401 | dev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), | 401 | cdev->chip.usb_id = USB_ID(le16_to_cpu(usb_dev->descriptor.idVendor), |
402 | le16_to_cpu(usb_dev->descriptor.idProduct)); | 402 | le16_to_cpu(usb_dev->descriptor.idProduct)); |
403 | spin_lock_init(&dev->spinlock); | 403 | spin_lock_init(&cdev->spinlock); |
404 | snd_card_set_dev(card, &intf->dev); | 404 | snd_card_set_dev(card, &intf->dev); |
405 | 405 | ||
406 | *cardp = card; | 406 | *cardp = card; |
407 | return 0; | 407 | return 0; |
408 | } | 408 | } |
409 | 409 | ||
410 | static int init_card(struct snd_usb_caiaqdev *dev) | 410 | static int init_card(struct snd_usb_caiaqdev *cdev) |
411 | { | 411 | { |
412 | char *c, usbpath[32]; | 412 | char *c, usbpath[32]; |
413 | struct usb_device *usb_dev = dev->chip.dev; | 413 | struct usb_device *usb_dev = cdev->chip.dev; |
414 | struct snd_card *card = dev->chip.card; | 414 | struct snd_card *card = cdev->chip.card; |
415 | int err, len; | 415 | int err, len; |
416 | 416 | ||
417 | if (usb_set_interface(usb_dev, 0, 1) != 0) { | 417 | if (usb_set_interface(usb_dev, 0, 1) != 0) { |
@@ -419,41 +419,41 @@ static int init_card(struct snd_usb_caiaqdev *dev) | |||
419 | return -EIO; | 419 | return -EIO; |
420 | } | 420 | } |
421 | 421 | ||
422 | usb_init_urb(&dev->ep1_in_urb); | 422 | usb_init_urb(&cdev->ep1_in_urb); |
423 | usb_init_urb(&dev->midi_out_urb); | 423 | usb_init_urb(&cdev->midi_out_urb); |
424 | 424 | ||
425 | usb_fill_bulk_urb(&dev->ep1_in_urb, usb_dev, | 425 | usb_fill_bulk_urb(&cdev->ep1_in_urb, usb_dev, |
426 | usb_rcvbulkpipe(usb_dev, 0x1), | 426 | usb_rcvbulkpipe(usb_dev, 0x1), |
427 | dev->ep1_in_buf, EP1_BUFSIZE, | 427 | cdev->ep1_in_buf, EP1_BUFSIZE, |
428 | usb_ep1_command_reply_dispatch, dev); | 428 | usb_ep1_command_reply_dispatch, cdev); |
429 | 429 | ||
430 | usb_fill_bulk_urb(&dev->midi_out_urb, usb_dev, | 430 | usb_fill_bulk_urb(&cdev->midi_out_urb, usb_dev, |
431 | usb_sndbulkpipe(usb_dev, 0x1), | 431 | usb_sndbulkpipe(usb_dev, 0x1), |
432 | dev->midi_out_buf, EP1_BUFSIZE, | 432 | cdev->midi_out_buf, EP1_BUFSIZE, |
433 | snd_usb_caiaq_midi_output_done, dev); | 433 | snd_usb_caiaq_midi_output_done, cdev); |
434 | 434 | ||
435 | init_waitqueue_head(&dev->ep1_wait_queue); | 435 | init_waitqueue_head(&cdev->ep1_wait_queue); |
436 | init_waitqueue_head(&dev->prepare_wait_queue); | 436 | init_waitqueue_head(&cdev->prepare_wait_queue); |
437 | 437 | ||
438 | if (usb_submit_urb(&dev->ep1_in_urb, GFP_KERNEL) != 0) | 438 | if (usb_submit_urb(&cdev->ep1_in_urb, GFP_KERNEL) != 0) |
439 | return -EIO; | 439 | return -EIO; |
440 | 440 | ||
441 | err = snd_usb_caiaq_send_command(dev, EP1_CMD_GET_DEVICE_INFO, NULL, 0); | 441 | err = snd_usb_caiaq_send_command(cdev, EP1_CMD_GET_DEVICE_INFO, NULL, 0); |
442 | if (err) | 442 | if (err) |
443 | return err; | 443 | return err; |
444 | 444 | ||
445 | if (!wait_event_timeout(dev->ep1_wait_queue, dev->spec_received, HZ)) | 445 | if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ)) |
446 | return -ENODEV; | 446 | return -ENODEV; |
447 | 447 | ||
448 | usb_string(usb_dev, usb_dev->descriptor.iManufacturer, | 448 | usb_string(usb_dev, usb_dev->descriptor.iManufacturer, |
449 | dev->vendor_name, CAIAQ_USB_STR_LEN); | 449 | cdev->vendor_name, CAIAQ_USB_STR_LEN); |
450 | 450 | ||
451 | usb_string(usb_dev, usb_dev->descriptor.iProduct, | 451 | usb_string(usb_dev, usb_dev->descriptor.iProduct, |
452 | dev->product_name, CAIAQ_USB_STR_LEN); | 452 | cdev->product_name, CAIAQ_USB_STR_LEN); |
453 | 453 | ||
454 | strlcpy(card->driver, MODNAME, sizeof(card->driver)); | 454 | strlcpy(card->driver, MODNAME, sizeof(card->driver)); |
455 | strlcpy(card->shortname, dev->product_name, sizeof(card->shortname)); | 455 | strlcpy(card->shortname, cdev->product_name, sizeof(card->shortname)); |
456 | strlcpy(card->mixername, dev->product_name, sizeof(card->mixername)); | 456 | strlcpy(card->mixername, cdev->product_name, sizeof(card->mixername)); |
457 | 457 | ||
458 | /* if the id was not passed as module option, fill it with a shortened | 458 | /* if the id was not passed as module option, fill it with a shortened |
459 | * version of the product string which does not contain any | 459 | * version of the product string which does not contain any |
@@ -475,9 +475,9 @@ static int init_card(struct snd_usb_caiaqdev *dev) | |||
475 | usb_make_path(usb_dev, usbpath, sizeof(usbpath)); | 475 | usb_make_path(usb_dev, usbpath, sizeof(usbpath)); |
476 | snprintf(card->longname, sizeof(card->longname), | 476 | snprintf(card->longname, sizeof(card->longname), |
477 | "%s %s (%s)", | 477 | "%s %s (%s)", |
478 | dev->vendor_name, dev->product_name, usbpath); | 478 | cdev->vendor_name, cdev->product_name, usbpath); |
479 | 479 | ||
480 | setup_card(dev); | 480 | setup_card(cdev); |
481 | return 0; | 481 | return 0; |
482 | } | 482 | } |
483 | 483 | ||
@@ -486,9 +486,9 @@ static int snd_probe(struct usb_interface *intf, | |||
486 | { | 486 | { |
487 | int ret; | 487 | int ret; |
488 | struct snd_card *card = NULL; | 488 | struct snd_card *card = NULL; |
489 | struct usb_device *device = interface_to_usbdev(intf); | 489 | struct usb_device *usb_dev = interface_to_usbdev(intf); |
490 | 490 | ||
491 | ret = create_card(device, intf, &card); | 491 | ret = create_card(usb_dev, intf, &card); |
492 | 492 | ||
493 | if (ret < 0) | 493 | if (ret < 0) |
494 | return ret; | 494 | return ret; |
@@ -506,7 +506,7 @@ static int snd_probe(struct usb_interface *intf, | |||
506 | 506 | ||
507 | static void snd_disconnect(struct usb_interface *intf) | 507 | static void snd_disconnect(struct usb_interface *intf) |
508 | { | 508 | { |
509 | struct snd_usb_caiaqdev *dev; | 509 | struct snd_usb_caiaqdev *cdev; |
510 | struct snd_card *card = usb_get_intfdata(intf); | 510 | struct snd_card *card = usb_get_intfdata(intf); |
511 | 511 | ||
512 | debug("%s(%p)\n", __func__, intf); | 512 | debug("%s(%p)\n", __func__, intf); |
@@ -514,16 +514,16 @@ static void snd_disconnect(struct usb_interface *intf) | |||
514 | if (!card) | 514 | if (!card) |
515 | return; | 515 | return; |
516 | 516 | ||
517 | dev = caiaqdev(card); | 517 | cdev = caiaqdev(card); |
518 | snd_card_disconnect(card); | 518 | snd_card_disconnect(card); |
519 | 519 | ||
520 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT | 520 | #ifdef CONFIG_SND_USB_CAIAQ_INPUT |
521 | snd_usb_caiaq_input_free(dev); | 521 | snd_usb_caiaq_input_free(cdev); |
522 | #endif | 522 | #endif |
523 | snd_usb_caiaq_audio_free(dev); | 523 | snd_usb_caiaq_audio_free(cdev); |
524 | 524 | ||
525 | usb_kill_urb(&dev->ep1_in_urb); | 525 | usb_kill_urb(&cdev->ep1_in_urb); |
526 | usb_kill_urb(&dev->midi_out_urb); | 526 | usb_kill_urb(&cdev->midi_out_urb); |
527 | 527 | ||
528 | snd_card_free(card); | 528 | snd_card_free(card); |
529 | usb_reset_device(interface_to_usbdev(intf)); | 529 | usb_reset_device(interface_to_usbdev(intf)); |
diff --git a/sound/usb/caiaq/device.h b/sound/usb/caiaq/device.h index 562b0bff9c41..7176a0ec950b 100644 --- a/sound/usb/caiaq/device.h +++ b/sound/usb/caiaq/device.h | |||
@@ -124,15 +124,15 @@ struct snd_usb_caiaqdev { | |||
124 | }; | 124 | }; |
125 | 125 | ||
126 | struct snd_usb_caiaq_cb_info { | 126 | struct snd_usb_caiaq_cb_info { |
127 | struct snd_usb_caiaqdev *dev; | 127 | struct snd_usb_caiaqdev *cdev; |
128 | int index; | 128 | int index; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | #define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) | 131 | #define caiaqdev(c) ((struct snd_usb_caiaqdev*)(c)->private_data) |
132 | 132 | ||
133 | int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *dev, int rate, int depth, int bbp); | 133 | int snd_usb_caiaq_set_audio_params (struct snd_usb_caiaqdev *cdev, int rate, int depth, int bbp); |
134 | int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *dev, int digital, int analog, int erp); | 134 | int snd_usb_caiaq_set_auto_msg (struct snd_usb_caiaqdev *cdev, int digital, int analog, int erp); |
135 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *dev, | 135 | int snd_usb_caiaq_send_command(struct snd_usb_caiaqdev *cdev, |
136 | unsigned char command, | 136 | unsigned char command, |
137 | const unsigned char *buffer, | 137 | const unsigned char *buffer, |
138 | int len); | 138 | int len); |
diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c index 26a121b42c3c..a32ad7cd76f9 100644 --- a/sound/usb/caiaq/input.c +++ b/sound/usb/caiaq/input.c | |||
@@ -199,55 +199,55 @@ static unsigned int decode_erp(unsigned char a, unsigned char b) | |||
199 | #undef HIGH_PEAK | 199 | #undef HIGH_PEAK |
200 | #undef LOW_PEAK | 200 | #undef LOW_PEAK |
201 | 201 | ||
202 | static inline void snd_caiaq_input_report_abs(struct snd_usb_caiaqdev *dev, | 202 | static inline void snd_caiaq_input_report_abs(struct snd_usb_caiaqdev *cdev, |
203 | int axis, const unsigned char *buf, | 203 | int axis, const unsigned char *buf, |
204 | int offset) | 204 | int offset) |
205 | { | 205 | { |
206 | input_report_abs(dev->input_dev, axis, | 206 | input_report_abs(cdev->input_dev, axis, |
207 | (buf[offset * 2] << 8) | buf[offset * 2 + 1]); | 207 | (buf[offset * 2] << 8) | buf[offset * 2 + 1]); |
208 | } | 208 | } |
209 | 209 | ||
210 | static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *dev, | 210 | static void snd_caiaq_input_read_analog(struct snd_usb_caiaqdev *cdev, |
211 | const unsigned char *buf, | 211 | const unsigned char *buf, |
212 | unsigned int len) | 212 | unsigned int len) |
213 | { | 213 | { |
214 | struct input_dev *input_dev = dev->input_dev; | 214 | struct input_dev *input_dev = cdev->input_dev; |
215 | 215 | ||
216 | switch (dev->chip.usb_id) { | 216 | switch (cdev->chip.usb_id) { |
217 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): | 217 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): |
218 | snd_caiaq_input_report_abs(dev, ABS_X, buf, 2); | 218 | snd_caiaq_input_report_abs(cdev, ABS_X, buf, 2); |
219 | snd_caiaq_input_report_abs(dev, ABS_Y, buf, 0); | 219 | snd_caiaq_input_report_abs(cdev, ABS_Y, buf, 0); |
220 | snd_caiaq_input_report_abs(dev, ABS_Z, buf, 1); | 220 | snd_caiaq_input_report_abs(cdev, ABS_Z, buf, 1); |
221 | break; | 221 | break; |
222 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | 222 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): |
223 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): | 223 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): |
224 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): | 224 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): |
225 | snd_caiaq_input_report_abs(dev, ABS_X, buf, 0); | 225 | snd_caiaq_input_report_abs(cdev, ABS_X, buf, 0); |
226 | snd_caiaq_input_report_abs(dev, ABS_Y, buf, 1); | 226 | snd_caiaq_input_report_abs(cdev, ABS_Y, buf, 1); |
227 | snd_caiaq_input_report_abs(dev, ABS_Z, buf, 2); | 227 | snd_caiaq_input_report_abs(cdev, ABS_Z, buf, 2); |
228 | break; | 228 | break; |
229 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 229 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
230 | snd_caiaq_input_report_abs(dev, ABS_HAT0X, buf, 4); | 230 | snd_caiaq_input_report_abs(cdev, ABS_HAT0X, buf, 4); |
231 | snd_caiaq_input_report_abs(dev, ABS_HAT0Y, buf, 2); | 231 | snd_caiaq_input_report_abs(cdev, ABS_HAT0Y, buf, 2); |
232 | snd_caiaq_input_report_abs(dev, ABS_HAT1X, buf, 6); | 232 | snd_caiaq_input_report_abs(cdev, ABS_HAT1X, buf, 6); |
233 | snd_caiaq_input_report_abs(dev, ABS_HAT1Y, buf, 1); | 233 | snd_caiaq_input_report_abs(cdev, ABS_HAT1Y, buf, 1); |
234 | snd_caiaq_input_report_abs(dev, ABS_HAT2X, buf, 7); | 234 | snd_caiaq_input_report_abs(cdev, ABS_HAT2X, buf, 7); |
235 | snd_caiaq_input_report_abs(dev, ABS_HAT2Y, buf, 0); | 235 | snd_caiaq_input_report_abs(cdev, ABS_HAT2Y, buf, 0); |
236 | snd_caiaq_input_report_abs(dev, ABS_HAT3X, buf, 5); | 236 | snd_caiaq_input_report_abs(cdev, ABS_HAT3X, buf, 5); |
237 | snd_caiaq_input_report_abs(dev, ABS_HAT3Y, buf, 3); | 237 | snd_caiaq_input_report_abs(cdev, ABS_HAT3Y, buf, 3); |
238 | break; | 238 | break; |
239 | } | 239 | } |
240 | 240 | ||
241 | input_sync(input_dev); | 241 | input_sync(input_dev); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev, | 244 | static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *cdev, |
245 | const char *buf, unsigned int len) | 245 | const char *buf, unsigned int len) |
246 | { | 246 | { |
247 | struct input_dev *input_dev = dev->input_dev; | 247 | struct input_dev *input_dev = cdev->input_dev; |
248 | int i; | 248 | int i; |
249 | 249 | ||
250 | switch (dev->chip.usb_id) { | 250 | switch (cdev->chip.usb_id) { |
251 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 251 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
252 | i = decode_erp(buf[0], buf[1]); | 252 | i = decode_erp(buf[0], buf[1]); |
253 | input_report_abs(input_dev, ABS_X, i); | 253 | input_report_abs(input_dev, ABS_X, i); |
@@ -299,10 +299,10 @@ static void snd_caiaq_input_read_erp(struct snd_usb_caiaqdev *dev, | |||
299 | } | 299 | } |
300 | } | 300 | } |
301 | 301 | ||
302 | static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *dev, | 302 | static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *cdev, |
303 | unsigned char *buf, unsigned int len) | 303 | unsigned char *buf, unsigned int len) |
304 | { | 304 | { |
305 | struct input_dev *input_dev = dev->input_dev; | 305 | struct input_dev *input_dev = cdev->input_dev; |
306 | unsigned short *keycode = input_dev->keycode; | 306 | unsigned short *keycode = input_dev->keycode; |
307 | int i; | 307 | int i; |
308 | 308 | ||
@@ -317,17 +317,17 @@ static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *dev, | |||
317 | input_report_key(input_dev, keycode[i], | 317 | input_report_key(input_dev, keycode[i], |
318 | buf[i / 8] & (1 << (i % 8))); | 318 | buf[i / 8] & (1 << (i % 8))); |
319 | 319 | ||
320 | switch (dev->chip.usb_id) { | 320 | switch (cdev->chip.usb_id) { |
321 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): | 321 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): |
322 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): | 322 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): |
323 | input_report_abs(dev->input_dev, ABS_MISC, 255 - buf[4]); | 323 | input_report_abs(cdev->input_dev, ABS_MISC, 255 - buf[4]); |
324 | break; | 324 | break; |
325 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 325 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
326 | /* rotary encoders */ | 326 | /* rotary encoders */ |
327 | input_report_abs(dev->input_dev, ABS_X, buf[5] & 0xf); | 327 | input_report_abs(cdev->input_dev, ABS_X, buf[5] & 0xf); |
328 | input_report_abs(dev->input_dev, ABS_Y, buf[5] >> 4); | 328 | input_report_abs(cdev->input_dev, ABS_Y, buf[5] >> 4); |
329 | input_report_abs(dev->input_dev, ABS_Z, buf[6] & 0xf); | 329 | input_report_abs(cdev->input_dev, ABS_Z, buf[6] & 0xf); |
330 | input_report_abs(dev->input_dev, ABS_MISC, buf[6] >> 4); | 330 | input_report_abs(cdev->input_dev, ABS_MISC, buf[6] >> 4); |
331 | break; | 331 | break; |
332 | } | 332 | } |
333 | 333 | ||
@@ -336,7 +336,7 @@ static void snd_caiaq_input_read_io(struct snd_usb_caiaqdev *dev, | |||
336 | 336 | ||
337 | #define TKS4_MSGBLOCK_SIZE 16 | 337 | #define TKS4_MSGBLOCK_SIZE 16 |
338 | 338 | ||
339 | static void snd_usb_caiaq_tks4_dispatch(struct snd_usb_caiaqdev *dev, | 339 | static void snd_usb_caiaq_tks4_dispatch(struct snd_usb_caiaqdev *cdev, |
340 | const unsigned char *buf, | 340 | const unsigned char *buf, |
341 | unsigned int len) | 341 | unsigned int len) |
342 | { | 342 | { |
@@ -347,121 +347,121 @@ static void snd_usb_caiaq_tks4_dispatch(struct snd_usb_caiaqdev *dev, | |||
347 | case 0: | 347 | case 0: |
348 | /* buttons */ | 348 | /* buttons */ |
349 | for (i = 0; i < KONTROLS4_BUTTONS; i++) | 349 | for (i = 0; i < KONTROLS4_BUTTONS; i++) |
350 | input_report_key(dev->input_dev, KONTROLS4_BUTTON(i), | 350 | input_report_key(cdev->input_dev, KONTROLS4_BUTTON(i), |
351 | (buf[4 + (i / 8)] >> (i % 8)) & 1); | 351 | (buf[4 + (i / 8)] >> (i % 8)) & 1); |
352 | break; | 352 | break; |
353 | 353 | ||
354 | case 1: | 354 | case 1: |
355 | /* left wheel */ | 355 | /* left wheel */ |
356 | input_report_abs(dev->input_dev, KONTROLS4_ABS(36), buf[9] | ((buf[8] & 0x3) << 8)); | 356 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(36), buf[9] | ((buf[8] & 0x3) << 8)); |
357 | /* right wheel */ | 357 | /* right wheel */ |
358 | input_report_abs(dev->input_dev, KONTROLS4_ABS(37), buf[13] | ((buf[12] & 0x3) << 8)); | 358 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(37), buf[13] | ((buf[12] & 0x3) << 8)); |
359 | 359 | ||
360 | /* rotary encoders */ | 360 | /* rotary encoders */ |
361 | input_report_abs(dev->input_dev, KONTROLS4_ABS(38), buf[3] & 0xf); | 361 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(38), buf[3] & 0xf); |
362 | input_report_abs(dev->input_dev, KONTROLS4_ABS(39), buf[4] >> 4); | 362 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(39), buf[4] >> 4); |
363 | input_report_abs(dev->input_dev, KONTROLS4_ABS(40), buf[4] & 0xf); | 363 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(40), buf[4] & 0xf); |
364 | input_report_abs(dev->input_dev, KONTROLS4_ABS(41), buf[5] >> 4); | 364 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(41), buf[5] >> 4); |
365 | input_report_abs(dev->input_dev, KONTROLS4_ABS(42), buf[5] & 0xf); | 365 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(42), buf[5] & 0xf); |
366 | input_report_abs(dev->input_dev, KONTROLS4_ABS(43), buf[6] >> 4); | 366 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(43), buf[6] >> 4); |
367 | input_report_abs(dev->input_dev, KONTROLS4_ABS(44), buf[6] & 0xf); | 367 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(44), buf[6] & 0xf); |
368 | input_report_abs(dev->input_dev, KONTROLS4_ABS(45), buf[7] >> 4); | 368 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(45), buf[7] >> 4); |
369 | input_report_abs(dev->input_dev, KONTROLS4_ABS(46), buf[7] & 0xf); | 369 | input_report_abs(cdev->input_dev, KONTROLS4_ABS(46), buf[7] & 0xf); |
370 | 370 | ||
371 | break; | 371 | break; |
372 | case 2: | 372 | case 2: |
373 | /* Volume Fader Channel D */ | 373 | /* Volume Fader Channel D */ |
374 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(0), buf, 1); | 374 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(0), buf, 1); |
375 | /* Volume Fader Channel B */ | 375 | /* Volume Fader Channel B */ |
376 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(1), buf, 2); | 376 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(1), buf, 2); |
377 | /* Volume Fader Channel A */ | 377 | /* Volume Fader Channel A */ |
378 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(2), buf, 3); | 378 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(2), buf, 3); |
379 | /* Volume Fader Channel C */ | 379 | /* Volume Fader Channel C */ |
380 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(3), buf, 4); | 380 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(3), buf, 4); |
381 | /* Loop Volume */ | 381 | /* Loop Volume */ |
382 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(4), buf, 6); | 382 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(4), buf, 6); |
383 | /* Crossfader */ | 383 | /* Crossfader */ |
384 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(7), buf, 7); | 384 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(7), buf, 7); |
385 | 385 | ||
386 | break; | 386 | break; |
387 | 387 | ||
388 | case 3: | 388 | case 3: |
389 | /* Tempo Fader R */ | 389 | /* Tempo Fader R */ |
390 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(6), buf, 3); | 390 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(6), buf, 3); |
391 | /* Tempo Fader L */ | 391 | /* Tempo Fader L */ |
392 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(5), buf, 4); | 392 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(5), buf, 4); |
393 | /* Mic Volume */ | 393 | /* Mic Volume */ |
394 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(8), buf, 6); | 394 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(8), buf, 6); |
395 | /* Cue Mix */ | 395 | /* Cue Mix */ |
396 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(9), buf, 7); | 396 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(9), buf, 7); |
397 | 397 | ||
398 | break; | 398 | break; |
399 | 399 | ||
400 | case 4: | 400 | case 4: |
401 | /* Wheel distance sensor L */ | 401 | /* Wheel distance sensor L */ |
402 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(10), buf, 1); | 402 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(10), buf, 1); |
403 | /* Wheel distance sensor R */ | 403 | /* Wheel distance sensor R */ |
404 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(11), buf, 2); | 404 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(11), buf, 2); |
405 | /* Channel D EQ - Filter */ | 405 | /* Channel D EQ - Filter */ |
406 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(12), buf, 3); | 406 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(12), buf, 3); |
407 | /* Channel D EQ - Low */ | 407 | /* Channel D EQ - Low */ |
408 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(13), buf, 4); | 408 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(13), buf, 4); |
409 | /* Channel D EQ - Mid */ | 409 | /* Channel D EQ - Mid */ |
410 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(14), buf, 5); | 410 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(14), buf, 5); |
411 | /* Channel D EQ - Hi */ | 411 | /* Channel D EQ - Hi */ |
412 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(15), buf, 6); | 412 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(15), buf, 6); |
413 | /* FX2 - dry/wet */ | 413 | /* FX2 - dry/wet */ |
414 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(16), buf, 7); | 414 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(16), buf, 7); |
415 | 415 | ||
416 | break; | 416 | break; |
417 | 417 | ||
418 | case 5: | 418 | case 5: |
419 | /* FX2 - 1 */ | 419 | /* FX2 - 1 */ |
420 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(17), buf, 1); | 420 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(17), buf, 1); |
421 | /* FX2 - 2 */ | 421 | /* FX2 - 2 */ |
422 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(18), buf, 2); | 422 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(18), buf, 2); |
423 | /* FX2 - 3 */ | 423 | /* FX2 - 3 */ |
424 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(19), buf, 3); | 424 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(19), buf, 3); |
425 | /* Channel B EQ - Filter */ | 425 | /* Channel B EQ - Filter */ |
426 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(20), buf, 4); | 426 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(20), buf, 4); |
427 | /* Channel B EQ - Low */ | 427 | /* Channel B EQ - Low */ |
428 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(21), buf, 5); | 428 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(21), buf, 5); |
429 | /* Channel B EQ - Mid */ | 429 | /* Channel B EQ - Mid */ |
430 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(22), buf, 6); | 430 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(22), buf, 6); |
431 | /* Channel B EQ - Hi */ | 431 | /* Channel B EQ - Hi */ |
432 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(23), buf, 7); | 432 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(23), buf, 7); |
433 | 433 | ||
434 | break; | 434 | break; |
435 | 435 | ||
436 | case 6: | 436 | case 6: |
437 | /* Channel A EQ - Filter */ | 437 | /* Channel A EQ - Filter */ |
438 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(24), buf, 1); | 438 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(24), buf, 1); |
439 | /* Channel A EQ - Low */ | 439 | /* Channel A EQ - Low */ |
440 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(25), buf, 2); | 440 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(25), buf, 2); |
441 | /* Channel A EQ - Mid */ | 441 | /* Channel A EQ - Mid */ |
442 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(26), buf, 3); | 442 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(26), buf, 3); |
443 | /* Channel A EQ - Hi */ | 443 | /* Channel A EQ - Hi */ |
444 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(27), buf, 4); | 444 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(27), buf, 4); |
445 | /* Channel C EQ - Filter */ | 445 | /* Channel C EQ - Filter */ |
446 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(28), buf, 5); | 446 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(28), buf, 5); |
447 | /* Channel C EQ - Low */ | 447 | /* Channel C EQ - Low */ |
448 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(29), buf, 6); | 448 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(29), buf, 6); |
449 | /* Channel C EQ - Mid */ | 449 | /* Channel C EQ - Mid */ |
450 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(30), buf, 7); | 450 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(30), buf, 7); |
451 | 451 | ||
452 | break; | 452 | break; |
453 | 453 | ||
454 | case 7: | 454 | case 7: |
455 | /* Channel C EQ - Hi */ | 455 | /* Channel C EQ - Hi */ |
456 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(31), buf, 1); | 456 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(31), buf, 1); |
457 | /* FX1 - wet/dry */ | 457 | /* FX1 - wet/dry */ |
458 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(32), buf, 2); | 458 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(32), buf, 2); |
459 | /* FX1 - 1 */ | 459 | /* FX1 - 1 */ |
460 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(33), buf, 3); | 460 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(33), buf, 3); |
461 | /* FX1 - 2 */ | 461 | /* FX1 - 2 */ |
462 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(34), buf, 4); | 462 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(34), buf, 4); |
463 | /* FX1 - 3 */ | 463 | /* FX1 - 3 */ |
464 | snd_caiaq_input_report_abs(dev, KONTROLS4_ABS(35), buf, 5); | 464 | snd_caiaq_input_report_abs(cdev, KONTROLS4_ABS(35), buf, 5); |
465 | 465 | ||
466 | break; | 466 | break; |
467 | 467 | ||
@@ -475,12 +475,12 @@ static void snd_usb_caiaq_tks4_dispatch(struct snd_usb_caiaqdev *dev, | |||
475 | buf += TKS4_MSGBLOCK_SIZE; | 475 | buf += TKS4_MSGBLOCK_SIZE; |
476 | } | 476 | } |
477 | 477 | ||
478 | input_sync(dev->input_dev); | 478 | input_sync(cdev->input_dev); |
479 | } | 479 | } |
480 | 480 | ||
481 | #define MASCHINE_MSGBLOCK_SIZE 2 | 481 | #define MASCHINE_MSGBLOCK_SIZE 2 |
482 | 482 | ||
483 | static void snd_usb_caiaq_maschine_dispatch(struct snd_usb_caiaqdev *dev, | 483 | static void snd_usb_caiaq_maschine_dispatch(struct snd_usb_caiaqdev *cdev, |
484 | const unsigned char *buf, | 484 | const unsigned char *buf, |
485 | unsigned int len) | 485 | unsigned int len) |
486 | { | 486 | { |
@@ -491,65 +491,65 @@ static void snd_usb_caiaq_maschine_dispatch(struct snd_usb_caiaqdev *dev, | |||
491 | pressure = be16_to_cpu(buf[i * 2] << 8 | buf[(i * 2) + 1]); | 491 | pressure = be16_to_cpu(buf[i * 2] << 8 | buf[(i * 2) + 1]); |
492 | pad_id = pressure >> 12; | 492 | pad_id = pressure >> 12; |
493 | 493 | ||
494 | input_report_abs(dev->input_dev, MASCHINE_PAD(pad_id), pressure & 0xfff); | 494 | input_report_abs(cdev->input_dev, MASCHINE_PAD(pad_id), pressure & 0xfff); |
495 | } | 495 | } |
496 | 496 | ||
497 | input_sync(dev->input_dev); | 497 | input_sync(cdev->input_dev); |
498 | } | 498 | } |
499 | 499 | ||
500 | static void snd_usb_caiaq_ep4_reply_dispatch(struct urb *urb) | 500 | static void snd_usb_caiaq_ep4_reply_dispatch(struct urb *urb) |
501 | { | 501 | { |
502 | struct snd_usb_caiaqdev *dev = urb->context; | 502 | struct snd_usb_caiaqdev *cdev = urb->context; |
503 | unsigned char *buf = urb->transfer_buffer; | 503 | unsigned char *buf = urb->transfer_buffer; |
504 | int ret; | 504 | int ret; |
505 | 505 | ||
506 | if (urb->status || !dev || urb != dev->ep4_in_urb) | 506 | if (urb->status || !cdev || urb != cdev->ep4_in_urb) |
507 | return; | 507 | return; |
508 | 508 | ||
509 | switch (dev->chip.usb_id) { | 509 | switch (cdev->chip.usb_id) { |
510 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 510 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
511 | if (urb->actual_length < 24) | 511 | if (urb->actual_length < 24) |
512 | goto requeue; | 512 | goto requeue; |
513 | 513 | ||
514 | if (buf[0] & 0x3) | 514 | if (buf[0] & 0x3) |
515 | snd_caiaq_input_read_io(dev, buf + 1, 7); | 515 | snd_caiaq_input_read_io(cdev, buf + 1, 7); |
516 | 516 | ||
517 | if (buf[0] & 0x4) | 517 | if (buf[0] & 0x4) |
518 | snd_caiaq_input_read_analog(dev, buf + 8, 16); | 518 | snd_caiaq_input_read_analog(cdev, buf + 8, 16); |
519 | 519 | ||
520 | break; | 520 | break; |
521 | 521 | ||
522 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): | 522 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): |
523 | snd_usb_caiaq_tks4_dispatch(dev, buf, urb->actual_length); | 523 | snd_usb_caiaq_tks4_dispatch(cdev, buf, urb->actual_length); |
524 | break; | 524 | break; |
525 | 525 | ||
526 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): | 526 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): |
527 | if (urb->actual_length < (MASCHINE_PADS * MASCHINE_MSGBLOCK_SIZE)) | 527 | if (urb->actual_length < (MASCHINE_PADS * MASCHINE_MSGBLOCK_SIZE)) |
528 | goto requeue; | 528 | goto requeue; |
529 | 529 | ||
530 | snd_usb_caiaq_maschine_dispatch(dev, buf, urb->actual_length); | 530 | snd_usb_caiaq_maschine_dispatch(cdev, buf, urb->actual_length); |
531 | break; | 531 | break; |
532 | } | 532 | } |
533 | 533 | ||
534 | requeue: | 534 | requeue: |
535 | dev->ep4_in_urb->actual_length = 0; | 535 | cdev->ep4_in_urb->actual_length = 0; |
536 | ret = usb_submit_urb(dev->ep4_in_urb, GFP_ATOMIC); | 536 | ret = usb_submit_urb(cdev->ep4_in_urb, GFP_ATOMIC); |
537 | if (ret < 0) | 537 | if (ret < 0) |
538 | log("unable to submit urb. OOM!?\n"); | 538 | log("unable to submit urb. OOM!?\n"); |
539 | } | 539 | } |
540 | 540 | ||
541 | static int snd_usb_caiaq_input_open(struct input_dev *idev) | 541 | static int snd_usb_caiaq_input_open(struct input_dev *idev) |
542 | { | 542 | { |
543 | struct snd_usb_caiaqdev *dev = input_get_drvdata(idev); | 543 | struct snd_usb_caiaqdev *cdev = input_get_drvdata(idev); |
544 | 544 | ||
545 | if (!dev) | 545 | if (!cdev) |
546 | return -EINVAL; | 546 | return -EINVAL; |
547 | 547 | ||
548 | switch (dev->chip.usb_id) { | 548 | switch (cdev->chip.usb_id) { |
549 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 549 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
550 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): | 550 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): |
551 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): | 551 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): |
552 | if (usb_submit_urb(dev->ep4_in_urb, GFP_KERNEL) != 0) | 552 | if (usb_submit_urb(cdev->ep4_in_urb, GFP_KERNEL) != 0) |
553 | return -EIO; | 553 | return -EIO; |
554 | break; | 554 | break; |
555 | } | 555 | } |
@@ -559,43 +559,43 @@ static int snd_usb_caiaq_input_open(struct input_dev *idev) | |||
559 | 559 | ||
560 | static void snd_usb_caiaq_input_close(struct input_dev *idev) | 560 | static void snd_usb_caiaq_input_close(struct input_dev *idev) |
561 | { | 561 | { |
562 | struct snd_usb_caiaqdev *dev = input_get_drvdata(idev); | 562 | struct snd_usb_caiaqdev *cdev = input_get_drvdata(idev); |
563 | 563 | ||
564 | if (!dev) | 564 | if (!cdev) |
565 | return; | 565 | return; |
566 | 566 | ||
567 | switch (dev->chip.usb_id) { | 567 | switch (cdev->chip.usb_id) { |
568 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 568 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
569 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): | 569 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): |
570 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): | 570 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER): |
571 | usb_kill_urb(dev->ep4_in_urb); | 571 | usb_kill_urb(cdev->ep4_in_urb); |
572 | break; | 572 | break; |
573 | } | 573 | } |
574 | } | 574 | } |
575 | 575 | ||
576 | void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, | 576 | void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *cdev, |
577 | char *buf, | 577 | char *buf, |
578 | unsigned int len) | 578 | unsigned int len) |
579 | { | 579 | { |
580 | if (!dev->input_dev || len < 1) | 580 | if (!cdev->input_dev || len < 1) |
581 | return; | 581 | return; |
582 | 582 | ||
583 | switch (buf[0]) { | 583 | switch (buf[0]) { |
584 | case EP1_CMD_READ_ANALOG: | 584 | case EP1_CMD_READ_ANALOG: |
585 | snd_caiaq_input_read_analog(dev, buf + 1, len - 1); | 585 | snd_caiaq_input_read_analog(cdev, buf + 1, len - 1); |
586 | break; | 586 | break; |
587 | case EP1_CMD_READ_ERP: | 587 | case EP1_CMD_READ_ERP: |
588 | snd_caiaq_input_read_erp(dev, buf + 1, len - 1); | 588 | snd_caiaq_input_read_erp(cdev, buf + 1, len - 1); |
589 | break; | 589 | break; |
590 | case EP1_CMD_READ_IO: | 590 | case EP1_CMD_READ_IO: |
591 | snd_caiaq_input_read_io(dev, buf + 1, len - 1); | 591 | snd_caiaq_input_read_io(cdev, buf + 1, len - 1); |
592 | break; | 592 | break; |
593 | } | 593 | } |
594 | } | 594 | } |
595 | 595 | ||
596 | int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | 596 | int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev) |
597 | { | 597 | { |
598 | struct usb_device *usb_dev = dev->chip.dev; | 598 | struct usb_device *usb_dev = cdev->chip.dev; |
599 | struct input_dev *input; | 599 | struct input_dev *input; |
600 | int i, ret = 0; | 600 | int i, ret = 0; |
601 | 601 | ||
@@ -603,49 +603,49 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
603 | if (!input) | 603 | if (!input) |
604 | return -ENOMEM; | 604 | return -ENOMEM; |
605 | 605 | ||
606 | usb_make_path(usb_dev, dev->phys, sizeof(dev->phys)); | 606 | usb_make_path(usb_dev, cdev->phys, sizeof(cdev->phys)); |
607 | strlcat(dev->phys, "/input0", sizeof(dev->phys)); | 607 | strlcat(cdev->phys, "/input0", sizeof(cdev->phys)); |
608 | 608 | ||
609 | input->name = dev->product_name; | 609 | input->name = cdev->product_name; |
610 | input->phys = dev->phys; | 610 | input->phys = cdev->phys; |
611 | usb_to_input_id(usb_dev, &input->id); | 611 | usb_to_input_id(usb_dev, &input->id); |
612 | input->dev.parent = &usb_dev->dev; | 612 | input->dev.parent = &usb_dev->dev; |
613 | 613 | ||
614 | input_set_drvdata(input, dev); | 614 | input_set_drvdata(input, cdev); |
615 | 615 | ||
616 | switch (dev->chip.usb_id) { | 616 | switch (cdev->chip.usb_id) { |
617 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): | 617 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL2): |
618 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 618 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
619 | input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | | 619 | input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | |
620 | BIT_MASK(ABS_Z); | 620 | BIT_MASK(ABS_Z); |
621 | BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk2)); | 621 | BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_rk2)); |
622 | memcpy(dev->keycode, keycode_rk2, sizeof(keycode_rk2)); | 622 | memcpy(cdev->keycode, keycode_rk2, sizeof(keycode_rk2)); |
623 | input->keycodemax = ARRAY_SIZE(keycode_rk2); | 623 | input->keycodemax = ARRAY_SIZE(keycode_rk2); |
624 | input_set_abs_params(input, ABS_X, 0, 4096, 0, 10); | 624 | input_set_abs_params(input, ABS_X, 0, 4096, 0, 10); |
625 | input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); | 625 | input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); |
626 | input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); | 626 | input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); |
627 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); | 627 | snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 0); |
628 | break; | 628 | break; |
629 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): | 629 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_RIGKONTROL3): |
630 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 630 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
631 | input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | | 631 | input->absbit[0] = BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | |
632 | BIT_MASK(ABS_Z); | 632 | BIT_MASK(ABS_Z); |
633 | BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_rk3)); | 633 | BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_rk3)); |
634 | memcpy(dev->keycode, keycode_rk3, sizeof(keycode_rk3)); | 634 | memcpy(cdev->keycode, keycode_rk3, sizeof(keycode_rk3)); |
635 | input->keycodemax = ARRAY_SIZE(keycode_rk3); | 635 | input->keycodemax = ARRAY_SIZE(keycode_rk3); |
636 | input_set_abs_params(input, ABS_X, 0, 1024, 0, 10); | 636 | input_set_abs_params(input, ABS_X, 0, 1024, 0, 10); |
637 | input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10); | 637 | input_set_abs_params(input, ABS_Y, 0, 1024, 0, 10); |
638 | input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10); | 638 | input_set_abs_params(input, ABS_Z, 0, 1024, 0, 10); |
639 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 0); | 639 | snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 0); |
640 | break; | 640 | break; |
641 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): | 641 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AK1): |
642 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 642 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
643 | input->absbit[0] = BIT_MASK(ABS_X); | 643 | input->absbit[0] = BIT_MASK(ABS_X); |
644 | BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_ak1)); | 644 | BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_ak1)); |
645 | memcpy(dev->keycode, keycode_ak1, sizeof(keycode_ak1)); | 645 | memcpy(cdev->keycode, keycode_ak1, sizeof(keycode_ak1)); |
646 | input->keycodemax = ARRAY_SIZE(keycode_ak1); | 646 | input->keycodemax = ARRAY_SIZE(keycode_ak1); |
647 | input_set_abs_params(input, ABS_X, 0, 999, 0, 10); | 647 | input_set_abs_params(input, ABS_X, 0, 999, 0, 10); |
648 | snd_usb_caiaq_set_auto_msg(dev, 1, 0, 5); | 648 | snd_usb_caiaq_set_auto_msg(cdev, 1, 0, 5); |
649 | break; | 649 | break; |
650 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): | 650 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER): |
651 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): | 651 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2): |
@@ -657,8 +657,8 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
657 | BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | | 657 | BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | |
658 | BIT_MASK(ABS_Z); | 658 | BIT_MASK(ABS_Z); |
659 | input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); | 659 | input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); |
660 | BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_kore)); | 660 | BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_kore)); |
661 | memcpy(dev->keycode, keycode_kore, sizeof(keycode_kore)); | 661 | memcpy(cdev->keycode, keycode_kore, sizeof(keycode_kore)); |
662 | input->keycodemax = ARRAY_SIZE(keycode_kore); | 662 | input->keycodemax = ARRAY_SIZE(keycode_kore); |
663 | input_set_abs_params(input, ABS_HAT0X, 0, 999, 0, 10); | 663 | input_set_abs_params(input, ABS_HAT0X, 0, 999, 0, 10); |
664 | input_set_abs_params(input, ABS_HAT0Y, 0, 999, 0, 10); | 664 | input_set_abs_params(input, ABS_HAT0Y, 0, 999, 0, 10); |
@@ -672,7 +672,7 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
672 | input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); | 672 | input_set_abs_params(input, ABS_Y, 0, 4096, 0, 10); |
673 | input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); | 673 | input_set_abs_params(input, ABS_Z, 0, 4096, 0, 10); |
674 | input_set_abs_params(input, ABS_MISC, 0, 255, 0, 1); | 674 | input_set_abs_params(input, ABS_MISC, 0, 255, 0, 1); |
675 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5); | 675 | snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); |
676 | break; | 676 | break; |
677 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): | 677 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1): |
678 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 678 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
@@ -683,9 +683,9 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
683 | BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | | 683 | BIT_MASK(ABS_X) | BIT_MASK(ABS_Y) | |
684 | BIT_MASK(ABS_Z); | 684 | BIT_MASK(ABS_Z); |
685 | input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); | 685 | input->absbit[BIT_WORD(ABS_MISC)] |= BIT_MASK(ABS_MISC); |
686 | BUILD_BUG_ON(sizeof(dev->keycode) < KONTROLX1_INPUTS); | 686 | BUILD_BUG_ON(sizeof(cdev->keycode) < KONTROLX1_INPUTS); |
687 | for (i = 0; i < KONTROLX1_INPUTS; i++) | 687 | for (i = 0; i < KONTROLX1_INPUTS; i++) |
688 | dev->keycode[i] = BTN_MISC + i; | 688 | cdev->keycode[i] = BTN_MISC + i; |
689 | input->keycodemax = KONTROLX1_INPUTS; | 689 | input->keycodemax = KONTROLX1_INPUTS; |
690 | 690 | ||
691 | /* analog potentiometers */ | 691 | /* analog potentiometers */ |
@@ -704,26 +704,26 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
704 | input_set_abs_params(input, ABS_Z, 0, 0xf, 0, 1); | 704 | input_set_abs_params(input, ABS_Z, 0, 0xf, 0, 1); |
705 | input_set_abs_params(input, ABS_MISC, 0, 0xf, 0, 1); | 705 | input_set_abs_params(input, ABS_MISC, 0, 0xf, 0, 1); |
706 | 706 | ||
707 | dev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); | 707 | cdev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); |
708 | if (!dev->ep4_in_urb) { | 708 | if (!cdev->ep4_in_urb) { |
709 | ret = -ENOMEM; | 709 | ret = -ENOMEM; |
710 | goto exit_free_idev; | 710 | goto exit_free_idev; |
711 | } | 711 | } |
712 | 712 | ||
713 | usb_fill_bulk_urb(dev->ep4_in_urb, usb_dev, | 713 | usb_fill_bulk_urb(cdev->ep4_in_urb, usb_dev, |
714 | usb_rcvbulkpipe(usb_dev, 0x4), | 714 | usb_rcvbulkpipe(usb_dev, 0x4), |
715 | dev->ep4_in_buf, EP4_BUFSIZE, | 715 | cdev->ep4_in_buf, EP4_BUFSIZE, |
716 | snd_usb_caiaq_ep4_reply_dispatch, dev); | 716 | snd_usb_caiaq_ep4_reply_dispatch, cdev); |
717 | 717 | ||
718 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5); | 718 | snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); |
719 | 719 | ||
720 | break; | 720 | break; |
721 | 721 | ||
722 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): | 722 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLS4): |
723 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 723 | input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
724 | BUILD_BUG_ON(sizeof(dev->keycode) < KONTROLS4_BUTTONS); | 724 | BUILD_BUG_ON(sizeof(cdev->keycode) < KONTROLS4_BUTTONS); |
725 | for (i = 0; i < KONTROLS4_BUTTONS; i++) | 725 | for (i = 0; i < KONTROLS4_BUTTONS; i++) |
726 | dev->keycode[i] = KONTROLS4_BUTTON(i); | 726 | cdev->keycode[i] = KONTROLS4_BUTTON(i); |
727 | input->keycodemax = KONTROLS4_BUTTONS; | 727 | input->keycodemax = KONTROLS4_BUTTONS; |
728 | 728 | ||
729 | for (i = 0; i < KONTROLS4_AXIS; i++) { | 729 | for (i = 0; i < KONTROLS4_AXIS; i++) { |
@@ -743,18 +743,18 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
743 | for (i = 0; i < 9; i++) | 743 | for (i = 0; i < 9; i++) |
744 | input_set_abs_params(input, KONTROLS4_ABS(38+i), 0, 0xf, 0, 1); | 744 | input_set_abs_params(input, KONTROLS4_ABS(38+i), 0, 0xf, 0, 1); |
745 | 745 | ||
746 | dev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); | 746 | cdev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); |
747 | if (!dev->ep4_in_urb) { | 747 | if (!cdev->ep4_in_urb) { |
748 | ret = -ENOMEM; | 748 | ret = -ENOMEM; |
749 | goto exit_free_idev; | 749 | goto exit_free_idev; |
750 | } | 750 | } |
751 | 751 | ||
752 | usb_fill_bulk_urb(dev->ep4_in_urb, usb_dev, | 752 | usb_fill_bulk_urb(cdev->ep4_in_urb, usb_dev, |
753 | usb_rcvbulkpipe(usb_dev, 0x4), | 753 | usb_rcvbulkpipe(usb_dev, 0x4), |
754 | dev->ep4_in_buf, EP4_BUFSIZE, | 754 | cdev->ep4_in_buf, EP4_BUFSIZE, |
755 | snd_usb_caiaq_ep4_reply_dispatch, dev); | 755 | snd_usb_caiaq_ep4_reply_dispatch, cdev); |
756 | 756 | ||
757 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5); | 757 | snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); |
758 | 758 | ||
759 | break; | 759 | break; |
760 | 760 | ||
@@ -767,8 +767,8 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
767 | BIT_MASK(ABS_RX) | BIT_MASK(ABS_RY) | | 767 | BIT_MASK(ABS_RX) | BIT_MASK(ABS_RY) | |
768 | BIT_MASK(ABS_RZ); | 768 | BIT_MASK(ABS_RZ); |
769 | 769 | ||
770 | BUILD_BUG_ON(sizeof(dev->keycode) < sizeof(keycode_maschine)); | 770 | BUILD_BUG_ON(sizeof(cdev->keycode) < sizeof(keycode_maschine)); |
771 | memcpy(dev->keycode, keycode_maschine, sizeof(keycode_maschine)); | 771 | memcpy(cdev->keycode, keycode_maschine, sizeof(keycode_maschine)); |
772 | input->keycodemax = ARRAY_SIZE(keycode_maschine); | 772 | input->keycodemax = ARRAY_SIZE(keycode_maschine); |
773 | 773 | ||
774 | for (i = 0; i < MASCHINE_PADS; i++) { | 774 | for (i = 0; i < MASCHINE_PADS; i++) { |
@@ -788,18 +788,18 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
788 | input_set_abs_params(input, ABS_RY, 0, 999, 0, 10); | 788 | input_set_abs_params(input, ABS_RY, 0, 999, 0, 10); |
789 | input_set_abs_params(input, ABS_RZ, 0, 999, 0, 10); | 789 | input_set_abs_params(input, ABS_RZ, 0, 999, 0, 10); |
790 | 790 | ||
791 | dev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); | 791 | cdev->ep4_in_urb = usb_alloc_urb(0, GFP_KERNEL); |
792 | if (!dev->ep4_in_urb) { | 792 | if (!cdev->ep4_in_urb) { |
793 | ret = -ENOMEM; | 793 | ret = -ENOMEM; |
794 | goto exit_free_idev; | 794 | goto exit_free_idev; |
795 | } | 795 | } |
796 | 796 | ||
797 | usb_fill_bulk_urb(dev->ep4_in_urb, usb_dev, | 797 | usb_fill_bulk_urb(cdev->ep4_in_urb, usb_dev, |
798 | usb_rcvbulkpipe(usb_dev, 0x4), | 798 | usb_rcvbulkpipe(usb_dev, 0x4), |
799 | dev->ep4_in_buf, EP4_BUFSIZE, | 799 | cdev->ep4_in_buf, EP4_BUFSIZE, |
800 | snd_usb_caiaq_ep4_reply_dispatch, dev); | 800 | snd_usb_caiaq_ep4_reply_dispatch, cdev); |
801 | 801 | ||
802 | snd_usb_caiaq_set_auto_msg(dev, 1, 10, 5); | 802 | snd_usb_caiaq_set_auto_msg(cdev, 1, 10, 5); |
803 | break; | 803 | break; |
804 | 804 | ||
805 | default: | 805 | default: |
@@ -809,12 +809,12 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
809 | 809 | ||
810 | input->open = snd_usb_caiaq_input_open; | 810 | input->open = snd_usb_caiaq_input_open; |
811 | input->close = snd_usb_caiaq_input_close; | 811 | input->close = snd_usb_caiaq_input_close; |
812 | input->keycode = dev->keycode; | 812 | input->keycode = cdev->keycode; |
813 | input->keycodesize = sizeof(unsigned short); | 813 | input->keycodesize = sizeof(unsigned short); |
814 | for (i = 0; i < input->keycodemax; i++) | 814 | for (i = 0; i < input->keycodemax; i++) |
815 | __set_bit(dev->keycode[i], input->keybit); | 815 | __set_bit(cdev->keycode[i], input->keybit); |
816 | 816 | ||
817 | dev->input_dev = input; | 817 | cdev->input_dev = input; |
818 | 818 | ||
819 | ret = input_register_device(input); | 819 | ret = input_register_device(input); |
820 | if (ret < 0) | 820 | if (ret < 0) |
@@ -824,19 +824,19 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev) | |||
824 | 824 | ||
825 | exit_free_idev: | 825 | exit_free_idev: |
826 | input_free_device(input); | 826 | input_free_device(input); |
827 | dev->input_dev = NULL; | 827 | cdev->input_dev = NULL; |
828 | return ret; | 828 | return ret; |
829 | } | 829 | } |
830 | 830 | ||
831 | void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev) | 831 | void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *cdev) |
832 | { | 832 | { |
833 | if (!dev || !dev->input_dev) | 833 | if (!cdev || !cdev->input_dev) |
834 | return; | 834 | return; |
835 | 835 | ||
836 | usb_kill_urb(dev->ep4_in_urb); | 836 | usb_kill_urb(cdev->ep4_in_urb); |
837 | usb_free_urb(dev->ep4_in_urb); | 837 | usb_free_urb(cdev->ep4_in_urb); |
838 | dev->ep4_in_urb = NULL; | 838 | cdev->ep4_in_urb = NULL; |
839 | 839 | ||
840 | input_unregister_device(dev->input_dev); | 840 | input_unregister_device(cdev->input_dev); |
841 | dev->input_dev = NULL; | 841 | cdev->input_dev = NULL; |
842 | } | 842 | } |
diff --git a/sound/usb/caiaq/input.h b/sound/usb/caiaq/input.h index ced535577864..6014e2713a60 100644 --- a/sound/usb/caiaq/input.h +++ b/sound/usb/caiaq/input.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef CAIAQ_INPUT_H | 1 | #ifndef CAIAQ_INPUT_H |
2 | #define CAIAQ_INPUT_H | 2 | #define CAIAQ_INPUT_H |
3 | 3 | ||
4 | void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *dev, char *buf, unsigned int len); | 4 | void snd_usb_caiaq_input_dispatch(struct snd_usb_caiaqdev *cdev, char *buf, unsigned int len); |
5 | int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *dev); | 5 | int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev); |
6 | void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *dev); | 6 | void snd_usb_caiaq_input_free(struct snd_usb_caiaqdev *cdev); |
7 | 7 | ||
8 | #endif | 8 | #endif |
diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c index a1a47088fd0c..63c5a2caa0ad 100644 --- a/sound/usb/caiaq/midi.c +++ b/sound/usb/caiaq/midi.c | |||
@@ -37,12 +37,12 @@ static int snd_usb_caiaq_midi_input_close(struct snd_rawmidi_substream *substrea | |||
37 | 37 | ||
38 | static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) | 38 | static void snd_usb_caiaq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) |
39 | { | 39 | { |
40 | struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; | 40 | struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data; |
41 | 41 | ||
42 | if (!dev) | 42 | if (!cdev) |
43 | return; | 43 | return; |
44 | 44 | ||
45 | dev->midi_receive_substream = up ? substream : NULL; | 45 | cdev->midi_receive_substream = up ? substream : NULL; |
46 | } | 46 | } |
47 | 47 | ||
48 | 48 | ||
@@ -53,49 +53,49 @@ static int snd_usb_caiaq_midi_output_open(struct snd_rawmidi_substream *substrea | |||
53 | 53 | ||
54 | static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) | 54 | static int snd_usb_caiaq_midi_output_close(struct snd_rawmidi_substream *substream) |
55 | { | 55 | { |
56 | struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; | 56 | struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data; |
57 | if (dev->midi_out_active) { | 57 | if (cdev->midi_out_active) { |
58 | usb_kill_urb(&dev->midi_out_urb); | 58 | usb_kill_urb(&cdev->midi_out_urb); |
59 | dev->midi_out_active = 0; | 59 | cdev->midi_out_active = 0; |
60 | } | 60 | } |
61 | return 0; | 61 | return 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *dev, | 64 | static void snd_usb_caiaq_midi_send(struct snd_usb_caiaqdev *cdev, |
65 | struct snd_rawmidi_substream *substream) | 65 | struct snd_rawmidi_substream *substream) |
66 | { | 66 | { |
67 | int len, ret; | 67 | int len, ret; |
68 | 68 | ||
69 | dev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; | 69 | cdev->midi_out_buf[0] = EP1_CMD_MIDI_WRITE; |
70 | dev->midi_out_buf[1] = 0; /* port */ | 70 | cdev->midi_out_buf[1] = 0; /* port */ |
71 | len = snd_rawmidi_transmit(substream, dev->midi_out_buf + 3, | 71 | len = snd_rawmidi_transmit(substream, cdev->midi_out_buf + 3, |
72 | EP1_BUFSIZE - 3); | 72 | EP1_BUFSIZE - 3); |
73 | 73 | ||
74 | if (len <= 0) | 74 | if (len <= 0) |
75 | return; | 75 | return; |
76 | 76 | ||
77 | dev->midi_out_buf[2] = len; | 77 | cdev->midi_out_buf[2] = len; |
78 | dev->midi_out_urb.transfer_buffer_length = len+3; | 78 | cdev->midi_out_urb.transfer_buffer_length = len+3; |
79 | 79 | ||
80 | ret = usb_submit_urb(&dev->midi_out_urb, GFP_ATOMIC); | 80 | ret = usb_submit_urb(&cdev->midi_out_urb, GFP_ATOMIC); |
81 | if (ret < 0) | 81 | if (ret < 0) |
82 | log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," | 82 | log("snd_usb_caiaq_midi_send(%p): usb_submit_urb() failed," |
83 | "ret=%d, len=%d\n", | 83 | "ret=%d, len=%d\n", |
84 | substream, ret, len); | 84 | substream, ret, len); |
85 | else | 85 | else |
86 | dev->midi_out_active = 1; | 86 | cdev->midi_out_active = 1; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) | 89 | static void snd_usb_caiaq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) |
90 | { | 90 | { |
91 | struct snd_usb_caiaqdev *dev = substream->rmidi->private_data; | 91 | struct snd_usb_caiaqdev *cdev = substream->rmidi->private_data; |
92 | 92 | ||
93 | if (up) { | 93 | if (up) { |
94 | dev->midi_out_substream = substream; | 94 | cdev->midi_out_substream = substream; |
95 | if (!dev->midi_out_active) | 95 | if (!cdev->midi_out_active) |
96 | snd_usb_caiaq_midi_send(dev, substream); | 96 | snd_usb_caiaq_midi_send(cdev, substream); |
97 | } else { | 97 | } else { |
98 | dev->midi_out_substream = NULL; | 98 | cdev->midi_out_substream = NULL; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
@@ -114,13 +114,13 @@ static struct snd_rawmidi_ops snd_usb_caiaq_midi_input = | |||
114 | .trigger = snd_usb_caiaq_midi_input_trigger, | 114 | .trigger = snd_usb_caiaq_midi_input_trigger, |
115 | }; | 115 | }; |
116 | 116 | ||
117 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, | 117 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *cdev, |
118 | int port, const char *buf, int len) | 118 | int port, const char *buf, int len) |
119 | { | 119 | { |
120 | if (!dev->midi_receive_substream) | 120 | if (!cdev->midi_receive_substream) |
121 | return; | 121 | return; |
122 | 122 | ||
123 | snd_rawmidi_receive(dev->midi_receive_substream, buf, len); | 123 | snd_rawmidi_receive(cdev->midi_receive_substream, buf, len); |
124 | } | 124 | } |
125 | 125 | ||
126 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) | 126 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) |
@@ -160,15 +160,15 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) | |||
160 | 160 | ||
161 | void snd_usb_caiaq_midi_output_done(struct urb* urb) | 161 | void snd_usb_caiaq_midi_output_done(struct urb* urb) |
162 | { | 162 | { |
163 | struct snd_usb_caiaqdev *dev = urb->context; | 163 | struct snd_usb_caiaqdev *cdev = urb->context; |
164 | 164 | ||
165 | dev->midi_out_active = 0; | 165 | cdev->midi_out_active = 0; |
166 | if (urb->status != 0) | 166 | if (urb->status != 0) |
167 | return; | 167 | return; |
168 | 168 | ||
169 | if (!dev->midi_out_substream) | 169 | if (!cdev->midi_out_substream) |
170 | return; | 170 | return; |
171 | 171 | ||
172 | snd_usb_caiaq_midi_send(dev, dev->midi_out_substream); | 172 | snd_usb_caiaq_midi_send(cdev, cdev->midi_out_substream); |
173 | } | 173 | } |
174 | 174 | ||
diff --git a/sound/usb/caiaq/midi.h b/sound/usb/caiaq/midi.h index 380f984babc9..60bf3442b283 100644 --- a/sound/usb/caiaq/midi.h +++ b/sound/usb/caiaq/midi.h | |||
@@ -1,8 +1,9 @@ | |||
1 | #ifndef CAIAQ_MIDI_H | 1 | #ifndef CAIAQ_MIDI_H |
2 | #define CAIAQ_MIDI_H | 2 | #define CAIAQ_MIDI_H |
3 | 3 | ||
4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *dev); | 4 | int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *cdev); |
5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *dev, int port, const char *buf, int len); | 5 | void snd_usb_caiaq_midi_handle_input(struct snd_usb_caiaqdev *cdev, |
6 | int port, const char *buf, int len); | ||
6 | void snd_usb_caiaq_midi_output_done(struct urb *urb); | 7 | void snd_usb_caiaq_midi_output_done(struct urb *urb); |
7 | 8 | ||
8 | #endif /* CAIAQ_MIDI_H */ | 9 | #endif /* CAIAQ_MIDI_H */ |