| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * US-X2Y AUDIO |
|---|
| 3 | 4 | * Copyright (c) 2002-2004 by Karsten Wiese |
|---|
| .. | .. |
|---|
| 13 | 14 | * Many codes borrowed from audio.c by |
|---|
| 14 | 15 | * Alan Cox (alan@lxorguk.ukuu.org.uk) |
|---|
| 15 | 16 | * Thomas Sailer (sailer@ife.ee.ethz.ch) |
|---|
| 16 | | - * |
|---|
| 17 | | - * |
|---|
| 18 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 19 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 20 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 21 | | - * (at your option) any later version. |
|---|
| 22 | | - * |
|---|
| 23 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 24 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 25 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 26 | | - * GNU General Public License for more details. |
|---|
| 27 | | - * |
|---|
| 28 | | - * You should have received a copy of the GNU General Public License |
|---|
| 29 | | - * along with this program; if not, write to the Free Software |
|---|
| 30 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 31 | 17 | */ |
|---|
| 32 | 18 | |
|---|
| 33 | 19 | |
|---|
| .. | .. |
|---|
| 68 | 54 | #endif |
|---|
| 69 | 55 | |
|---|
| 70 | 56 | |
|---|
| 71 | | -static int usX2Y_urb_capt_retire(struct snd_usX2Y_substream *subs) |
|---|
| 57 | +static int usx2y_urb_capt_retire(struct snd_usx2y_substream *subs) |
|---|
| 72 | 58 | { |
|---|
| 73 | 59 | struct urb *urb = subs->completed_urb; |
|---|
| 74 | 60 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; |
|---|
| 75 | 61 | unsigned char *cp; |
|---|
| 76 | 62 | int i, len, lens = 0, hwptr_done = subs->hwptr_done; |
|---|
| 77 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 63 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 78 | 64 | |
|---|
| 79 | 65 | for (i = 0; i < nr_of_packs(); i++) { |
|---|
| 80 | 66 | cp = (unsigned char*)urb->transfer_buffer + urb->iso_frame_desc[i].offset; |
|---|
| .. | .. |
|---|
| 84 | 70 | urb->iso_frame_desc[i].status); |
|---|
| 85 | 71 | return urb->iso_frame_desc[i].status; |
|---|
| 86 | 72 | } |
|---|
| 87 | | - len = urb->iso_frame_desc[i].actual_length / usX2Y->stride; |
|---|
| 73 | + len = urb->iso_frame_desc[i].actual_length / usx2y->stride; |
|---|
| 88 | 74 | if (! len) { |
|---|
| 89 | 75 | snd_printd("0 == len ERROR!\n"); |
|---|
| 90 | 76 | continue; |
|---|
| .. | .. |
|---|
| 93 | 79 | /* copy a data chunk */ |
|---|
| 94 | 80 | if ((hwptr_done + len) > runtime->buffer_size) { |
|---|
| 95 | 81 | int cnt = runtime->buffer_size - hwptr_done; |
|---|
| 96 | | - int blen = cnt * usX2Y->stride; |
|---|
| 97 | | - memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, blen); |
|---|
| 98 | | - memcpy(runtime->dma_area, cp + blen, len * usX2Y->stride - blen); |
|---|
| 82 | + int blen = cnt * usx2y->stride; |
|---|
| 83 | + memcpy(runtime->dma_area + hwptr_done * usx2y->stride, cp, blen); |
|---|
| 84 | + memcpy(runtime->dma_area, cp + blen, len * usx2y->stride - blen); |
|---|
| 99 | 85 | } else { |
|---|
| 100 | | - memcpy(runtime->dma_area + hwptr_done * usX2Y->stride, cp, |
|---|
| 101 | | - len * usX2Y->stride); |
|---|
| 86 | + memcpy(runtime->dma_area + hwptr_done * usx2y->stride, cp, |
|---|
| 87 | + len * usx2y->stride); |
|---|
| 102 | 88 | } |
|---|
| 103 | 89 | lens += len; |
|---|
| 104 | 90 | if ((hwptr_done += len) >= runtime->buffer_size) |
|---|
| .. | .. |
|---|
| 124 | 110 | * it directly from the buffer. thus the data is once copied to |
|---|
| 125 | 111 | * a temporary buffer and urb points to that. |
|---|
| 126 | 112 | */ |
|---|
| 127 | | -static int usX2Y_urb_play_prepare(struct snd_usX2Y_substream *subs, |
|---|
| 113 | +static int usx2y_urb_play_prepare(struct snd_usx2y_substream *subs, |
|---|
| 128 | 114 | struct urb *cap_urb, |
|---|
| 129 | 115 | struct urb *urb) |
|---|
| 130 | 116 | { |
|---|
| 131 | 117 | int count, counts, pack; |
|---|
| 132 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 118 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 133 | 119 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; |
|---|
| 134 | 120 | |
|---|
| 135 | 121 | count = 0; |
|---|
| 136 | 122 | for (pack = 0; pack < nr_of_packs(); pack++) { |
|---|
| 137 | 123 | /* calculate the size of a packet */ |
|---|
| 138 | | - counts = cap_urb->iso_frame_desc[pack].actual_length / usX2Y->stride; |
|---|
| 124 | + counts = cap_urb->iso_frame_desc[pack].actual_length / usx2y->stride; |
|---|
| 139 | 125 | count += counts; |
|---|
| 140 | 126 | if (counts < 43 || counts > 50) { |
|---|
| 141 | 127 | snd_printk(KERN_ERR "should not be here with counts=%i\n", counts); |
|---|
| .. | .. |
|---|
| 148 | 134 | 0; |
|---|
| 149 | 135 | urb->iso_frame_desc[pack].length = cap_urb->iso_frame_desc[pack].actual_length; |
|---|
| 150 | 136 | } |
|---|
| 151 | | - if (atomic_read(&subs->state) >= state_PRERUNNING) |
|---|
| 137 | + if (atomic_read(&subs->state) >= STATE_PRERUNNING) |
|---|
| 152 | 138 | if (subs->hwptr + count > runtime->buffer_size) { |
|---|
| 153 | 139 | /* err, the transferred area goes over buffer boundary. |
|---|
| 154 | 140 | * copy the data to the temp buffer. |
|---|
| .. | .. |
|---|
| 157 | 143 | len = runtime->buffer_size - subs->hwptr; |
|---|
| 158 | 144 | urb->transfer_buffer = subs->tmpbuf; |
|---|
| 159 | 145 | memcpy(subs->tmpbuf, runtime->dma_area + |
|---|
| 160 | | - subs->hwptr * usX2Y->stride, len * usX2Y->stride); |
|---|
| 161 | | - memcpy(subs->tmpbuf + len * usX2Y->stride, |
|---|
| 162 | | - runtime->dma_area, (count - len) * usX2Y->stride); |
|---|
| 146 | + subs->hwptr * usx2y->stride, len * usx2y->stride); |
|---|
| 147 | + memcpy(subs->tmpbuf + len * usx2y->stride, |
|---|
| 148 | + runtime->dma_area, (count - len) * usx2y->stride); |
|---|
| 163 | 149 | subs->hwptr += count; |
|---|
| 164 | 150 | subs->hwptr -= runtime->buffer_size; |
|---|
| 165 | 151 | } else { |
|---|
| 166 | 152 | /* set the buffer pointer */ |
|---|
| 167 | | - urb->transfer_buffer = runtime->dma_area + subs->hwptr * usX2Y->stride; |
|---|
| 153 | + urb->transfer_buffer = runtime->dma_area + subs->hwptr * usx2y->stride; |
|---|
| 168 | 154 | if ((subs->hwptr += count) >= runtime->buffer_size) |
|---|
| 169 | 155 | subs->hwptr -= runtime->buffer_size; |
|---|
| 170 | 156 | } |
|---|
| 171 | 157 | else |
|---|
| 172 | 158 | urb->transfer_buffer = subs->tmpbuf; |
|---|
| 173 | | - urb->transfer_buffer_length = count * usX2Y->stride; |
|---|
| 159 | + urb->transfer_buffer_length = count * usx2y->stride; |
|---|
| 174 | 160 | return 0; |
|---|
| 175 | 161 | } |
|---|
| 176 | 162 | |
|---|
| .. | .. |
|---|
| 179 | 165 | * |
|---|
| 180 | 166 | * update the current position and call callback if a period is processed. |
|---|
| 181 | 167 | */ |
|---|
| 182 | | -static void usX2Y_urb_play_retire(struct snd_usX2Y_substream *subs, struct urb *urb) |
|---|
| 168 | +static void usx2y_urb_play_retire(struct snd_usx2y_substream *subs, struct urb *urb) |
|---|
| 183 | 169 | { |
|---|
| 184 | 170 | struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime; |
|---|
| 185 | | - int len = urb->actual_length / subs->usX2Y->stride; |
|---|
| 171 | + int len = urb->actual_length / subs->usx2y->stride; |
|---|
| 186 | 172 | |
|---|
| 187 | 173 | subs->transfer_done += len; |
|---|
| 188 | 174 | subs->hwptr_done += len; |
|---|
| .. | .. |
|---|
| 194 | 180 | } |
|---|
| 195 | 181 | } |
|---|
| 196 | 182 | |
|---|
| 197 | | -static int usX2Y_urb_submit(struct snd_usX2Y_substream *subs, struct urb *urb, int frame) |
|---|
| 183 | +static int usx2y_urb_submit(struct snd_usx2y_substream *subs, struct urb *urb, int frame) |
|---|
| 198 | 184 | { |
|---|
| 199 | 185 | int err; |
|---|
| 200 | 186 | if (!urb) |
|---|
| 201 | 187 | return -ENODEV; |
|---|
| 202 | 188 | urb->start_frame = (frame + NRURBS * nr_of_packs()); // let hcd do rollover sanity checks |
|---|
| 203 | 189 | urb->hcpriv = NULL; |
|---|
| 204 | | - urb->dev = subs->usX2Y->dev; /* we need to set this at each time */ |
|---|
| 190 | + urb->dev = subs->usx2y->dev; /* we need to set this at each time */ |
|---|
| 205 | 191 | if ((err = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { |
|---|
| 206 | 192 | snd_printk(KERN_ERR "usb_submit_urb() returned %i\n", err); |
|---|
| 207 | 193 | return err; |
|---|
| .. | .. |
|---|
| 209 | 195 | return 0; |
|---|
| 210 | 196 | } |
|---|
| 211 | 197 | |
|---|
| 212 | | -static inline int usX2Y_usbframe_complete(struct snd_usX2Y_substream *capsubs, |
|---|
| 213 | | - struct snd_usX2Y_substream *playbacksubs, |
|---|
| 198 | +static inline int usx2y_usbframe_complete(struct snd_usx2y_substream *capsubs, |
|---|
| 199 | + struct snd_usx2y_substream *playbacksubs, |
|---|
| 214 | 200 | int frame) |
|---|
| 215 | 201 | { |
|---|
| 216 | 202 | int err, state; |
|---|
| .. | .. |
|---|
| 218 | 204 | |
|---|
| 219 | 205 | state = atomic_read(&playbacksubs->state); |
|---|
| 220 | 206 | if (NULL != urb) { |
|---|
| 221 | | - if (state == state_RUNNING) |
|---|
| 222 | | - usX2Y_urb_play_retire(playbacksubs, urb); |
|---|
| 223 | | - else if (state >= state_PRERUNNING) |
|---|
| 207 | + if (state == STATE_RUNNING) |
|---|
| 208 | + usx2y_urb_play_retire(playbacksubs, urb); |
|---|
| 209 | + else if (state >= STATE_PRERUNNING) |
|---|
| 224 | 210 | atomic_inc(&playbacksubs->state); |
|---|
| 225 | 211 | } else { |
|---|
| 226 | 212 | switch (state) { |
|---|
| 227 | | - case state_STARTING1: |
|---|
| 213 | + case STATE_STARTING1: |
|---|
| 228 | 214 | urb = playbacksubs->urb[0]; |
|---|
| 229 | 215 | atomic_inc(&playbacksubs->state); |
|---|
| 230 | 216 | break; |
|---|
| 231 | | - case state_STARTING2: |
|---|
| 217 | + case STATE_STARTING2: |
|---|
| 232 | 218 | urb = playbacksubs->urb[1]; |
|---|
| 233 | 219 | atomic_inc(&playbacksubs->state); |
|---|
| 234 | 220 | break; |
|---|
| 235 | 221 | } |
|---|
| 236 | 222 | } |
|---|
| 237 | 223 | if (urb) { |
|---|
| 238 | | - if ((err = usX2Y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || |
|---|
| 239 | | - (err = usX2Y_urb_submit(playbacksubs, urb, frame))) { |
|---|
| 224 | + if ((err = usx2y_urb_play_prepare(playbacksubs, capsubs->completed_urb, urb)) || |
|---|
| 225 | + (err = usx2y_urb_submit(playbacksubs, urb, frame))) { |
|---|
| 240 | 226 | return err; |
|---|
| 241 | 227 | } |
|---|
| 242 | 228 | } |
|---|
| .. | .. |
|---|
| 244 | 230 | playbacksubs->completed_urb = NULL; |
|---|
| 245 | 231 | |
|---|
| 246 | 232 | state = atomic_read(&capsubs->state); |
|---|
| 247 | | - if (state >= state_PREPARED) { |
|---|
| 248 | | - if (state == state_RUNNING) { |
|---|
| 249 | | - if ((err = usX2Y_urb_capt_retire(capsubs))) |
|---|
| 233 | + if (state >= STATE_PREPARED) { |
|---|
| 234 | + if (state == STATE_RUNNING) { |
|---|
| 235 | + if ((err = usx2y_urb_capt_retire(capsubs))) |
|---|
| 250 | 236 | return err; |
|---|
| 251 | | - } else if (state >= state_PRERUNNING) |
|---|
| 237 | + } else if (state >= STATE_PRERUNNING) |
|---|
| 252 | 238 | atomic_inc(&capsubs->state); |
|---|
| 253 | | - if ((err = usX2Y_urb_submit(capsubs, capsubs->completed_urb, frame))) |
|---|
| 239 | + if ((err = usx2y_urb_submit(capsubs, capsubs->completed_urb, frame))) |
|---|
| 254 | 240 | return err; |
|---|
| 255 | 241 | } |
|---|
| 256 | 242 | capsubs->completed_urb = NULL; |
|---|
| .. | .. |
|---|
| 258 | 244 | } |
|---|
| 259 | 245 | |
|---|
| 260 | 246 | |
|---|
| 261 | | -static void usX2Y_clients_stop(struct usX2Ydev *usX2Y) |
|---|
| 247 | +static void usx2y_clients_stop(struct usx2ydev *usx2y) |
|---|
| 262 | 248 | { |
|---|
| 263 | 249 | int s, u; |
|---|
| 264 | 250 | |
|---|
| 265 | 251 | for (s = 0; s < 4; s++) { |
|---|
| 266 | | - struct snd_usX2Y_substream *subs = usX2Y->subs[s]; |
|---|
| 252 | + struct snd_usx2y_substream *subs = usx2y->subs[s]; |
|---|
| 267 | 253 | if (subs) { |
|---|
| 268 | 254 | snd_printdd("%i %p state=%i\n", s, subs, atomic_read(&subs->state)); |
|---|
| 269 | | - atomic_set(&subs->state, state_STOPPED); |
|---|
| 255 | + atomic_set(&subs->state, STATE_STOPPED); |
|---|
| 270 | 256 | } |
|---|
| 271 | 257 | } |
|---|
| 272 | 258 | for (s = 0; s < 4; s++) { |
|---|
| 273 | | - struct snd_usX2Y_substream *subs = usX2Y->subs[s]; |
|---|
| 259 | + struct snd_usx2y_substream *subs = usx2y->subs[s]; |
|---|
| 274 | 260 | if (subs) { |
|---|
| 275 | | - if (atomic_read(&subs->state) >= state_PRERUNNING) |
|---|
| 261 | + if (atomic_read(&subs->state) >= STATE_PRERUNNING) |
|---|
| 276 | 262 | snd_pcm_stop_xrun(subs->pcm_substream); |
|---|
| 277 | 263 | for (u = 0; u < NRURBS; u++) { |
|---|
| 278 | 264 | struct urb *urb = subs->urb[u]; |
|---|
| .. | .. |
|---|
| 282 | 268 | } |
|---|
| 283 | 269 | } |
|---|
| 284 | 270 | } |
|---|
| 285 | | - usX2Y->prepare_subs = NULL; |
|---|
| 286 | | - wake_up(&usX2Y->prepare_wait_queue); |
|---|
| 271 | + usx2y->prepare_subs = NULL; |
|---|
| 272 | + wake_up(&usx2y->prepare_wait_queue); |
|---|
| 287 | 273 | } |
|---|
| 288 | 274 | |
|---|
| 289 | | -static void usX2Y_error_urb_status(struct usX2Ydev *usX2Y, |
|---|
| 290 | | - struct snd_usX2Y_substream *subs, struct urb *urb) |
|---|
| 275 | +static void usx2y_error_urb_status(struct usx2ydev *usx2y, |
|---|
| 276 | + struct snd_usx2y_substream *subs, struct urb *urb) |
|---|
| 291 | 277 | { |
|---|
| 292 | 278 | snd_printk(KERN_ERR "ep=%i stalled with status=%i\n", subs->endpoint, urb->status); |
|---|
| 293 | 279 | urb->status = 0; |
|---|
| 294 | | - usX2Y_clients_stop(usX2Y); |
|---|
| 280 | + usx2y_clients_stop(usx2y); |
|---|
| 295 | 281 | } |
|---|
| 296 | 282 | |
|---|
| 297 | | -static void i_usX2Y_urb_complete(struct urb *urb) |
|---|
| 283 | +static void i_usx2y_urb_complete(struct urb *urb) |
|---|
| 298 | 284 | { |
|---|
| 299 | | - struct snd_usX2Y_substream *subs = urb->context; |
|---|
| 300 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 285 | + struct snd_usx2y_substream *subs = urb->context; |
|---|
| 286 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 301 | 287 | |
|---|
| 302 | | - if (unlikely(atomic_read(&subs->state) < state_PREPARED)) { |
|---|
| 288 | + if (unlikely(atomic_read(&subs->state) < STATE_PREPARED)) { |
|---|
| 303 | 289 | snd_printdd("hcd_frame=%i ep=%i%s status=%i start_frame=%i\n", |
|---|
| 304 | | - usb_get_current_frame_number(usX2Y->dev), |
|---|
| 290 | + usb_get_current_frame_number(usx2y->dev), |
|---|
| 305 | 291 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
|---|
| 306 | 292 | urb->status, urb->start_frame); |
|---|
| 307 | 293 | return; |
|---|
| 308 | 294 | } |
|---|
| 309 | 295 | if (unlikely(urb->status)) { |
|---|
| 310 | | - usX2Y_error_urb_status(usX2Y, subs, urb); |
|---|
| 296 | + usx2y_error_urb_status(usx2y, subs, urb); |
|---|
| 311 | 297 | return; |
|---|
| 312 | 298 | } |
|---|
| 313 | 299 | |
|---|
| 314 | 300 | subs->completed_urb = urb; |
|---|
| 315 | 301 | |
|---|
| 316 | 302 | { |
|---|
| 317 | | - struct snd_usX2Y_substream *capsubs = usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE], |
|---|
| 318 | | - *playbacksubs = usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
|---|
| 303 | + struct snd_usx2y_substream *capsubs = usx2y->subs[SNDRV_PCM_STREAM_CAPTURE], |
|---|
| 304 | + *playbacksubs = usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
|---|
| 319 | 305 | if (capsubs->completed_urb && |
|---|
| 320 | | - atomic_read(&capsubs->state) >= state_PREPARED && |
|---|
| 306 | + atomic_read(&capsubs->state) >= STATE_PREPARED && |
|---|
| 321 | 307 | (playbacksubs->completed_urb || |
|---|
| 322 | | - atomic_read(&playbacksubs->state) < state_PREPARED)) { |
|---|
| 323 | | - if (!usX2Y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) |
|---|
| 324 | | - usX2Y->wait_iso_frame += nr_of_packs(); |
|---|
| 308 | + atomic_read(&playbacksubs->state) < STATE_PREPARED)) { |
|---|
| 309 | + if (!usx2y_usbframe_complete(capsubs, playbacksubs, urb->start_frame)) |
|---|
| 310 | + usx2y->wait_iso_frame += nr_of_packs(); |
|---|
| 325 | 311 | else { |
|---|
| 326 | 312 | snd_printdd("\n"); |
|---|
| 327 | | - usX2Y_clients_stop(usX2Y); |
|---|
| 313 | + usx2y_clients_stop(usx2y); |
|---|
| 328 | 314 | } |
|---|
| 329 | 315 | } |
|---|
| 330 | 316 | } |
|---|
| 331 | 317 | } |
|---|
| 332 | 318 | |
|---|
| 333 | | -static void usX2Y_urbs_set_complete(struct usX2Ydev * usX2Y, |
|---|
| 319 | +static void usx2y_urbs_set_complete(struct usx2ydev * usx2y, |
|---|
| 334 | 320 | void (*complete)(struct urb *)) |
|---|
| 335 | 321 | { |
|---|
| 336 | 322 | int s, u; |
|---|
| 337 | 323 | for (s = 0; s < 4; s++) { |
|---|
| 338 | | - struct snd_usX2Y_substream *subs = usX2Y->subs[s]; |
|---|
| 324 | + struct snd_usx2y_substream *subs = usx2y->subs[s]; |
|---|
| 339 | 325 | if (NULL != subs) |
|---|
| 340 | 326 | for (u = 0; u < NRURBS; u++) { |
|---|
| 341 | 327 | struct urb * urb = subs->urb[u]; |
|---|
| .. | .. |
|---|
| 345 | 331 | } |
|---|
| 346 | 332 | } |
|---|
| 347 | 333 | |
|---|
| 348 | | -static void usX2Y_subs_startup_finish(struct usX2Ydev * usX2Y) |
|---|
| 334 | +static void usx2y_subs_startup_finish(struct usx2ydev * usx2y) |
|---|
| 349 | 335 | { |
|---|
| 350 | | - usX2Y_urbs_set_complete(usX2Y, i_usX2Y_urb_complete); |
|---|
| 351 | | - usX2Y->prepare_subs = NULL; |
|---|
| 336 | + usx2y_urbs_set_complete(usx2y, i_usx2y_urb_complete); |
|---|
| 337 | + usx2y->prepare_subs = NULL; |
|---|
| 352 | 338 | } |
|---|
| 353 | 339 | |
|---|
| 354 | | -static void i_usX2Y_subs_startup(struct urb *urb) |
|---|
| 340 | +static void i_usx2y_subs_startup(struct urb *urb) |
|---|
| 355 | 341 | { |
|---|
| 356 | | - struct snd_usX2Y_substream *subs = urb->context; |
|---|
| 357 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 358 | | - struct snd_usX2Y_substream *prepare_subs = usX2Y->prepare_subs; |
|---|
| 342 | + struct snd_usx2y_substream *subs = urb->context; |
|---|
| 343 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 344 | + struct snd_usx2y_substream *prepare_subs = usx2y->prepare_subs; |
|---|
| 359 | 345 | if (NULL != prepare_subs) |
|---|
| 360 | 346 | if (urb->start_frame == prepare_subs->urb[0]->start_frame) { |
|---|
| 361 | | - usX2Y_subs_startup_finish(usX2Y); |
|---|
| 347 | + usx2y_subs_startup_finish(usx2y); |
|---|
| 362 | 348 | atomic_inc(&prepare_subs->state); |
|---|
| 363 | | - wake_up(&usX2Y->prepare_wait_queue); |
|---|
| 349 | + wake_up(&usx2y->prepare_wait_queue); |
|---|
| 364 | 350 | } |
|---|
| 365 | 351 | |
|---|
| 366 | | - i_usX2Y_urb_complete(urb); |
|---|
| 352 | + i_usx2y_urb_complete(urb); |
|---|
| 367 | 353 | } |
|---|
| 368 | 354 | |
|---|
| 369 | | -static void usX2Y_subs_prepare(struct snd_usX2Y_substream *subs) |
|---|
| 355 | +static void usx2y_subs_prepare(struct snd_usx2y_substream *subs) |
|---|
| 370 | 356 | { |
|---|
| 371 | | - snd_printdd("usX2Y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", |
|---|
| 357 | + snd_printdd("usx2y_substream_prepare(%p) ep=%i urb0=%p urb1=%p\n", |
|---|
| 372 | 358 | subs, subs->endpoint, subs->urb[0], subs->urb[1]); |
|---|
| 373 | 359 | /* reset the pointer */ |
|---|
| 374 | 360 | subs->hwptr = 0; |
|---|
| .. | .. |
|---|
| 377 | 363 | } |
|---|
| 378 | 364 | |
|---|
| 379 | 365 | |
|---|
| 380 | | -static void usX2Y_urb_release(struct urb **urb, int free_tb) |
|---|
| 366 | +static void usx2y_urb_release(struct urb **urb, int free_tb) |
|---|
| 381 | 367 | { |
|---|
| 382 | 368 | if (*urb) { |
|---|
| 383 | 369 | usb_kill_urb(*urb); |
|---|
| .. | .. |
|---|
| 390 | 376 | /* |
|---|
| 391 | 377 | * release a substreams urbs |
|---|
| 392 | 378 | */ |
|---|
| 393 | | -static void usX2Y_urbs_release(struct snd_usX2Y_substream *subs) |
|---|
| 379 | +static void usx2y_urbs_release(struct snd_usx2y_substream *subs) |
|---|
| 394 | 380 | { |
|---|
| 395 | 381 | int i; |
|---|
| 396 | | - snd_printdd("usX2Y_urbs_release() %i\n", subs->endpoint); |
|---|
| 382 | + snd_printdd("usx2y_urbs_release() %i\n", subs->endpoint); |
|---|
| 397 | 383 | for (i = 0; i < NRURBS; i++) |
|---|
| 398 | | - usX2Y_urb_release(subs->urb + i, |
|---|
| 399 | | - subs != subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]); |
|---|
| 384 | + usx2y_urb_release(subs->urb + i, |
|---|
| 385 | + subs != subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]); |
|---|
| 400 | 386 | |
|---|
| 401 | 387 | kfree(subs->tmpbuf); |
|---|
| 402 | 388 | subs->tmpbuf = NULL; |
|---|
| .. | .. |
|---|
| 404 | 390 | /* |
|---|
| 405 | 391 | * initialize a substream's urbs |
|---|
| 406 | 392 | */ |
|---|
| 407 | | -static int usX2Y_urbs_allocate(struct snd_usX2Y_substream *subs) |
|---|
| 393 | +static int usx2y_urbs_allocate(struct snd_usx2y_substream *subs) |
|---|
| 408 | 394 | { |
|---|
| 409 | 395 | int i; |
|---|
| 410 | 396 | unsigned int pipe; |
|---|
| 411 | | - int is_playback = subs == subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
|---|
| 412 | | - struct usb_device *dev = subs->usX2Y->dev; |
|---|
| 397 | + int is_playback = subs == subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
|---|
| 398 | + struct usb_device *dev = subs->usx2y->dev; |
|---|
| 413 | 399 | |
|---|
| 414 | 400 | pipe = is_playback ? usb_sndisocpipe(dev, subs->endpoint) : |
|---|
| 415 | 401 | usb_rcvisocpipe(dev, subs->endpoint); |
|---|
| .. | .. |
|---|
| 431 | 417 | } |
|---|
| 432 | 418 | *purb = usb_alloc_urb(nr_of_packs(), GFP_KERNEL); |
|---|
| 433 | 419 | if (NULL == *purb) { |
|---|
| 434 | | - usX2Y_urbs_release(subs); |
|---|
| 420 | + usx2y_urbs_release(subs); |
|---|
| 435 | 421 | return -ENOMEM; |
|---|
| 436 | 422 | } |
|---|
| 437 | 423 | if (!is_playback && !(*purb)->transfer_buffer) { |
|---|
| .. | .. |
|---|
| 440 | 426 | kmalloc_array(subs->maxpacksize, |
|---|
| 441 | 427 | nr_of_packs(), GFP_KERNEL); |
|---|
| 442 | 428 | if (NULL == (*purb)->transfer_buffer) { |
|---|
| 443 | | - usX2Y_urbs_release(subs); |
|---|
| 429 | + usx2y_urbs_release(subs); |
|---|
| 444 | 430 | return -ENOMEM; |
|---|
| 445 | 431 | } |
|---|
| 446 | 432 | } |
|---|
| .. | .. |
|---|
| 449 | 435 | (*purb)->number_of_packets = nr_of_packs(); |
|---|
| 450 | 436 | (*purb)->context = subs; |
|---|
| 451 | 437 | (*purb)->interval = 1; |
|---|
| 452 | | - (*purb)->complete = i_usX2Y_subs_startup; |
|---|
| 438 | + (*purb)->complete = i_usx2y_subs_startup; |
|---|
| 453 | 439 | } |
|---|
| 454 | 440 | return 0; |
|---|
| 455 | 441 | } |
|---|
| 456 | 442 | |
|---|
| 457 | | -static void usX2Y_subs_startup(struct snd_usX2Y_substream *subs) |
|---|
| 443 | +static void usx2y_subs_startup(struct snd_usx2y_substream *subs) |
|---|
| 458 | 444 | { |
|---|
| 459 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 460 | | - usX2Y->prepare_subs = subs; |
|---|
| 445 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 446 | + usx2y->prepare_subs = subs; |
|---|
| 461 | 447 | subs->urb[0]->start_frame = -1; |
|---|
| 462 | 448 | wmb(); |
|---|
| 463 | | - usX2Y_urbs_set_complete(usX2Y, i_usX2Y_subs_startup); |
|---|
| 449 | + usx2y_urbs_set_complete(usx2y, i_usx2y_subs_startup); |
|---|
| 464 | 450 | } |
|---|
| 465 | 451 | |
|---|
| 466 | | -static int usX2Y_urbs_start(struct snd_usX2Y_substream *subs) |
|---|
| 452 | +static int usx2y_urbs_start(struct snd_usx2y_substream *subs) |
|---|
| 467 | 453 | { |
|---|
| 468 | 454 | int i, err; |
|---|
| 469 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 455 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 470 | 456 | |
|---|
| 471 | | - if ((err = usX2Y_urbs_allocate(subs)) < 0) |
|---|
| 457 | + if ((err = usx2y_urbs_allocate(subs)) < 0) |
|---|
| 472 | 458 | return err; |
|---|
| 473 | 459 | subs->completed_urb = NULL; |
|---|
| 474 | 460 | for (i = 0; i < 4; i++) { |
|---|
| 475 | | - struct snd_usX2Y_substream *subs = usX2Y->subs[i]; |
|---|
| 476 | | - if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED) |
|---|
| 461 | + struct snd_usx2y_substream *subs = usx2y->subs[i]; |
|---|
| 462 | + if (subs != NULL && atomic_read(&subs->state) >= STATE_PREPARED) |
|---|
| 477 | 463 | goto start; |
|---|
| 478 | 464 | } |
|---|
| 479 | 465 | |
|---|
| 480 | 466 | start: |
|---|
| 481 | | - usX2Y_subs_startup(subs); |
|---|
| 467 | + usx2y_subs_startup(subs); |
|---|
| 482 | 468 | for (i = 0; i < NRURBS; i++) { |
|---|
| 483 | 469 | struct urb *urb = subs->urb[i]; |
|---|
| 484 | 470 | if (usb_pipein(urb->pipe)) { |
|---|
| 485 | 471 | unsigned long pack; |
|---|
| 486 | 472 | if (0 == i) |
|---|
| 487 | | - atomic_set(&subs->state, state_STARTING3); |
|---|
| 488 | | - urb->dev = usX2Y->dev; |
|---|
| 473 | + atomic_set(&subs->state, STATE_STARTING3); |
|---|
| 474 | + urb->dev = usx2y->dev; |
|---|
| 489 | 475 | for (pack = 0; pack < nr_of_packs(); pack++) { |
|---|
| 490 | 476 | urb->iso_frame_desc[pack].offset = subs->maxpacksize * pack; |
|---|
| 491 | 477 | urb->iso_frame_desc[pack].length = subs->maxpacksize; |
|---|
| .. | .. |
|---|
| 497 | 483 | goto cleanup; |
|---|
| 498 | 484 | } else |
|---|
| 499 | 485 | if (i == 0) |
|---|
| 500 | | - usX2Y->wait_iso_frame = urb->start_frame; |
|---|
| 486 | + usx2y->wait_iso_frame = urb->start_frame; |
|---|
| 501 | 487 | urb->transfer_flags = 0; |
|---|
| 502 | 488 | } else { |
|---|
| 503 | | - atomic_set(&subs->state, state_STARTING1); |
|---|
| 489 | + atomic_set(&subs->state, STATE_STARTING1); |
|---|
| 504 | 490 | break; |
|---|
| 505 | 491 | } |
|---|
| 506 | 492 | } |
|---|
| 507 | 493 | err = 0; |
|---|
| 508 | | - wait_event(usX2Y->prepare_wait_queue, NULL == usX2Y->prepare_subs); |
|---|
| 509 | | - if (atomic_read(&subs->state) != state_PREPARED) |
|---|
| 494 | + wait_event(usx2y->prepare_wait_queue, NULL == usx2y->prepare_subs); |
|---|
| 495 | + if (atomic_read(&subs->state) != STATE_PREPARED) |
|---|
| 510 | 496 | err = -EPIPE; |
|---|
| 511 | 497 | |
|---|
| 512 | 498 | cleanup: |
|---|
| 513 | 499 | if (err) { |
|---|
| 514 | | - usX2Y_subs_startup_finish(usX2Y); |
|---|
| 515 | | - usX2Y_clients_stop(usX2Y); // something is completely wroong > stop evrything |
|---|
| 500 | + usx2y_subs_startup_finish(usx2y); |
|---|
| 501 | + usx2y_clients_stop(usx2y); // something is completely wroong > stop evrything |
|---|
| 516 | 502 | } |
|---|
| 517 | 503 | return err; |
|---|
| 518 | 504 | } |
|---|
| .. | .. |
|---|
| 520 | 506 | /* |
|---|
| 521 | 507 | * return the current pcm pointer. just return the hwptr_done value. |
|---|
| 522 | 508 | */ |
|---|
| 523 | | -static snd_pcm_uframes_t snd_usX2Y_pcm_pointer(struct snd_pcm_substream *substream) |
|---|
| 509 | +static snd_pcm_uframes_t snd_usx2y_pcm_pointer(struct snd_pcm_substream *substream) |
|---|
| 524 | 510 | { |
|---|
| 525 | | - struct snd_usX2Y_substream *subs = substream->runtime->private_data; |
|---|
| 511 | + struct snd_usx2y_substream *subs = substream->runtime->private_data; |
|---|
| 526 | 512 | return subs->hwptr_done; |
|---|
| 527 | 513 | } |
|---|
| 528 | 514 | /* |
|---|
| 529 | 515 | * start/stop substream |
|---|
| 530 | 516 | */ |
|---|
| 531 | | -static int snd_usX2Y_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
|---|
| 517 | +static int snd_usx2y_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
|---|
| 532 | 518 | { |
|---|
| 533 | | - struct snd_usX2Y_substream *subs = substream->runtime->private_data; |
|---|
| 519 | + struct snd_usx2y_substream *subs = substream->runtime->private_data; |
|---|
| 534 | 520 | |
|---|
| 535 | 521 | switch (cmd) { |
|---|
| 536 | 522 | case SNDRV_PCM_TRIGGER_START: |
|---|
| 537 | | - snd_printdd("snd_usX2Y_pcm_trigger(START)\n"); |
|---|
| 538 | | - if (atomic_read(&subs->state) == state_PREPARED && |
|---|
| 539 | | - atomic_read(&subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= state_PREPARED) { |
|---|
| 540 | | - atomic_set(&subs->state, state_PRERUNNING); |
|---|
| 523 | + snd_printdd("snd_usx2y_pcm_trigger(START)\n"); |
|---|
| 524 | + if (atomic_read(&subs->state) == STATE_PREPARED && |
|---|
| 525 | + atomic_read(&subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]->state) >= STATE_PREPARED) { |
|---|
| 526 | + atomic_set(&subs->state, STATE_PRERUNNING); |
|---|
| 541 | 527 | } else { |
|---|
| 542 | 528 | snd_printdd("\n"); |
|---|
| 543 | 529 | return -EPIPE; |
|---|
| 544 | 530 | } |
|---|
| 545 | 531 | break; |
|---|
| 546 | 532 | case SNDRV_PCM_TRIGGER_STOP: |
|---|
| 547 | | - snd_printdd("snd_usX2Y_pcm_trigger(STOP)\n"); |
|---|
| 548 | | - if (atomic_read(&subs->state) >= state_PRERUNNING) |
|---|
| 549 | | - atomic_set(&subs->state, state_PREPARED); |
|---|
| 533 | + snd_printdd("snd_usx2y_pcm_trigger(STOP)\n"); |
|---|
| 534 | + if (atomic_read(&subs->state) >= STATE_PRERUNNING) |
|---|
| 535 | + atomic_set(&subs->state, STATE_PREPARED); |
|---|
| 550 | 536 | break; |
|---|
| 551 | 537 | default: |
|---|
| 552 | 538 | return -EINVAL; |
|---|
| .. | .. |
|---|
| 563 | 549 | * if sg buffer is supported on the later version of alsa, we'll follow |
|---|
| 564 | 550 | * that. |
|---|
| 565 | 551 | */ |
|---|
| 566 | | -static struct s_c2 |
|---|
| 552 | +static const struct s_c2 |
|---|
| 567 | 553 | { |
|---|
| 568 | 554 | char c1, c2; |
|---|
| 569 | 555 | } |
|---|
| 570 | | - SetRate44100[] = |
|---|
| 556 | + setrate_44100[] = |
|---|
| 571 | 557 | { |
|---|
| 572 | 558 | { 0x14, 0x08}, // this line sets 44100, well actually a little less |
|---|
| 573 | 559 | { 0x18, 0x40}, // only tascam / frontier design knows the further lines ....... |
|---|
| .. | .. |
|---|
| 603 | 589 | { 0x18, 0x7C}, |
|---|
| 604 | 590 | { 0x18, 0x7E} |
|---|
| 605 | 591 | }; |
|---|
| 606 | | -static struct s_c2 SetRate48000[] = |
|---|
| 592 | +static const struct s_c2 setrate_48000[] = |
|---|
| 607 | 593 | { |
|---|
| 608 | 594 | { 0x14, 0x09}, // this line sets 48000, well actually a little less |
|---|
| 609 | 595 | { 0x18, 0x40}, // only tascam / frontier design knows the further lines ....... |
|---|
| .. | .. |
|---|
| 639 | 625 | { 0x18, 0x7C}, |
|---|
| 640 | 626 | { 0x18, 0x7E} |
|---|
| 641 | 627 | }; |
|---|
| 642 | | -#define NOOF_SETRATE_URBS ARRAY_SIZE(SetRate48000) |
|---|
| 628 | +#define NOOF_SETRATE_URBS ARRAY_SIZE(setrate_48000) |
|---|
| 643 | 629 | |
|---|
| 644 | | -static void i_usX2Y_04Int(struct urb *urb) |
|---|
| 630 | +static void i_usx2y_04int(struct urb *urb) |
|---|
| 645 | 631 | { |
|---|
| 646 | | - struct usX2Ydev *usX2Y = urb->context; |
|---|
| 632 | + struct usx2ydev *usx2y = urb->context; |
|---|
| 647 | 633 | |
|---|
| 648 | 634 | if (urb->status) |
|---|
| 649 | | - snd_printk(KERN_ERR "snd_usX2Y_04Int() urb->status=%i\n", urb->status); |
|---|
| 650 | | - if (0 == --usX2Y->US04->len) |
|---|
| 651 | | - wake_up(&usX2Y->In04WaitQueue); |
|---|
| 635 | + snd_printk(KERN_ERR "snd_usx2y_04int() urb->status=%i\n", urb->status); |
|---|
| 636 | + if (0 == --usx2y->us04->len) |
|---|
| 637 | + wake_up(&usx2y->in04_wait_queue); |
|---|
| 652 | 638 | } |
|---|
| 653 | 639 | |
|---|
| 654 | | -static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate) |
|---|
| 640 | +static int usx2y_rate_set(struct usx2ydev *usx2y, int rate) |
|---|
| 655 | 641 | { |
|---|
| 656 | 642 | int err = 0, i; |
|---|
| 657 | | - struct snd_usX2Y_urbSeq *us = NULL; |
|---|
| 643 | + struct snd_usx2y_urb_seq *us = NULL; |
|---|
| 658 | 644 | int *usbdata = NULL; |
|---|
| 659 | | - struct s_c2 *ra = rate == 48000 ? SetRate48000 : SetRate44100; |
|---|
| 645 | + const struct s_c2 *ra = rate == 48000 ? setrate_48000 : setrate_44100; |
|---|
| 660 | 646 | |
|---|
| 661 | | - if (usX2Y->rate != rate) { |
|---|
| 647 | + if (usx2y->rate != rate) { |
|---|
| 662 | 648 | us = kzalloc(sizeof(*us) + sizeof(struct urb*) * NOOF_SETRATE_URBS, GFP_KERNEL); |
|---|
| 663 | 649 | if (NULL == us) { |
|---|
| 664 | 650 | err = -ENOMEM; |
|---|
| .. | .. |
|---|
| 677 | 663 | } |
|---|
| 678 | 664 | ((char*)(usbdata + i))[0] = ra[i].c1; |
|---|
| 679 | 665 | ((char*)(usbdata + i))[1] = ra[i].c2; |
|---|
| 680 | | - usb_fill_bulk_urb(us->urb[i], usX2Y->dev, usb_sndbulkpipe(usX2Y->dev, 4), |
|---|
| 681 | | - usbdata + i, 2, i_usX2Y_04Int, usX2Y); |
|---|
| 666 | + usb_fill_bulk_urb(us->urb[i], usx2y->dev, usb_sndbulkpipe(usx2y->dev, 4), |
|---|
| 667 | + usbdata + i, 2, i_usx2y_04int, usx2y); |
|---|
| 682 | 668 | } |
|---|
| 683 | 669 | err = usb_urb_ep_type_check(us->urb[0]); |
|---|
| 684 | 670 | if (err < 0) |
|---|
| 685 | 671 | goto cleanup; |
|---|
| 686 | 672 | us->submitted = 0; |
|---|
| 687 | 673 | us->len = NOOF_SETRATE_URBS; |
|---|
| 688 | | - usX2Y->US04 = us; |
|---|
| 689 | | - wait_event_timeout(usX2Y->In04WaitQueue, 0 == us->len, HZ); |
|---|
| 690 | | - usX2Y->US04 = NULL; |
|---|
| 674 | + usx2y->us04 = us; |
|---|
| 675 | + wait_event_timeout(usx2y->in04_wait_queue, 0 == us->len, HZ); |
|---|
| 676 | + usx2y->us04 = NULL; |
|---|
| 691 | 677 | if (us->len) |
|---|
| 692 | 678 | err = -ENODEV; |
|---|
| 693 | 679 | cleanup: |
|---|
| .. | .. |
|---|
| 704 | 690 | } |
|---|
| 705 | 691 | usb_free_urb(urb); |
|---|
| 706 | 692 | } |
|---|
| 707 | | - usX2Y->US04 = NULL; |
|---|
| 693 | + usx2y->us04 = NULL; |
|---|
| 708 | 694 | kfree(usbdata); |
|---|
| 709 | 695 | kfree(us); |
|---|
| 710 | 696 | if (!err) |
|---|
| 711 | | - usX2Y->rate = rate; |
|---|
| 697 | + usx2y->rate = rate; |
|---|
| 712 | 698 | } |
|---|
| 713 | 699 | } |
|---|
| 714 | 700 | |
|---|
| .. | .. |
|---|
| 716 | 702 | } |
|---|
| 717 | 703 | |
|---|
| 718 | 704 | |
|---|
| 719 | | -static int usX2Y_format_set(struct usX2Ydev *usX2Y, snd_pcm_format_t format) |
|---|
| 705 | +static int usx2y_format_set(struct usx2ydev *usx2y, snd_pcm_format_t format) |
|---|
| 720 | 706 | { |
|---|
| 721 | 707 | int alternate, err; |
|---|
| 722 | 708 | struct list_head* p; |
|---|
| 723 | 709 | if (format == SNDRV_PCM_FORMAT_S24_3LE) { |
|---|
| 724 | 710 | alternate = 2; |
|---|
| 725 | | - usX2Y->stride = 6; |
|---|
| 711 | + usx2y->stride = 6; |
|---|
| 726 | 712 | } else { |
|---|
| 727 | 713 | alternate = 1; |
|---|
| 728 | | - usX2Y->stride = 4; |
|---|
| 714 | + usx2y->stride = 4; |
|---|
| 729 | 715 | } |
|---|
| 730 | | - list_for_each(p, &usX2Y->midi_list) { |
|---|
| 716 | + list_for_each(p, &usx2y->midi_list) { |
|---|
| 731 | 717 | snd_usbmidi_input_stop(p); |
|---|
| 732 | 718 | } |
|---|
| 733 | | - usb_kill_urb(usX2Y->In04urb); |
|---|
| 734 | | - if ((err = usb_set_interface(usX2Y->dev, 0, alternate))) { |
|---|
| 719 | + usb_kill_urb(usx2y->in04_urb); |
|---|
| 720 | + if ((err = usb_set_interface(usx2y->dev, 0, alternate))) { |
|---|
| 735 | 721 | snd_printk(KERN_ERR "usb_set_interface error \n"); |
|---|
| 736 | 722 | return err; |
|---|
| 737 | 723 | } |
|---|
| 738 | | - usX2Y->In04urb->dev = usX2Y->dev; |
|---|
| 739 | | - err = usb_submit_urb(usX2Y->In04urb, GFP_KERNEL); |
|---|
| 740 | | - list_for_each(p, &usX2Y->midi_list) { |
|---|
| 724 | + usx2y->in04_urb->dev = usx2y->dev; |
|---|
| 725 | + err = usb_submit_urb(usx2y->in04_urb, GFP_KERNEL); |
|---|
| 726 | + list_for_each(p, &usx2y->midi_list) { |
|---|
| 741 | 727 | snd_usbmidi_input_start(p); |
|---|
| 742 | 728 | } |
|---|
| 743 | | - usX2Y->format = format; |
|---|
| 744 | | - usX2Y->rate = 0; |
|---|
| 729 | + usx2y->format = format; |
|---|
| 730 | + usx2y->rate = 0; |
|---|
| 745 | 731 | return err; |
|---|
| 746 | 732 | } |
|---|
| 747 | 733 | |
|---|
| 748 | 734 | |
|---|
| 749 | | -static int snd_usX2Y_pcm_hw_params(struct snd_pcm_substream *substream, |
|---|
| 735 | +static int snd_usx2y_pcm_hw_params(struct snd_pcm_substream *substream, |
|---|
| 750 | 736 | struct snd_pcm_hw_params *hw_params) |
|---|
| 751 | 737 | { |
|---|
| 752 | 738 | int err = 0; |
|---|
| 753 | 739 | unsigned int rate = params_rate(hw_params); |
|---|
| 754 | 740 | snd_pcm_format_t format = params_format(hw_params); |
|---|
| 755 | 741 | struct snd_card *card = substream->pstr->pcm->card; |
|---|
| 756 | | - struct usX2Ydev *dev = usX2Y(card); |
|---|
| 742 | + struct usx2ydev *dev = usx2y(card); |
|---|
| 757 | 743 | int i; |
|---|
| 758 | 744 | |
|---|
| 759 | | - mutex_lock(&usX2Y(card)->pcm_mutex); |
|---|
| 760 | | - snd_printdd("snd_usX2Y_hw_params(%p, %p)\n", substream, hw_params); |
|---|
| 761 | | - /* all pcm substreams off one usX2Y have to operate at the same |
|---|
| 745 | + mutex_lock(&usx2y(card)->pcm_mutex); |
|---|
| 746 | + snd_printdd("snd_usx2y_hw_params(%p, %p)\n", substream, hw_params); |
|---|
| 747 | + /* all pcm substreams off one usx2y have to operate at the same |
|---|
| 762 | 748 | * rate & format |
|---|
| 763 | 749 | */ |
|---|
| 764 | 750 | for (i = 0; i < dev->pcm_devs * 2; i++) { |
|---|
| 765 | | - struct snd_usX2Y_substream *subs = dev->subs[i]; |
|---|
| 751 | + struct snd_usx2y_substream *subs = dev->subs[i]; |
|---|
| 766 | 752 | struct snd_pcm_substream *test_substream; |
|---|
| 767 | 753 | |
|---|
| 768 | 754 | if (!subs) |
|---|
| .. | .. |
|---|
| 780 | 766 | } |
|---|
| 781 | 767 | } |
|---|
| 782 | 768 | |
|---|
| 783 | | - err = snd_pcm_lib_malloc_pages(substream, |
|---|
| 784 | | - params_buffer_bytes(hw_params)); |
|---|
| 785 | | - if (err < 0) { |
|---|
| 786 | | - snd_printk(KERN_ERR "snd_pcm_lib_malloc_pages(%p, %i) returned %i\n", |
|---|
| 787 | | - substream, params_buffer_bytes(hw_params), err); |
|---|
| 788 | | - goto error; |
|---|
| 789 | | - } |
|---|
| 790 | | - |
|---|
| 791 | 769 | error: |
|---|
| 792 | | - mutex_unlock(&usX2Y(card)->pcm_mutex); |
|---|
| 770 | + mutex_unlock(&usx2y(card)->pcm_mutex); |
|---|
| 793 | 771 | return err; |
|---|
| 794 | 772 | } |
|---|
| 795 | 773 | |
|---|
| 796 | 774 | /* |
|---|
| 797 | 775 | * free the buffer |
|---|
| 798 | 776 | */ |
|---|
| 799 | | -static int snd_usX2Y_pcm_hw_free(struct snd_pcm_substream *substream) |
|---|
| 777 | +static int snd_usx2y_pcm_hw_free(struct snd_pcm_substream *substream) |
|---|
| 800 | 778 | { |
|---|
| 801 | 779 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 802 | | - struct snd_usX2Y_substream *subs = runtime->private_data; |
|---|
| 803 | | - mutex_lock(&subs->usX2Y->pcm_mutex); |
|---|
| 804 | | - snd_printdd("snd_usX2Y_hw_free(%p)\n", substream); |
|---|
| 780 | + struct snd_usx2y_substream *subs = runtime->private_data; |
|---|
| 781 | + mutex_lock(&subs->usx2y->pcm_mutex); |
|---|
| 782 | + snd_printdd("snd_usx2y_hw_free(%p)\n", substream); |
|---|
| 805 | 783 | |
|---|
| 806 | 784 | if (SNDRV_PCM_STREAM_PLAYBACK == substream->stream) { |
|---|
| 807 | | - struct snd_usX2Y_substream *cap_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; |
|---|
| 808 | | - atomic_set(&subs->state, state_STOPPED); |
|---|
| 809 | | - usX2Y_urbs_release(subs); |
|---|
| 785 | + struct snd_usx2y_substream *cap_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; |
|---|
| 786 | + atomic_set(&subs->state, STATE_STOPPED); |
|---|
| 787 | + usx2y_urbs_release(subs); |
|---|
| 810 | 788 | if (!cap_subs->pcm_substream || |
|---|
| 811 | 789 | !cap_subs->pcm_substream->runtime || |
|---|
| 812 | 790 | !cap_subs->pcm_substream->runtime->status || |
|---|
| 813 | 791 | cap_subs->pcm_substream->runtime->status->state < SNDRV_PCM_STATE_PREPARED) { |
|---|
| 814 | | - atomic_set(&cap_subs->state, state_STOPPED); |
|---|
| 815 | | - usX2Y_urbs_release(cap_subs); |
|---|
| 792 | + atomic_set(&cap_subs->state, STATE_STOPPED); |
|---|
| 793 | + usx2y_urbs_release(cap_subs); |
|---|
| 816 | 794 | } |
|---|
| 817 | 795 | } else { |
|---|
| 818 | | - struct snd_usX2Y_substream *playback_subs = subs->usX2Y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
|---|
| 819 | | - if (atomic_read(&playback_subs->state) < state_PREPARED) { |
|---|
| 820 | | - atomic_set(&subs->state, state_STOPPED); |
|---|
| 821 | | - usX2Y_urbs_release(subs); |
|---|
| 796 | + struct snd_usx2y_substream *playback_subs = subs->usx2y->subs[SNDRV_PCM_STREAM_PLAYBACK]; |
|---|
| 797 | + if (atomic_read(&playback_subs->state) < STATE_PREPARED) { |
|---|
| 798 | + atomic_set(&subs->state, STATE_STOPPED); |
|---|
| 799 | + usx2y_urbs_release(subs); |
|---|
| 822 | 800 | } |
|---|
| 823 | 801 | } |
|---|
| 824 | | - mutex_unlock(&subs->usX2Y->pcm_mutex); |
|---|
| 825 | | - return snd_pcm_lib_free_pages(substream); |
|---|
| 802 | + mutex_unlock(&subs->usx2y->pcm_mutex); |
|---|
| 803 | + return 0; |
|---|
| 826 | 804 | } |
|---|
| 827 | 805 | /* |
|---|
| 828 | 806 | * prepare callback |
|---|
| 829 | 807 | * |
|---|
| 830 | 808 | * set format and initialize urbs |
|---|
| 831 | 809 | */ |
|---|
| 832 | | -static int snd_usX2Y_pcm_prepare(struct snd_pcm_substream *substream) |
|---|
| 810 | +static int snd_usx2y_pcm_prepare(struct snd_pcm_substream *substream) |
|---|
| 833 | 811 | { |
|---|
| 834 | 812 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 835 | | - struct snd_usX2Y_substream *subs = runtime->private_data; |
|---|
| 836 | | - struct usX2Ydev *usX2Y = subs->usX2Y; |
|---|
| 837 | | - struct snd_usX2Y_substream *capsubs = subs->usX2Y->subs[SNDRV_PCM_STREAM_CAPTURE]; |
|---|
| 813 | + struct snd_usx2y_substream *subs = runtime->private_data; |
|---|
| 814 | + struct usx2ydev *usx2y = subs->usx2y; |
|---|
| 815 | + struct snd_usx2y_substream *capsubs = subs->usx2y->subs[SNDRV_PCM_STREAM_CAPTURE]; |
|---|
| 838 | 816 | int err = 0; |
|---|
| 839 | | - snd_printdd("snd_usX2Y_pcm_prepare(%p)\n", substream); |
|---|
| 817 | + snd_printdd("snd_usx2y_pcm_prepare(%p)\n", substream); |
|---|
| 840 | 818 | |
|---|
| 841 | | - mutex_lock(&usX2Y->pcm_mutex); |
|---|
| 842 | | - usX2Y_subs_prepare(subs); |
|---|
| 819 | + mutex_lock(&usx2y->pcm_mutex); |
|---|
| 820 | + usx2y_subs_prepare(subs); |
|---|
| 843 | 821 | // Start hardware streams |
|---|
| 844 | 822 | // SyncStream first.... |
|---|
| 845 | | - if (atomic_read(&capsubs->state) < state_PREPARED) { |
|---|
| 846 | | - if (usX2Y->format != runtime->format) |
|---|
| 847 | | - if ((err = usX2Y_format_set(usX2Y, runtime->format)) < 0) |
|---|
| 823 | + if (atomic_read(&capsubs->state) < STATE_PREPARED) { |
|---|
| 824 | + if (usx2y->format != runtime->format) |
|---|
| 825 | + if ((err = usx2y_format_set(usx2y, runtime->format)) < 0) |
|---|
| 848 | 826 | goto up_prepare_mutex; |
|---|
| 849 | | - if (usX2Y->rate != runtime->rate) |
|---|
| 850 | | - if ((err = usX2Y_rate_set(usX2Y, runtime->rate)) < 0) |
|---|
| 827 | + if (usx2y->rate != runtime->rate) |
|---|
| 828 | + if ((err = usx2y_rate_set(usx2y, runtime->rate)) < 0) |
|---|
| 851 | 829 | goto up_prepare_mutex; |
|---|
| 852 | 830 | snd_printdd("starting capture pipe for %s\n", subs == capsubs ? "self" : "playpipe"); |
|---|
| 853 | | - if (0 > (err = usX2Y_urbs_start(capsubs))) |
|---|
| 831 | + if (0 > (err = usx2y_urbs_start(capsubs))) |
|---|
| 854 | 832 | goto up_prepare_mutex; |
|---|
| 855 | 833 | } |
|---|
| 856 | 834 | |
|---|
| 857 | | - if (subs != capsubs && atomic_read(&subs->state) < state_PREPARED) |
|---|
| 858 | | - err = usX2Y_urbs_start(subs); |
|---|
| 835 | + if (subs != capsubs && atomic_read(&subs->state) < STATE_PREPARED) |
|---|
| 836 | + err = usx2y_urbs_start(subs); |
|---|
| 859 | 837 | |
|---|
| 860 | 838 | up_prepare_mutex: |
|---|
| 861 | | - mutex_unlock(&usX2Y->pcm_mutex); |
|---|
| 839 | + mutex_unlock(&usx2y->pcm_mutex); |
|---|
| 862 | 840 | return err; |
|---|
| 863 | 841 | } |
|---|
| 864 | 842 | |
|---|
| 865 | | -static struct snd_pcm_hardware snd_usX2Y_2c = |
|---|
| 843 | +static const struct snd_pcm_hardware snd_usx2y_2c = |
|---|
| 866 | 844 | { |
|---|
| 867 | 845 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
|---|
| 868 | 846 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
|---|
| .. | .. |
|---|
| 884 | 862 | |
|---|
| 885 | 863 | |
|---|
| 886 | 864 | |
|---|
| 887 | | -static int snd_usX2Y_pcm_open(struct snd_pcm_substream *substream) |
|---|
| 865 | +static int snd_usx2y_pcm_open(struct snd_pcm_substream *substream) |
|---|
| 888 | 866 | { |
|---|
| 889 | | - struct snd_usX2Y_substream *subs = ((struct snd_usX2Y_substream **) |
|---|
| 867 | + struct snd_usx2y_substream *subs = ((struct snd_usx2y_substream **) |
|---|
| 890 | 868 | snd_pcm_substream_chip(substream))[substream->stream]; |
|---|
| 891 | 869 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 892 | 870 | |
|---|
| 893 | | - if (subs->usX2Y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) |
|---|
| 871 | + if (subs->usx2y->chip_status & USX2Y_STAT_CHIP_MMAP_PCM_URBS) |
|---|
| 894 | 872 | return -EBUSY; |
|---|
| 895 | 873 | |
|---|
| 896 | | - runtime->hw = snd_usX2Y_2c; |
|---|
| 874 | + runtime->hw = snd_usx2y_2c; |
|---|
| 897 | 875 | runtime->private_data = subs; |
|---|
| 898 | 876 | subs->pcm_substream = substream; |
|---|
| 899 | 877 | snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_TIME, 1000, 200000); |
|---|
| .. | .. |
|---|
| 902 | 880 | |
|---|
| 903 | 881 | |
|---|
| 904 | 882 | |
|---|
| 905 | | -static int snd_usX2Y_pcm_close(struct snd_pcm_substream *substream) |
|---|
| 883 | +static int snd_usx2y_pcm_close(struct snd_pcm_substream *substream) |
|---|
| 906 | 884 | { |
|---|
| 907 | 885 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 908 | | - struct snd_usX2Y_substream *subs = runtime->private_data; |
|---|
| 886 | + struct snd_usx2y_substream *subs = runtime->private_data; |
|---|
| 909 | 887 | |
|---|
| 910 | 888 | subs->pcm_substream = NULL; |
|---|
| 911 | 889 | |
|---|
| .. | .. |
|---|
| 913 | 891 | } |
|---|
| 914 | 892 | |
|---|
| 915 | 893 | |
|---|
| 916 | | -static const struct snd_pcm_ops snd_usX2Y_pcm_ops = |
|---|
| 894 | +static const struct snd_pcm_ops snd_usx2y_pcm_ops = |
|---|
| 917 | 895 | { |
|---|
| 918 | | - .open = snd_usX2Y_pcm_open, |
|---|
| 919 | | - .close = snd_usX2Y_pcm_close, |
|---|
| 920 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 921 | | - .hw_params = snd_usX2Y_pcm_hw_params, |
|---|
| 922 | | - .hw_free = snd_usX2Y_pcm_hw_free, |
|---|
| 923 | | - .prepare = snd_usX2Y_pcm_prepare, |
|---|
| 924 | | - .trigger = snd_usX2Y_pcm_trigger, |
|---|
| 925 | | - .pointer = snd_usX2Y_pcm_pointer, |
|---|
| 896 | + .open = snd_usx2y_pcm_open, |
|---|
| 897 | + .close = snd_usx2y_pcm_close, |
|---|
| 898 | + .hw_params = snd_usx2y_pcm_hw_params, |
|---|
| 899 | + .hw_free = snd_usx2y_pcm_hw_free, |
|---|
| 900 | + .prepare = snd_usx2y_pcm_prepare, |
|---|
| 901 | + .trigger = snd_usx2y_pcm_trigger, |
|---|
| 902 | + .pointer = snd_usx2y_pcm_pointer, |
|---|
| 926 | 903 | }; |
|---|
| 927 | 904 | |
|---|
| 928 | 905 | |
|---|
| 929 | 906 | /* |
|---|
| 930 | 907 | * free a usb stream instance |
|---|
| 931 | 908 | */ |
|---|
| 932 | | -static void usX2Y_audio_stream_free(struct snd_usX2Y_substream **usX2Y_substream) |
|---|
| 909 | +static void usx2y_audio_stream_free(struct snd_usx2y_substream **usx2y_substream) |
|---|
| 933 | 910 | { |
|---|
| 934 | | - kfree(usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]); |
|---|
| 935 | | - usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK] = NULL; |
|---|
| 911 | + int stream; |
|---|
| 936 | 912 | |
|---|
| 937 | | - kfree(usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]); |
|---|
| 938 | | - usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE] = NULL; |
|---|
| 913 | + for_each_pcm_streams(stream) { |
|---|
| 914 | + kfree(usx2y_substream[stream]); |
|---|
| 915 | + usx2y_substream[stream] = NULL; |
|---|
| 916 | + } |
|---|
| 939 | 917 | } |
|---|
| 940 | 918 | |
|---|
| 941 | | -static void snd_usX2Y_pcm_private_free(struct snd_pcm *pcm) |
|---|
| 919 | +static void snd_usx2y_pcm_private_free(struct snd_pcm *pcm) |
|---|
| 942 | 920 | { |
|---|
| 943 | | - struct snd_usX2Y_substream **usX2Y_stream = pcm->private_data; |
|---|
| 944 | | - if (usX2Y_stream) |
|---|
| 945 | | - usX2Y_audio_stream_free(usX2Y_stream); |
|---|
| 921 | + struct snd_usx2y_substream **usx2y_stream = pcm->private_data; |
|---|
| 922 | + if (usx2y_stream) |
|---|
| 923 | + usx2y_audio_stream_free(usx2y_stream); |
|---|
| 946 | 924 | } |
|---|
| 947 | 925 | |
|---|
| 948 | | -static int usX2Y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint) |
|---|
| 926 | +static int usx2y_audio_stream_new(struct snd_card *card, int playback_endpoint, int capture_endpoint) |
|---|
| 949 | 927 | { |
|---|
| 950 | 928 | struct snd_pcm *pcm; |
|---|
| 951 | 929 | int err, i; |
|---|
| 952 | | - struct snd_usX2Y_substream **usX2Y_substream = |
|---|
| 953 | | - usX2Y(card)->subs + 2 * usX2Y(card)->pcm_devs; |
|---|
| 930 | + struct snd_usx2y_substream **usx2y_substream = |
|---|
| 931 | + usx2y(card)->subs + 2 * usx2y(card)->pcm_devs; |
|---|
| 954 | 932 | |
|---|
| 955 | 933 | for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; |
|---|
| 956 | 934 | i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { |
|---|
| 957 | | - usX2Y_substream[i] = kzalloc(sizeof(struct snd_usX2Y_substream), GFP_KERNEL); |
|---|
| 958 | | - if (!usX2Y_substream[i]) |
|---|
| 935 | + usx2y_substream[i] = kzalloc(sizeof(struct snd_usx2y_substream), GFP_KERNEL); |
|---|
| 936 | + if (!usx2y_substream[i]) |
|---|
| 959 | 937 | return -ENOMEM; |
|---|
| 960 | 938 | |
|---|
| 961 | | - usX2Y_substream[i]->usX2Y = usX2Y(card); |
|---|
| 939 | + usx2y_substream[i]->usx2y = usx2y(card); |
|---|
| 962 | 940 | } |
|---|
| 963 | 941 | |
|---|
| 964 | 942 | if (playback_endpoint) |
|---|
| 965 | | - usX2Y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; |
|---|
| 966 | | - usX2Y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; |
|---|
| 943 | + usx2y_substream[SNDRV_PCM_STREAM_PLAYBACK]->endpoint = playback_endpoint; |
|---|
| 944 | + usx2y_substream[SNDRV_PCM_STREAM_CAPTURE]->endpoint = capture_endpoint; |
|---|
| 967 | 945 | |
|---|
| 968 | | - err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usX2Y(card)->pcm_devs, |
|---|
| 946 | + err = snd_pcm_new(card, NAME_ALLCAPS" Audio", usx2y(card)->pcm_devs, |
|---|
| 969 | 947 | playback_endpoint ? 1 : 0, 1, |
|---|
| 970 | 948 | &pcm); |
|---|
| 971 | 949 | if (err < 0) { |
|---|
| 972 | | - usX2Y_audio_stream_free(usX2Y_substream); |
|---|
| 950 | + usx2y_audio_stream_free(usx2y_substream); |
|---|
| 973 | 951 | return err; |
|---|
| 974 | 952 | } |
|---|
| 975 | 953 | |
|---|
| 976 | 954 | if (playback_endpoint) |
|---|
| 977 | | - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_usX2Y_pcm_ops); |
|---|
| 978 | | - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usX2Y_pcm_ops); |
|---|
| 955 | + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_usx2y_pcm_ops); |
|---|
| 956 | + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_usx2y_pcm_ops); |
|---|
| 979 | 957 | |
|---|
| 980 | | - pcm->private_data = usX2Y_substream; |
|---|
| 981 | | - pcm->private_free = snd_usX2Y_pcm_private_free; |
|---|
| 958 | + pcm->private_data = usx2y_substream; |
|---|
| 959 | + pcm->private_free = snd_usx2y_pcm_private_free; |
|---|
| 982 | 960 | pcm->info_flags = 0; |
|---|
| 983 | 961 | |
|---|
| 984 | | - sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usX2Y(card)->pcm_devs); |
|---|
| 962 | + sprintf(pcm->name, NAME_ALLCAPS" Audio #%d", usx2y(card)->pcm_devs); |
|---|
| 985 | 963 | |
|---|
| 986 | | - if ((playback_endpoint && |
|---|
| 987 | | - 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
|---|
| 988 | | - SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 989 | | - snd_dma_continuous_data(GFP_KERNEL), |
|---|
| 990 | | - 64*1024, 128*1024))) || |
|---|
| 991 | | - 0 > (err = snd_pcm_lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, |
|---|
| 992 | | - SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 993 | | - snd_dma_continuous_data(GFP_KERNEL), |
|---|
| 994 | | - 64*1024, 128*1024))) { |
|---|
| 995 | | - snd_usX2Y_pcm_private_free(pcm); |
|---|
| 996 | | - return err; |
|---|
| 964 | + if (playback_endpoint) { |
|---|
| 965 | + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream, |
|---|
| 966 | + SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 967 | + NULL, |
|---|
| 968 | + 64*1024, 128*1024); |
|---|
| 997 | 969 | } |
|---|
| 998 | | - usX2Y(card)->pcm_devs++; |
|---|
| 970 | + |
|---|
| 971 | + snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, |
|---|
| 972 | + SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 973 | + NULL, |
|---|
| 974 | + 64*1024, 128*1024); |
|---|
| 975 | + usx2y(card)->pcm_devs++; |
|---|
| 999 | 976 | |
|---|
| 1000 | 977 | return 0; |
|---|
| 1001 | 978 | } |
|---|
| .. | .. |
|---|
| 1003 | 980 | /* |
|---|
| 1004 | 981 | * create a chip instance and set its names. |
|---|
| 1005 | 982 | */ |
|---|
| 1006 | | -int usX2Y_audio_create(struct snd_card *card) |
|---|
| 983 | +int usx2y_audio_create(struct snd_card *card) |
|---|
| 1007 | 984 | { |
|---|
| 1008 | 985 | int err = 0; |
|---|
| 1009 | 986 | |
|---|
| 1010 | | - INIT_LIST_HEAD(&usX2Y(card)->pcm_list); |
|---|
| 987 | + INIT_LIST_HEAD(&usx2y(card)->pcm_list); |
|---|
| 1011 | 988 | |
|---|
| 1012 | | - if (0 > (err = usX2Y_audio_stream_new(card, 0xA, 0x8))) |
|---|
| 989 | + if (0 > (err = usx2y_audio_stream_new(card, 0xA, 0x8))) |
|---|
| 1013 | 990 | return err; |
|---|
| 1014 | | - if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) == USB_ID_US428) |
|---|
| 1015 | | - if (0 > (err = usX2Y_audio_stream_new(card, 0, 0xA))) |
|---|
| 991 | + if (le16_to_cpu(usx2y(card)->dev->descriptor.idProduct) == USB_ID_US428) |
|---|
| 992 | + if (0 > (err = usx2y_audio_stream_new(card, 0, 0xA))) |
|---|
| 1016 | 993 | return err; |
|---|
| 1017 | | - if (le16_to_cpu(usX2Y(card)->dev->descriptor.idProduct) != USB_ID_US122) |
|---|
| 1018 | | - err = usX2Y_rate_set(usX2Y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. |
|---|
| 994 | + if (le16_to_cpu(usx2y(card)->dev->descriptor.idProduct) != USB_ID_US122) |
|---|
| 995 | + err = usx2y_rate_set(usx2y(card), 44100); // Lets us428 recognize output-volume settings, disturbs us122. |
|---|
| 1019 | 996 | return err; |
|---|
| 1020 | 997 | } |
|---|