.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Sound driver for Silicon Graphics O2 Workstations A/V board audio. |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Copyright 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de> |
---|
6 | 7 | * Mxier part taken from mace_audio.c: |
---|
7 | 8 | * Copyright 2007 Thorben Jändling <tj.trevelyan@gmail.com> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | | - * |
---|
23 | 9 | */ |
---|
24 | 10 | |
---|
25 | 11 | #include <linux/init.h> |
---|
.. | .. |
---|
591 | 577 | return 0; |
---|
592 | 578 | } |
---|
593 | 579 | |
---|
594 | | - |
---|
595 | | -/* hw_params callback */ |
---|
596 | | -static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream, |
---|
597 | | - struct snd_pcm_hw_params *hw_params) |
---|
598 | | -{ |
---|
599 | | - return snd_pcm_lib_alloc_vmalloc_buffer(substream, |
---|
600 | | - params_buffer_bytes(hw_params)); |
---|
601 | | -} |
---|
602 | | - |
---|
603 | | -/* hw_free callback */ |
---|
604 | | -static int snd_sgio2audio_pcm_hw_free(struct snd_pcm_substream *substream) |
---|
605 | | -{ |
---|
606 | | - return snd_pcm_lib_free_vmalloc_buffer(substream); |
---|
607 | | -} |
---|
608 | | - |
---|
609 | 580 | /* prepare callback */ |
---|
610 | 581 | static int snd_sgio2audio_pcm_prepare(struct snd_pcm_substream *substream) |
---|
611 | 582 | { |
---|
.. | .. |
---|
678 | 649 | static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = { |
---|
679 | 650 | .open = snd_sgio2audio_playback1_open, |
---|
680 | 651 | .close = snd_sgio2audio_pcm_close, |
---|
681 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
682 | | - .hw_params = snd_sgio2audio_pcm_hw_params, |
---|
683 | | - .hw_free = snd_sgio2audio_pcm_hw_free, |
---|
684 | 652 | .prepare = snd_sgio2audio_pcm_prepare, |
---|
685 | 653 | .trigger = snd_sgio2audio_pcm_trigger, |
---|
686 | 654 | .pointer = snd_sgio2audio_pcm_pointer, |
---|
687 | | - .page = snd_pcm_lib_get_vmalloc_page, |
---|
688 | 655 | }; |
---|
689 | 656 | |
---|
690 | 657 | static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = { |
---|
691 | 658 | .open = snd_sgio2audio_playback2_open, |
---|
692 | 659 | .close = snd_sgio2audio_pcm_close, |
---|
693 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
694 | | - .hw_params = snd_sgio2audio_pcm_hw_params, |
---|
695 | | - .hw_free = snd_sgio2audio_pcm_hw_free, |
---|
696 | 660 | .prepare = snd_sgio2audio_pcm_prepare, |
---|
697 | 661 | .trigger = snd_sgio2audio_pcm_trigger, |
---|
698 | 662 | .pointer = snd_sgio2audio_pcm_pointer, |
---|
699 | | - .page = snd_pcm_lib_get_vmalloc_page, |
---|
700 | 663 | }; |
---|
701 | 664 | |
---|
702 | 665 | static const struct snd_pcm_ops snd_sgio2audio_capture_ops = { |
---|
703 | 666 | .open = snd_sgio2audio_capture_open, |
---|
704 | 667 | .close = snd_sgio2audio_pcm_close, |
---|
705 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
706 | | - .hw_params = snd_sgio2audio_pcm_hw_params, |
---|
707 | | - .hw_free = snd_sgio2audio_pcm_hw_free, |
---|
708 | 668 | .prepare = snd_sgio2audio_pcm_prepare, |
---|
709 | 669 | .trigger = snd_sgio2audio_pcm_trigger, |
---|
710 | 670 | .pointer = snd_sgio2audio_pcm_pointer, |
---|
711 | | - .page = snd_pcm_lib_get_vmalloc_page, |
---|
712 | 671 | }; |
---|
713 | 672 | |
---|
714 | 673 | /* |
---|
.. | .. |
---|
734 | 693 | &snd_sgio2audio_playback1_ops); |
---|
735 | 694 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, |
---|
736 | 695 | &snd_sgio2audio_capture_ops); |
---|
| 696 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0); |
---|
737 | 697 | |
---|
738 | 698 | /* create second pcm device with one outputs and no input */ |
---|
739 | 699 | err = snd_pcm_new(chip->card, "SGI O2 Audio", 1, 1, 0, &pcm); |
---|
.. | .. |
---|
746 | 706 | /* set operators */ |
---|
747 | 707 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
---|
748 | 708 | &snd_sgio2audio_playback2_ops); |
---|
| 709 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0); |
---|
749 | 710 | |
---|
750 | 711 | return 0; |
---|
751 | 712 | } |
---|
.. | .. |
---|
805 | 766 | free_irq(snd_sgio2_isr_table[i].irq, |
---|
806 | 767 | &chip->channel[snd_sgio2_isr_table[i].idx]); |
---|
807 | 768 | |
---|
808 | | - dma_free_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, |
---|
| 769 | + dma_free_coherent(chip->card->dev, MACEISA_RINGBUFFERS_SIZE, |
---|
809 | 770 | chip->ring_base, chip->ring_base_dma); |
---|
810 | 771 | |
---|
811 | 772 | /* release card data */ |
---|
.. | .. |
---|
820 | 781 | return snd_sgio2audio_free(chip); |
---|
821 | 782 | } |
---|
822 | 783 | |
---|
823 | | -static struct snd_device_ops ops = { |
---|
| 784 | +static const struct snd_device_ops ops = { |
---|
824 | 785 | .dev_free = snd_sgio2audio_dev_free, |
---|
825 | 786 | }; |
---|
826 | 787 | |
---|
.. | .. |
---|
843 | 804 | |
---|
844 | 805 | chip->card = card; |
---|
845 | 806 | |
---|
846 | | - chip->ring_base = dma_alloc_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, |
---|
847 | | - &chip->ring_base_dma, GFP_USER); |
---|
| 807 | + chip->ring_base = dma_alloc_coherent(card->dev, |
---|
| 808 | + MACEISA_RINGBUFFERS_SIZE, |
---|
| 809 | + &chip->ring_base_dma, GFP_KERNEL); |
---|
848 | 810 | if (chip->ring_base == NULL) { |
---|
849 | 811 | printk(KERN_ERR |
---|
850 | 812 | "sgio2audio: could not allocate ring buffers\n"); |
---|