diff options
Diffstat (limited to 'sound/drivers/vx/vx_pcm.c')
-rw-r--r-- | sound/drivers/vx/vx_pcm.c | 200 |
1 files changed, 110 insertions, 90 deletions
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index 2b46758fe86f..464109e421d4 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c | |||
@@ -61,7 +61,8 @@ | |||
61 | */ | 61 | */ |
62 | 62 | ||
63 | /* get the physical page pointer on the given offset */ | 63 | /* get the physical page pointer on the given offset */ |
64 | static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, unsigned long offset) | 64 | static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, |
65 | unsigned long offset) | ||
65 | { | 66 | { |
66 | void *pageptr = subs->runtime->dma_area + offset; | 67 | void *pageptr = subs->runtime->dma_area + offset; |
67 | return vmalloc_to_page(pageptr); | 68 | return vmalloc_to_page(pageptr); |
@@ -72,9 +73,9 @@ static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, unsigned | |||
72 | * called from hw_params | 73 | * called from hw_params |
73 | * NOTE: this may be called not only once per pcm open! | 74 | * NOTE: this may be called not only once per pcm open! |
74 | */ | 75 | */ |
75 | static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) | 76 | static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size) |
76 | { | 77 | { |
77 | snd_pcm_runtime_t *runtime = subs->runtime; | 78 | struct snd_pcm_runtime *runtime = subs->runtime; |
78 | if (runtime->dma_area) { | 79 | if (runtime->dma_area) { |
79 | /* already allocated */ | 80 | /* already allocated */ |
80 | if (runtime->dma_bytes >= size) | 81 | if (runtime->dma_bytes >= size) |
@@ -94,9 +95,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size) | |||
94 | * called from hw_free callback | 95 | * called from hw_free callback |
95 | * NOTE: this may be called not only once per pcm open! | 96 | * NOTE: this may be called not only once per pcm open! |
96 | */ | 97 | */ |
97 | static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) | 98 | static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs) |
98 | { | 99 | { |
99 | snd_pcm_runtime_t *runtime = subs->runtime; | 100 | struct snd_pcm_runtime *runtime = subs->runtime; |
100 | if (runtime->dma_area) { | 101 | if (runtime->dma_area) { |
101 | vfree(runtime->dma_area); | 102 | vfree(runtime->dma_area); |
102 | runtime->dma_area = NULL; | 103 | runtime->dma_area = NULL; |
@@ -108,7 +109,8 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs) | |||
108 | /* | 109 | /* |
109 | * read three pending pcm bytes via inb() | 110 | * read three pending pcm bytes via inb() |
110 | */ | 111 | */ |
111 | static void vx_pcm_read_per_bytes(vx_core_t *chip, snd_pcm_runtime_t *runtime, vx_pipe_t *pipe) | 112 | static void vx_pcm_read_per_bytes(struct vx_core *chip, struct snd_pcm_runtime *runtime, |
113 | struct vx_pipe *pipe) | ||
112 | { | 114 | { |
113 | int offset = pipe->hw_ptr; | 115 | int offset = pipe->hw_ptr; |
114 | unsigned char *buf = (unsigned char *)(runtime->dma_area + offset); | 116 | unsigned char *buf = (unsigned char *)(runtime->dma_area + offset); |
@@ -135,7 +137,8 @@ static void vx_pcm_read_per_bytes(vx_core_t *chip, snd_pcm_runtime_t *runtime, v | |||
135 | * @pc_time: the pointer for the PC-time to set | 137 | * @pc_time: the pointer for the PC-time to set |
136 | * @dsp_time: the pointer for RMH status time array | 138 | * @dsp_time: the pointer for RMH status time array |
137 | */ | 139 | */ |
138 | static void vx_set_pcx_time(vx_core_t *chip, pcx_time_t *pc_time, unsigned int *dsp_time) | 140 | static void vx_set_pcx_time(struct vx_core *chip, pcx_time_t *pc_time, |
141 | unsigned int *dsp_time) | ||
139 | { | 142 | { |
140 | dsp_time[0] = (unsigned int)((*pc_time) >> 24) & PCX_TIME_HI_MASK; | 143 | dsp_time[0] = (unsigned int)((*pc_time) >> 24) & PCX_TIME_HI_MASK; |
141 | dsp_time[1] = (unsigned int)(*pc_time) & MASK_DSP_WORD; | 144 | dsp_time[1] = (unsigned int)(*pc_time) & MASK_DSP_WORD; |
@@ -151,7 +154,8 @@ static void vx_set_pcx_time(vx_core_t *chip, pcx_time_t *pc_time, unsigned int * | |||
151 | * | 154 | * |
152 | * returns the increase of the command length. | 155 | * returns the increase of the command length. |
153 | */ | 156 | */ |
154 | static int vx_set_differed_time(vx_core_t *chip, struct vx_rmh *rmh, vx_pipe_t *pipe) | 157 | static int vx_set_differed_time(struct vx_core *chip, struct vx_rmh *rmh, |
158 | struct vx_pipe *pipe) | ||
155 | { | 159 | { |
156 | /* Update The length added to the RMH command by the timestamp */ | 160 | /* Update The length added to the RMH command by the timestamp */ |
157 | if (! (pipe->differed_type & DC_DIFFERED_DELAY)) | 161 | if (! (pipe->differed_type & DC_DIFFERED_DELAY)) |
@@ -184,7 +188,8 @@ static int vx_set_differed_time(vx_core_t *chip, struct vx_rmh *rmh, vx_pipe_t * | |||
184 | * @pipe: the affected pipe | 188 | * @pipe: the affected pipe |
185 | * @data: format bitmask | 189 | * @data: format bitmask |
186 | */ | 190 | */ |
187 | static int vx_set_stream_format(vx_core_t *chip, vx_pipe_t *pipe, unsigned int data) | 191 | static int vx_set_stream_format(struct vx_core *chip, struct vx_pipe *pipe, |
192 | unsigned int data) | ||
188 | { | 193 | { |
189 | struct vx_rmh rmh; | 194 | struct vx_rmh rmh; |
190 | 195 | ||
@@ -210,8 +215,8 @@ static int vx_set_stream_format(vx_core_t *chip, vx_pipe_t *pipe, unsigned int d | |||
210 | * | 215 | * |
211 | * returns 0 if successful, or a negative error code. | 216 | * returns 0 if successful, or a negative error code. |
212 | */ | 217 | */ |
213 | static int vx_set_format(vx_core_t *chip, vx_pipe_t *pipe, | 218 | static int vx_set_format(struct vx_core *chip, struct vx_pipe *pipe, |
214 | snd_pcm_runtime_t *runtime) | 219 | struct snd_pcm_runtime *runtime) |
215 | { | 220 | { |
216 | unsigned int header = HEADER_FMT_BASE; | 221 | unsigned int header = HEADER_FMT_BASE; |
217 | 222 | ||
@@ -239,7 +244,7 @@ static int vx_set_format(vx_core_t *chip, vx_pipe_t *pipe, | |||
239 | /* | 244 | /* |
240 | * set / query the IBL size | 245 | * set / query the IBL size |
241 | */ | 246 | */ |
242 | static int vx_set_ibl(vx_core_t *chip, struct vx_ibl_info *info) | 247 | static int vx_set_ibl(struct vx_core *chip, struct vx_ibl_info *info) |
243 | { | 248 | { |
244 | int err; | 249 | int err; |
245 | struct vx_rmh rmh; | 250 | struct vx_rmh rmh; |
@@ -269,7 +274,7 @@ static int vx_set_ibl(vx_core_t *chip, struct vx_ibl_info *info) | |||
269 | * | 274 | * |
270 | * called from trigger callback only | 275 | * called from trigger callback only |
271 | */ | 276 | */ |
272 | static int vx_get_pipe_state(vx_core_t *chip, vx_pipe_t *pipe, int *state) | 277 | static int vx_get_pipe_state(struct vx_core *chip, struct vx_pipe *pipe, int *state) |
273 | { | 278 | { |
274 | int err; | 279 | int err; |
275 | struct vx_rmh rmh; | 280 | struct vx_rmh rmh; |
@@ -294,7 +299,7 @@ static int vx_get_pipe_state(vx_core_t *chip, vx_pipe_t *pipe, int *state) | |||
294 | * you'll need to disconnect the host to get back to the | 299 | * you'll need to disconnect the host to get back to the |
295 | * normal mode. | 300 | * normal mode. |
296 | */ | 301 | */ |
297 | static int vx_query_hbuffer_size(vx_core_t *chip, vx_pipe_t *pipe) | 302 | static int vx_query_hbuffer_size(struct vx_core *chip, struct vx_pipe *pipe) |
298 | { | 303 | { |
299 | int result; | 304 | int result; |
300 | struct vx_rmh rmh; | 305 | struct vx_rmh rmh; |
@@ -318,7 +323,7 @@ static int vx_query_hbuffer_size(vx_core_t *chip, vx_pipe_t *pipe) | |||
318 | * | 323 | * |
319 | * called from trigger callback only | 324 | * called from trigger callback only |
320 | */ | 325 | */ |
321 | static int vx_pipe_can_start(vx_core_t *chip, vx_pipe_t *pipe) | 326 | static int vx_pipe_can_start(struct vx_core *chip, struct vx_pipe *pipe) |
322 | { | 327 | { |
323 | int err; | 328 | int err; |
324 | struct vx_rmh rmh; | 329 | struct vx_rmh rmh; |
@@ -339,7 +344,7 @@ static int vx_pipe_can_start(vx_core_t *chip, vx_pipe_t *pipe) | |||
339 | * vx_conf_pipe - tell the pipe to stand by and wait for IRQA. | 344 | * vx_conf_pipe - tell the pipe to stand by and wait for IRQA. |
340 | * @pipe: the pipe to be configured | 345 | * @pipe: the pipe to be configured |
341 | */ | 346 | */ |
342 | static int vx_conf_pipe(vx_core_t *chip, vx_pipe_t *pipe) | 347 | static int vx_conf_pipe(struct vx_core *chip, struct vx_pipe *pipe) |
343 | { | 348 | { |
344 | struct vx_rmh rmh; | 349 | struct vx_rmh rmh; |
345 | 350 | ||
@@ -353,7 +358,7 @@ static int vx_conf_pipe(vx_core_t *chip, vx_pipe_t *pipe) | |||
353 | /* | 358 | /* |
354 | * vx_send_irqa - trigger IRQA | 359 | * vx_send_irqa - trigger IRQA |
355 | */ | 360 | */ |
356 | static int vx_send_irqa(vx_core_t *chip) | 361 | static int vx_send_irqa(struct vx_core *chip) |
357 | { | 362 | { |
358 | struct vx_rmh rmh; | 363 | struct vx_rmh rmh; |
359 | 364 | ||
@@ -378,7 +383,7 @@ static int vx_send_irqa(vx_core_t *chip) | |||
378 | * called from trigger callback only | 383 | * called from trigger callback only |
379 | * | 384 | * |
380 | */ | 385 | */ |
381 | static int vx_toggle_pipe(vx_core_t *chip, vx_pipe_t *pipe, int state) | 386 | static int vx_toggle_pipe(struct vx_core *chip, struct vx_pipe *pipe, int state) |
382 | { | 387 | { |
383 | int err, i, cur_state; | 388 | int err, i, cur_state; |
384 | 389 | ||
@@ -431,7 +436,7 @@ static int vx_toggle_pipe(vx_core_t *chip, vx_pipe_t *pipe, int state) | |||
431 | * | 436 | * |
432 | * called from trigger callback only | 437 | * called from trigger callback only |
433 | */ | 438 | */ |
434 | static int vx_stop_pipe(vx_core_t *chip, vx_pipe_t *pipe) | 439 | static int vx_stop_pipe(struct vx_core *chip, struct vx_pipe *pipe) |
435 | { | 440 | { |
436 | struct vx_rmh rmh; | 441 | struct vx_rmh rmh; |
437 | vx_init_rmh(&rmh, CMD_STOP_PIPE); | 442 | vx_init_rmh(&rmh, CMD_STOP_PIPE); |
@@ -449,12 +454,12 @@ static int vx_stop_pipe(vx_core_t *chip, vx_pipe_t *pipe) | |||
449 | * | 454 | * |
450 | * return 0 on success, or a negative error code. | 455 | * return 0 on success, or a negative error code. |
451 | */ | 456 | */ |
452 | static int vx_alloc_pipe(vx_core_t *chip, int capture, | 457 | static int vx_alloc_pipe(struct vx_core *chip, int capture, |
453 | int audioid, int num_audio, | 458 | int audioid, int num_audio, |
454 | vx_pipe_t **pipep) | 459 | struct vx_pipe **pipep) |
455 | { | 460 | { |
456 | int err; | 461 | int err; |
457 | vx_pipe_t *pipe; | 462 | struct vx_pipe *pipe; |
458 | struct vx_rmh rmh; | 463 | struct vx_rmh rmh; |
459 | int data_mode; | 464 | int data_mode; |
460 | 465 | ||
@@ -499,7 +504,7 @@ static int vx_alloc_pipe(vx_core_t *chip, int capture, | |||
499 | * vx_free_pipe - release a pipe | 504 | * vx_free_pipe - release a pipe |
500 | * @pipe: pipe to be released | 505 | * @pipe: pipe to be released |
501 | */ | 506 | */ |
502 | static int vx_free_pipe(vx_core_t *chip, vx_pipe_t *pipe) | 507 | static int vx_free_pipe(struct vx_core *chip, struct vx_pipe *pipe) |
503 | { | 508 | { |
504 | struct vx_rmh rmh; | 509 | struct vx_rmh rmh; |
505 | 510 | ||
@@ -517,7 +522,7 @@ static int vx_free_pipe(vx_core_t *chip, vx_pipe_t *pipe) | |||
517 | * | 522 | * |
518 | * called from trigger callback only | 523 | * called from trigger callback only |
519 | */ | 524 | */ |
520 | static int vx_start_stream(vx_core_t *chip, vx_pipe_t *pipe) | 525 | static int vx_start_stream(struct vx_core *chip, struct vx_pipe *pipe) |
521 | { | 526 | { |
522 | struct vx_rmh rmh; | 527 | struct vx_rmh rmh; |
523 | 528 | ||
@@ -533,7 +538,7 @@ static int vx_start_stream(vx_core_t *chip, vx_pipe_t *pipe) | |||
533 | * | 538 | * |
534 | * called from trigger callback only | 539 | * called from trigger callback only |
535 | */ | 540 | */ |
536 | static int vx_stop_stream(vx_core_t *chip, vx_pipe_t *pipe) | 541 | static int vx_stop_stream(struct vx_core *chip, struct vx_pipe *pipe) |
537 | { | 542 | { |
538 | struct vx_rmh rmh; | 543 | struct vx_rmh rmh; |
539 | 544 | ||
@@ -547,11 +552,12 @@ static int vx_stop_stream(vx_core_t *chip, vx_pipe_t *pipe) | |||
547 | * playback hw information | 552 | * playback hw information |
548 | */ | 553 | */ |
549 | 554 | ||
550 | static snd_pcm_hardware_t vx_pcm_playback_hw = { | 555 | static struct snd_pcm_hardware vx_pcm_playback_hw = { |
551 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 556 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
552 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ | 557 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ |
553 | /*SNDRV_PCM_INFO_RESUME*/), | 558 | /*SNDRV_PCM_INFO_RESUME*/), |
554 | .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, | 559 | .formats = (/*SNDRV_PCM_FMTBIT_U8 |*/ |
560 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE), | ||
555 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 561 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
556 | .rate_min = 5000, | 562 | .rate_min = 5000, |
557 | .rate_max = 48000, | 563 | .rate_max = 48000, |
@@ -571,11 +577,11 @@ static void vx_pcm_delayed_start(unsigned long arg); | |||
571 | /* | 577 | /* |
572 | * vx_pcm_playback_open - open callback for playback | 578 | * vx_pcm_playback_open - open callback for playback |
573 | */ | 579 | */ |
574 | static int vx_pcm_playback_open(snd_pcm_substream_t *subs) | 580 | static int vx_pcm_playback_open(struct snd_pcm_substream *subs) |
575 | { | 581 | { |
576 | snd_pcm_runtime_t *runtime = subs->runtime; | 582 | struct snd_pcm_runtime *runtime = subs->runtime; |
577 | vx_core_t *chip = snd_pcm_substream_chip(subs); | 583 | struct vx_core *chip = snd_pcm_substream_chip(subs); |
578 | vx_pipe_t *pipe = NULL; | 584 | struct vx_pipe *pipe = NULL; |
579 | unsigned int audio; | 585 | unsigned int audio; |
580 | int err; | 586 | int err; |
581 | 587 | ||
@@ -615,10 +621,10 @@ static int vx_pcm_playback_open(snd_pcm_substream_t *subs) | |||
615 | /* | 621 | /* |
616 | * vx_pcm_playback_close - close callback for playback | 622 | * vx_pcm_playback_close - close callback for playback |
617 | */ | 623 | */ |
618 | static int vx_pcm_playback_close(snd_pcm_substream_t *subs) | 624 | static int vx_pcm_playback_close(struct snd_pcm_substream *subs) |
619 | { | 625 | { |
620 | vx_core_t *chip = snd_pcm_substream_chip(subs); | 626 | struct vx_core *chip = snd_pcm_substream_chip(subs); |
621 | vx_pipe_t *pipe; | 627 | struct vx_pipe *pipe; |
622 | 628 | ||
623 | if (! subs->runtime->private_data) | 629 | if (! subs->runtime->private_data) |
624 | return -EINVAL; | 630 | return -EINVAL; |
@@ -641,7 +647,7 @@ static int vx_pcm_playback_close(snd_pcm_substream_t *subs) | |||
641 | * | 647 | * |
642 | * NB: call with a certain lock. | 648 | * NB: call with a certain lock. |
643 | */ | 649 | */ |
644 | static int vx_notify_end_of_buffer(vx_core_t *chip, vx_pipe_t *pipe) | 650 | static int vx_notify_end_of_buffer(struct vx_core *chip, struct vx_pipe *pipe) |
645 | { | 651 | { |
646 | int err; | 652 | int err; |
647 | struct vx_rmh rmh; /* use a temporary rmh here */ | 653 | struct vx_rmh rmh; /* use a temporary rmh here */ |
@@ -669,7 +675,9 @@ static int vx_notify_end_of_buffer(vx_core_t *chip, vx_pipe_t *pipe) | |||
669 | * | 675 | * |
670 | * return 0 if ok. | 676 | * return 0 if ok. |
671 | */ | 677 | */ |
672 | static int vx_pcm_playback_transfer_chunk(vx_core_t *chip, snd_pcm_runtime_t *runtime, vx_pipe_t *pipe, int size) | 678 | static int vx_pcm_playback_transfer_chunk(struct vx_core *chip, |
679 | struct snd_pcm_runtime *runtime, | ||
680 | struct vx_pipe *pipe, int size) | ||
673 | { | 681 | { |
674 | int space, err = 0; | 682 | int space, err = 0; |
675 | 683 | ||
@@ -705,7 +713,9 @@ static int vx_pcm_playback_transfer_chunk(vx_core_t *chip, snd_pcm_runtime_t *ru | |||
705 | * so that the caller can check the total transferred size later | 713 | * so that the caller can check the total transferred size later |
706 | * (to call snd_pcm_period_elapsed). | 714 | * (to call snd_pcm_period_elapsed). |
707 | */ | 715 | */ |
708 | static int vx_update_pipe_position(vx_core_t *chip, snd_pcm_runtime_t *runtime, vx_pipe_t *pipe) | 716 | static int vx_update_pipe_position(struct vx_core *chip, |
717 | struct snd_pcm_runtime *runtime, | ||
718 | struct vx_pipe *pipe) | ||
709 | { | 719 | { |
710 | struct vx_rmh rmh; | 720 | struct vx_rmh rmh; |
711 | int err, update; | 721 | int err, update; |
@@ -731,10 +741,12 @@ static int vx_update_pipe_position(vx_core_t *chip, snd_pcm_runtime_t *runtime, | |||
731 | * transfer the pending playback buffer data to DSP | 741 | * transfer the pending playback buffer data to DSP |
732 | * called from interrupt handler | 742 | * called from interrupt handler |
733 | */ | 743 | */ |
734 | static void vx_pcm_playback_transfer(vx_core_t *chip, snd_pcm_substream_t *subs, vx_pipe_t *pipe, int nchunks) | 744 | static void vx_pcm_playback_transfer(struct vx_core *chip, |
745 | struct snd_pcm_substream *subs, | ||
746 | struct vx_pipe *pipe, int nchunks) | ||
735 | { | 747 | { |
736 | int i, err; | 748 | int i, err; |
737 | snd_pcm_runtime_t *runtime = subs->runtime; | 749 | struct snd_pcm_runtime *runtime = subs->runtime; |
738 | 750 | ||
739 | if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) | 751 | if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) |
740 | return; | 752 | return; |
@@ -749,10 +761,12 @@ static void vx_pcm_playback_transfer(vx_core_t *chip, snd_pcm_substream_t *subs, | |||
749 | * update the playback position and call snd_pcm_period_elapsed() if necessary | 761 | * update the playback position and call snd_pcm_period_elapsed() if necessary |
750 | * called from interrupt handler | 762 | * called from interrupt handler |
751 | */ | 763 | */ |
752 | static void vx_pcm_playback_update(vx_core_t *chip, snd_pcm_substream_t *subs, vx_pipe_t *pipe) | 764 | static void vx_pcm_playback_update(struct vx_core *chip, |
765 | struct snd_pcm_substream *subs, | ||
766 | struct vx_pipe *pipe) | ||
753 | { | 767 | { |
754 | int err; | 768 | int err; |
755 | snd_pcm_runtime_t *runtime = subs->runtime; | 769 | struct snd_pcm_runtime *runtime = subs->runtime; |
756 | 770 | ||
757 | if (pipe->running && ! (chip->chip_status & VX_STAT_IS_STALE)) { | 771 | if (pipe->running && ! (chip->chip_status & VX_STAT_IS_STALE)) { |
758 | if ((err = vx_update_pipe_position(chip, runtime, pipe)) < 0) | 772 | if ((err = vx_update_pipe_position(chip, runtime, pipe)) < 0) |
@@ -771,9 +785,9 @@ static void vx_pcm_playback_update(vx_core_t *chip, snd_pcm_substream_t *subs, v | |||
771 | */ | 785 | */ |
772 | static void vx_pcm_delayed_start(unsigned long arg) | 786 | static void vx_pcm_delayed_start(unsigned long arg) |
773 | { | 787 | { |
774 | snd_pcm_substream_t *subs = (snd_pcm_substream_t *)arg; | 788 | struct snd_pcm_substream *subs = (struct snd_pcm_substream *)arg; |
775 | vx_core_t *chip = subs->pcm->private_data; | 789 | struct vx_core *chip = subs->pcm->private_data; |
776 | vx_pipe_t *pipe = subs->runtime->private_data; | 790 | struct vx_pipe *pipe = subs->runtime->private_data; |
777 | int err; | 791 | int err; |
778 | 792 | ||
779 | /* printk( KERN_DEBUG "DDDD tasklet delayed start jiffies = %ld\n", jiffies);*/ | 793 | /* printk( KERN_DEBUG "DDDD tasklet delayed start jiffies = %ld\n", jiffies);*/ |
@@ -792,10 +806,10 @@ static void vx_pcm_delayed_start(unsigned long arg) | |||
792 | /* | 806 | /* |
793 | * vx_pcm_playback_trigger - trigger callback for playback | 807 | * vx_pcm_playback_trigger - trigger callback for playback |
794 | */ | 808 | */ |
795 | static int vx_pcm_trigger(snd_pcm_substream_t *subs, int cmd) | 809 | static int vx_pcm_trigger(struct snd_pcm_substream *subs, int cmd) |
796 | { | 810 | { |
797 | vx_core_t *chip = snd_pcm_substream_chip(subs); | 811 | struct vx_core *chip = snd_pcm_substream_chip(subs); |
798 | vx_pipe_t *pipe = subs->runtime->private_data; | 812 | struct vx_pipe *pipe = subs->runtime->private_data; |
799 | int err; | 813 | int err; |
800 | 814 | ||
801 | if (chip->chip_status & VX_STAT_IS_STALE) | 815 | if (chip->chip_status & VX_STAT_IS_STALE) |
@@ -839,18 +853,18 @@ static int vx_pcm_trigger(snd_pcm_substream_t *subs, int cmd) | |||
839 | /* | 853 | /* |
840 | * vx_pcm_playback_pointer - pointer callback for playback | 854 | * vx_pcm_playback_pointer - pointer callback for playback |
841 | */ | 855 | */ |
842 | static snd_pcm_uframes_t vx_pcm_playback_pointer(snd_pcm_substream_t *subs) | 856 | static snd_pcm_uframes_t vx_pcm_playback_pointer(struct snd_pcm_substream *subs) |
843 | { | 857 | { |
844 | snd_pcm_runtime_t *runtime = subs->runtime; | 858 | struct snd_pcm_runtime *runtime = subs->runtime; |
845 | vx_pipe_t *pipe = runtime->private_data; | 859 | struct vx_pipe *pipe = runtime->private_data; |
846 | return pipe->position; | 860 | return pipe->position; |
847 | } | 861 | } |
848 | 862 | ||
849 | /* | 863 | /* |
850 | * vx_pcm_hw_params - hw_params callback for playback and capture | 864 | * vx_pcm_hw_params - hw_params callback for playback and capture |
851 | */ | 865 | */ |
852 | static int vx_pcm_hw_params(snd_pcm_substream_t *subs, | 866 | static int vx_pcm_hw_params(struct snd_pcm_substream *subs, |
853 | snd_pcm_hw_params_t *hw_params) | 867 | struct snd_pcm_hw_params *hw_params) |
854 | { | 868 | { |
855 | return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params)); | 869 | return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params)); |
856 | } | 870 | } |
@@ -858,7 +872,7 @@ static int vx_pcm_hw_params(snd_pcm_substream_t *subs, | |||
858 | /* | 872 | /* |
859 | * vx_pcm_hw_free - hw_free callback for playback and capture | 873 | * vx_pcm_hw_free - hw_free callback for playback and capture |
860 | */ | 874 | */ |
861 | static int vx_pcm_hw_free(snd_pcm_substream_t *subs) | 875 | static int vx_pcm_hw_free(struct snd_pcm_substream *subs) |
862 | { | 876 | { |
863 | return snd_pcm_free_vmalloc_buffer(subs); | 877 | return snd_pcm_free_vmalloc_buffer(subs); |
864 | } | 878 | } |
@@ -866,11 +880,11 @@ static int vx_pcm_hw_free(snd_pcm_substream_t *subs) | |||
866 | /* | 880 | /* |
867 | * vx_pcm_prepare - prepare callback for playback and capture | 881 | * vx_pcm_prepare - prepare callback for playback and capture |
868 | */ | 882 | */ |
869 | static int vx_pcm_prepare(snd_pcm_substream_t *subs) | 883 | static int vx_pcm_prepare(struct snd_pcm_substream *subs) |
870 | { | 884 | { |
871 | vx_core_t *chip = snd_pcm_substream_chip(subs); | 885 | struct vx_core *chip = snd_pcm_substream_chip(subs); |
872 | snd_pcm_runtime_t *runtime = subs->runtime; | 886 | struct snd_pcm_runtime *runtime = subs->runtime; |
873 | vx_pipe_t *pipe = runtime->private_data; | 887 | struct vx_pipe *pipe = runtime->private_data; |
874 | int err, data_mode; | 888 | int err, data_mode; |
875 | // int max_size, nchunks; | 889 | // int max_size, nchunks; |
876 | 890 | ||
@@ -897,7 +911,8 @@ static int vx_pcm_prepare(snd_pcm_substream_t *subs) | |||
897 | } | 911 | } |
898 | 912 | ||
899 | if (chip->pcm_running && chip->freq != runtime->rate) { | 913 | if (chip->pcm_running && chip->freq != runtime->rate) { |
900 | snd_printk(KERN_ERR "vx: cannot set different clock %d from the current %d\n", runtime->rate, chip->freq); | 914 | snd_printk(KERN_ERR "vx: cannot set different clock %d " |
915 | "from the current %d\n", runtime->rate, chip->freq); | ||
901 | return -EINVAL; | 916 | return -EINVAL; |
902 | } | 917 | } |
903 | vx_set_clock(chip, runtime->rate); | 918 | vx_set_clock(chip, runtime->rate); |
@@ -930,7 +945,7 @@ static int vx_pcm_prepare(snd_pcm_substream_t *subs) | |||
930 | /* | 945 | /* |
931 | * operators for PCM playback | 946 | * operators for PCM playback |
932 | */ | 947 | */ |
933 | static snd_pcm_ops_t vx_pcm_playback_ops = { | 948 | static struct snd_pcm_ops vx_pcm_playback_ops = { |
934 | .open = vx_pcm_playback_open, | 949 | .open = vx_pcm_playback_open, |
935 | .close = vx_pcm_playback_close, | 950 | .close = vx_pcm_playback_close, |
936 | .ioctl = snd_pcm_lib_ioctl, | 951 | .ioctl = snd_pcm_lib_ioctl, |
@@ -947,11 +962,12 @@ static snd_pcm_ops_t vx_pcm_playback_ops = { | |||
947 | * playback hw information | 962 | * playback hw information |
948 | */ | 963 | */ |
949 | 964 | ||
950 | static snd_pcm_hardware_t vx_pcm_capture_hw = { | 965 | static struct snd_pcm_hardware vx_pcm_capture_hw = { |
951 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 966 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
952 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ | 967 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_MMAP_VALID /*|*/ |
953 | /*SNDRV_PCM_INFO_RESUME*/), | 968 | /*SNDRV_PCM_INFO_RESUME*/), |
954 | .formats = /*SNDRV_PCM_FMTBIT_U8 |*/ SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE, | 969 | .formats = (/*SNDRV_PCM_FMTBIT_U8 |*/ |
970 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_3LE), | ||
955 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, | 971 | .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, |
956 | .rate_min = 5000, | 972 | .rate_min = 5000, |
957 | .rate_max = 48000, | 973 | .rate_max = 48000, |
@@ -969,12 +985,12 @@ static snd_pcm_hardware_t vx_pcm_capture_hw = { | |||
969 | /* | 985 | /* |
970 | * vx_pcm_capture_open - open callback for capture | 986 | * vx_pcm_capture_open - open callback for capture |
971 | */ | 987 | */ |
972 | static int vx_pcm_capture_open(snd_pcm_substream_t *subs) | 988 | static int vx_pcm_capture_open(struct snd_pcm_substream *subs) |
973 | { | 989 | { |
974 | snd_pcm_runtime_t *runtime = subs->runtime; | 990 | struct snd_pcm_runtime *runtime = subs->runtime; |
975 | vx_core_t *chip = snd_pcm_substream_chip(subs); | 991 | struct vx_core *chip = snd_pcm_substream_chip(subs); |
976 | vx_pipe_t *pipe; | 992 | struct vx_pipe *pipe; |
977 | vx_pipe_t *pipe_out_monitoring = NULL; | 993 | struct vx_pipe *pipe_out_monitoring = NULL; |
978 | unsigned int audio; | 994 | unsigned int audio; |
979 | int err; | 995 | int err; |
980 | 996 | ||
@@ -1005,9 +1021,11 @@ static int vx_pcm_capture_open(snd_pcm_substream_t *subs) | |||
1005 | if an output pipe is available, it's audios still may need to be | 1021 | if an output pipe is available, it's audios still may need to be |
1006 | unmuted. hence we'll have to call a mixer entry point. | 1022 | unmuted. hence we'll have to call a mixer entry point. |
1007 | */ | 1023 | */ |
1008 | vx_set_monitor_level(chip, audio, chip->audio_monitor[audio], chip->audio_monitor_active[audio]); | 1024 | vx_set_monitor_level(chip, audio, chip->audio_monitor[audio], |
1025 | chip->audio_monitor_active[audio]); | ||
1009 | /* assuming stereo */ | 1026 | /* assuming stereo */ |
1010 | vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1], chip->audio_monitor_active[audio+1]); | 1027 | vx_set_monitor_level(chip, audio+1, chip->audio_monitor[audio+1], |
1028 | chip->audio_monitor_active[audio+1]); | ||
1011 | } | 1029 | } |
1012 | 1030 | ||
1013 | pipe->monitoring_pipe = pipe_out_monitoring; /* default value NULL */ | 1031 | pipe->monitoring_pipe = pipe_out_monitoring; /* default value NULL */ |
@@ -1026,11 +1044,11 @@ static int vx_pcm_capture_open(snd_pcm_substream_t *subs) | |||
1026 | /* | 1044 | /* |
1027 | * vx_pcm_capture_close - close callback for capture | 1045 | * vx_pcm_capture_close - close callback for capture |
1028 | */ | 1046 | */ |
1029 | static int vx_pcm_capture_close(snd_pcm_substream_t *subs) | 1047 | static int vx_pcm_capture_close(struct snd_pcm_substream *subs) |
1030 | { | 1048 | { |
1031 | vx_core_t *chip = snd_pcm_substream_chip(subs); | 1049 | struct vx_core *chip = snd_pcm_substream_chip(subs); |
1032 | vx_pipe_t *pipe; | 1050 | struct vx_pipe *pipe; |
1033 | vx_pipe_t *pipe_out_monitoring; | 1051 | struct vx_pipe *pipe_out_monitoring; |
1034 | 1052 | ||
1035 | if (! subs->runtime->private_data) | 1053 | if (! subs->runtime->private_data) |
1036 | return -EINVAL; | 1054 | return -EINVAL; |
@@ -1062,10 +1080,11 @@ static int vx_pcm_capture_close(snd_pcm_substream_t *subs) | |||
1062 | /* | 1080 | /* |
1063 | * vx_pcm_capture_update - update the capture buffer | 1081 | * vx_pcm_capture_update - update the capture buffer |
1064 | */ | 1082 | */ |
1065 | static void vx_pcm_capture_update(vx_core_t *chip, snd_pcm_substream_t *subs, vx_pipe_t *pipe) | 1083 | static void vx_pcm_capture_update(struct vx_core *chip, struct snd_pcm_substream *subs, |
1084 | struct vx_pipe *pipe) | ||
1066 | { | 1085 | { |
1067 | int size, space, count; | 1086 | int size, space, count; |
1068 | snd_pcm_runtime_t *runtime = subs->runtime; | 1087 | struct snd_pcm_runtime *runtime = subs->runtime; |
1069 | 1088 | ||
1070 | if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) | 1089 | if (! pipe->prepared || (chip->chip_status & VX_STAT_IS_STALE)) |
1071 | return; | 1090 | return; |
@@ -1135,17 +1154,17 @@ static void vx_pcm_capture_update(vx_core_t *chip, snd_pcm_substream_t *subs, vx | |||
1135 | /* | 1154 | /* |
1136 | * vx_pcm_capture_pointer - pointer callback for capture | 1155 | * vx_pcm_capture_pointer - pointer callback for capture |
1137 | */ | 1156 | */ |
1138 | static snd_pcm_uframes_t vx_pcm_capture_pointer(snd_pcm_substream_t *subs) | 1157 | static snd_pcm_uframes_t vx_pcm_capture_pointer(struct snd_pcm_substream *subs) |
1139 | { | 1158 | { |
1140 | snd_pcm_runtime_t *runtime = subs->runtime; | 1159 | struct snd_pcm_runtime *runtime = subs->runtime; |
1141 | vx_pipe_t *pipe = runtime->private_data; | 1160 | struct vx_pipe *pipe = runtime->private_data; |
1142 | return bytes_to_frames(runtime, pipe->hw_ptr); | 1161 | return bytes_to_frames(runtime, pipe->hw_ptr); |
1143 | } | 1162 | } |
1144 | 1163 | ||
1145 | /* | 1164 | /* |
1146 | * operators for PCM capture | 1165 | * operators for PCM capture |
1147 | */ | 1166 | */ |
1148 | static snd_pcm_ops_t vx_pcm_capture_ops = { | 1167 | static struct snd_pcm_ops vx_pcm_capture_ops = { |
1149 | .open = vx_pcm_capture_open, | 1168 | .open = vx_pcm_capture_open, |
1150 | .close = vx_pcm_capture_close, | 1169 | .close = vx_pcm_capture_close, |
1151 | .ioctl = snd_pcm_lib_ioctl, | 1170 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1161,10 +1180,10 @@ static snd_pcm_ops_t vx_pcm_capture_ops = { | |||
1161 | /* | 1180 | /* |
1162 | * interrupt handler for pcm streams | 1181 | * interrupt handler for pcm streams |
1163 | */ | 1182 | */ |
1164 | void vx_pcm_update_intr(vx_core_t *chip, unsigned int events) | 1183 | void vx_pcm_update_intr(struct vx_core *chip, unsigned int events) |
1165 | { | 1184 | { |
1166 | unsigned int i; | 1185 | unsigned int i; |
1167 | vx_pipe_t *pipe; | 1186 | struct vx_pipe *pipe; |
1168 | 1187 | ||
1169 | #define EVENT_MASK (END_OF_BUFFER_EVENTS_PENDING|ASYNC_EVENTS_PENDING) | 1188 | #define EVENT_MASK (END_OF_BUFFER_EVENTS_PENDING|ASYNC_EVENTS_PENDING) |
1170 | 1189 | ||
@@ -1218,7 +1237,7 @@ void vx_pcm_update_intr(vx_core_t *chip, unsigned int events) | |||
1218 | /* | 1237 | /* |
1219 | * vx_init_audio_io - check the availabe audio i/o and allocate pipe arrays | 1238 | * vx_init_audio_io - check the availabe audio i/o and allocate pipe arrays |
1220 | */ | 1239 | */ |
1221 | static int vx_init_audio_io(vx_core_t *chip) | 1240 | static int vx_init_audio_io(struct vx_core *chip) |
1222 | { | 1241 | { |
1223 | struct vx_rmh rmh; | 1242 | struct vx_rmh rmh; |
1224 | int preferred; | 1243 | int preferred; |
@@ -1234,19 +1253,20 @@ static int vx_init_audio_io(vx_core_t *chip) | |||
1234 | chip->audio_info = rmh.Stat[1]; | 1253 | chip->audio_info = rmh.Stat[1]; |
1235 | 1254 | ||
1236 | /* allocate pipes */ | 1255 | /* allocate pipes */ |
1237 | chip->playback_pipes = kmalloc(sizeof(vx_pipe_t *) * chip->audio_outs, GFP_KERNEL); | 1256 | chip->playback_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_outs, GFP_KERNEL); |
1238 | chip->capture_pipes = kmalloc(sizeof(vx_pipe_t *) * chip->audio_ins, GFP_KERNEL); | 1257 | chip->capture_pipes = kmalloc(sizeof(struct vx_pipe *) * chip->audio_ins, GFP_KERNEL); |
1239 | if (! chip->playback_pipes || ! chip->capture_pipes) | 1258 | if (! chip->playback_pipes || ! chip->capture_pipes) |
1240 | return -ENOMEM; | 1259 | return -ENOMEM; |
1241 | 1260 | ||
1242 | memset(chip->playback_pipes, 0, sizeof(vx_pipe_t *) * chip->audio_outs); | 1261 | memset(chip->playback_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_outs); |
1243 | memset(chip->capture_pipes, 0, sizeof(vx_pipe_t *) * chip->audio_ins); | 1262 | memset(chip->capture_pipes, 0, sizeof(struct vx_pipe *) * chip->audio_ins); |
1244 | 1263 | ||
1245 | preferred = chip->ibl.size; | 1264 | preferred = chip->ibl.size; |
1246 | chip->ibl.size = 0; | 1265 | chip->ibl.size = 0; |
1247 | vx_set_ibl(chip, &chip->ibl); /* query the info */ | 1266 | vx_set_ibl(chip, &chip->ibl); /* query the info */ |
1248 | if (preferred > 0) { | 1267 | if (preferred > 0) { |
1249 | chip->ibl.size = ((preferred + chip->ibl.granularity - 1) / chip->ibl.granularity) * chip->ibl.granularity; | 1268 | chip->ibl.size = ((preferred + chip->ibl.granularity - 1) / |
1269 | chip->ibl.granularity) * chip->ibl.granularity; | ||
1250 | if (chip->ibl.size > chip->ibl.max_size) | 1270 | if (chip->ibl.size > chip->ibl.max_size) |
1251 | chip->ibl.size = chip->ibl.max_size; | 1271 | chip->ibl.size = chip->ibl.max_size; |
1252 | } else | 1272 | } else |
@@ -1260,9 +1280,9 @@ static int vx_init_audio_io(vx_core_t *chip) | |||
1260 | /* | 1280 | /* |
1261 | * free callback for pcm | 1281 | * free callback for pcm |
1262 | */ | 1282 | */ |
1263 | static void snd_vx_pcm_free(snd_pcm_t *pcm) | 1283 | static void snd_vx_pcm_free(struct snd_pcm *pcm) |
1264 | { | 1284 | { |
1265 | vx_core_t *chip = pcm->private_data; | 1285 | struct vx_core *chip = pcm->private_data; |
1266 | chip->pcm[pcm->device] = NULL; | 1286 | chip->pcm[pcm->device] = NULL; |
1267 | kfree(chip->playback_pipes); | 1287 | kfree(chip->playback_pipes); |
1268 | chip->playback_pipes = NULL; | 1288 | chip->playback_pipes = NULL; |
@@ -1273,9 +1293,9 @@ static void snd_vx_pcm_free(snd_pcm_t *pcm) | |||
1273 | /* | 1293 | /* |
1274 | * snd_vx_pcm_new - create and initialize a pcm | 1294 | * snd_vx_pcm_new - create and initialize a pcm |
1275 | */ | 1295 | */ |
1276 | int snd_vx_pcm_new(vx_core_t *chip) | 1296 | int snd_vx_pcm_new(struct vx_core *chip) |
1277 | { | 1297 | { |
1278 | snd_pcm_t *pcm; | 1298 | struct snd_pcm *pcm; |
1279 | unsigned int i; | 1299 | unsigned int i; |
1280 | int err; | 1300 | int err; |
1281 | 1301 | ||