hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/sound/mips/sgio2audio.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Sound driver for Silicon Graphics O2 Workstations A/V board audio.
34 *
....@@ -5,21 +6,6 @@
56 * Copyright 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
67 * Mxier part taken from mace_audio.c:
78 * 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
- *
239 */
2410
2511 #include <linux/init.h>
....@@ -591,21 +577,6 @@
591577 return 0;
592578 }
593579
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
-
609580 /* prepare callback */
610581 static int snd_sgio2audio_pcm_prepare(struct snd_pcm_substream *substream)
611582 {
....@@ -678,37 +649,25 @@
678649 static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
679650 .open = snd_sgio2audio_playback1_open,
680651 .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,
684652 .prepare = snd_sgio2audio_pcm_prepare,
685653 .trigger = snd_sgio2audio_pcm_trigger,
686654 .pointer = snd_sgio2audio_pcm_pointer,
687
- .page = snd_pcm_lib_get_vmalloc_page,
688655 };
689656
690657 static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
691658 .open = snd_sgio2audio_playback2_open,
692659 .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,
696660 .prepare = snd_sgio2audio_pcm_prepare,
697661 .trigger = snd_sgio2audio_pcm_trigger,
698662 .pointer = snd_sgio2audio_pcm_pointer,
699
- .page = snd_pcm_lib_get_vmalloc_page,
700663 };
701664
702665 static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
703666 .open = snd_sgio2audio_capture_open,
704667 .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,
708668 .prepare = snd_sgio2audio_pcm_prepare,
709669 .trigger = snd_sgio2audio_pcm_trigger,
710670 .pointer = snd_sgio2audio_pcm_pointer,
711
- .page = snd_pcm_lib_get_vmalloc_page,
712671 };
713672
714673 /*
....@@ -734,6 +693,7 @@
734693 &snd_sgio2audio_playback1_ops);
735694 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
736695 &snd_sgio2audio_capture_ops);
696
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
737697
738698 /* create second pcm device with one outputs and no input */
739699 err = snd_pcm_new(chip->card, "SGI O2 Audio", 1, 1, 0, &pcm);
....@@ -746,6 +706,7 @@
746706 /* set operators */
747707 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
748708 &snd_sgio2audio_playback2_ops);
709
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0);
749710
750711 return 0;
751712 }
....@@ -805,7 +766,7 @@
805766 free_irq(snd_sgio2_isr_table[i].irq,
806767 &chip->channel[snd_sgio2_isr_table[i].idx]);
807768
808
- dma_free_coherent(NULL, MACEISA_RINGBUFFERS_SIZE,
769
+ dma_free_coherent(chip->card->dev, MACEISA_RINGBUFFERS_SIZE,
809770 chip->ring_base, chip->ring_base_dma);
810771
811772 /* release card data */
....@@ -820,7 +781,7 @@
820781 return snd_sgio2audio_free(chip);
821782 }
822783
823
-static struct snd_device_ops ops = {
784
+static const struct snd_device_ops ops = {
824785 .dev_free = snd_sgio2audio_dev_free,
825786 };
826787
....@@ -843,8 +804,9 @@
843804
844805 chip->card = card;
845806
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);
848810 if (chip->ring_base == NULL) {
849811 printk(KERN_ERR
850812 "sgio2audio: could not allocate ring buffers\n");