diff options
Diffstat (limited to 'sound/mips/sgio2audio.c')
| -rw-r--r-- | sound/mips/sgio2audio.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c index f1d9d16b5486..6aff217379d9 100644 --- a/sound/mips/sgio2audio.c +++ b/sound/mips/sgio2audio.c | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
| 27 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
| 28 | #include <linux/gfp.h> | 28 | #include <linux/gfp.h> |
| 29 | #include <linux/vmalloc.h> | ||
| 30 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
| 31 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
| 32 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
| @@ -603,25 +602,14 @@ static int snd_sgio2audio_pcm_close(struct snd_pcm_substream *substream) | |||
| 603 | static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream, | 602 | static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream, |
| 604 | struct snd_pcm_hw_params *hw_params) | 603 | struct snd_pcm_hw_params *hw_params) |
| 605 | { | 604 | { |
| 606 | struct snd_pcm_runtime *runtime = substream->runtime; | 605 | return snd_pcm_lib_alloc_vmalloc_buffer(substream, |
| 607 | int size = params_buffer_bytes(hw_params); | 606 | params_buffer_bytes(hw_params)); |
| 608 | |||
| 609 | /* alloc virtual 'dma' area */ | ||
| 610 | if (runtime->dma_area) | ||
| 611 | vfree(runtime->dma_area); | ||
| 612 | runtime->dma_area = vmalloc_user(size); | ||
| 613 | if (runtime->dma_area == NULL) | ||
| 614 | return -ENOMEM; | ||
| 615 | runtime->dma_bytes = size; | ||
| 616 | return 0; | ||
| 617 | } | 607 | } |
| 618 | 608 | ||
| 619 | /* hw_free callback */ | 609 | /* hw_free callback */ |
| 620 | static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream) | 610 | static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream) |
| 621 | { | 611 | { |
| 622 | vfree(substream->runtime->dma_area); | 612 | return snd_pcm_lib_free_vmalloc_buffer(substream); |
| 623 | substream->runtime->dma_area = NULL; | ||
| 624 | return 0; | ||
| 625 | } | 613 | } |
| 626 | 614 | ||
| 627 | /* prepare callback */ | 615 | /* prepare callback */ |
| @@ -692,13 +680,6 @@ snd_sgio2audio_pcm_pointer(struct snd_pcm_substream *substream) | |||
| 692 | chip->channel[chan->idx].pos); | 680 | chip->channel[chan->idx].pos); |
| 693 | } | 681 | } |
| 694 | 682 | ||
| 695 | /* get the physical page pointer on the given offset */ | ||
| 696 | static struct page *snd_sgio2audio_page(struct snd_pcm_substream *substream, | ||
| 697 | unsigned long offset) | ||
| 698 | { | ||
| 699 | return vmalloc_to_page(substream->runtime->dma_area + offset); | ||
| 700 | } | ||
| 701 | |||
| 702 | /* operators */ | 683 | /* operators */ |
| 703 | static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { | 684 | static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { |
| 704 | .open = snd_sgio2audio_playback1_open, | 685 | .open = snd_sgio2audio_playback1_open, |
| @@ -709,7 +690,8 @@ static struct snd_pcm_ops snd_sgio2audio_playback1_ops = { | |||
| 709 | .prepare = snd_sgio2audio_pcm_prepare, | 690 | .prepare = snd_sgio2audio_pcm_prepare, |
| 710 | .trigger = snd_sgio2audio_pcm_trigger, | 691 | .trigger = snd_sgio2audio_pcm_trigger, |
| 711 | .pointer = snd_sgio2audio_pcm_pointer, | 692 | .pointer = snd_sgio2audio_pcm_pointer, |
| 712 | .page = snd_sgio2audio_page, | 693 | .page = snd_pcm_lib_get_vmalloc_page, |
| 694 | .mmap = snd_pcm_lib_mmap_vmalloc, | ||
| 713 | }; | 695 | }; |
| 714 | 696 | ||
| 715 | static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { | 697 | static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { |
| @@ -721,7 +703,8 @@ static struct snd_pcm_ops snd_sgio2audio_playback2_ops = { | |||
| 721 | .prepare = snd_sgio2audio_pcm_prepare, | 703 | .prepare = snd_sgio2audio_pcm_prepare, |
| 722 | .trigger = snd_sgio2audio_pcm_trigger, | 704 | .trigger = snd_sgio2audio_pcm_trigger, |
| 723 | .pointer = snd_sgio2audio_pcm_pointer, | 705 | .pointer = snd_sgio2audio_pcm_pointer, |
| 724 | .page = snd_sgio2audio_page, | 706 | .page = snd_pcm_lib_get_vmalloc_page, |
| 707 | .mmap = snd_pcm_lib_mmap_vmalloc, | ||
| 725 | }; | 708 | }; |
| 726 | 709 | ||
| 727 | static struct snd_pcm_ops snd_sgio2audio_capture_ops = { | 710 | static struct snd_pcm_ops snd_sgio2audio_capture_ops = { |
| @@ -733,7 +716,8 @@ static struct snd_pcm_ops snd_sgio2audio_capture_ops = { | |||
| 733 | .prepare = snd_sgio2audio_pcm_prepare, | 716 | .prepare = snd_sgio2audio_pcm_prepare, |
| 734 | .trigger = snd_sgio2audio_pcm_trigger, | 717 | .trigger = snd_sgio2audio_pcm_trigger, |
| 735 | .pointer = snd_sgio2audio_pcm_pointer, | 718 | .pointer = snd_sgio2audio_pcm_pointer, |
| 736 | .page = snd_sgio2audio_page, | 719 | .page = snd_pcm_lib_get_vmalloc_page, |
| 720 | .mmap = snd_pcm_lib_mmap_vmalloc, | ||
| 737 | }; | 721 | }; |
| 738 | 722 | ||
| 739 | /* | 723 | /* |
