forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/parisc/harmony.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* Hewlett-Packard Harmony audio driver
23 *
34 * This is a driver for the Harmony audio chipset found
....@@ -13,26 +14,12 @@
1314 * Copyright 2003 (c) Laurent Canet
1415 * Copyright 2004 (c) Stuart Brady
1516 *
16
- * This program is free software; you can redistribute it and/or modify
17
- * it under the terms of the GNU General Public License, version 2, as
18
- * published by the Free Software Foundation.
19
- *
20
- * This program is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- * GNU General Public License for more details.
24
- *
25
- * You should have received a copy of the GNU General Public License
26
- * along with this program; if not, write to the Free Software
27
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
- *
2917 * Notes:
3018 * - graveyard and silence buffers last for lifetime of
3119 * the driver. playback and capture buffers are allocated
3220 * per _open()/_close().
3321 *
3422 * TODO:
35
- *
3623 */
3724
3825 #include <linux/init.h>
....@@ -580,28 +567,18 @@
580567 snd_harmony_hw_params(struct snd_pcm_substream *ss,
581568 struct snd_pcm_hw_params *hw)
582569 {
583
- int err;
584570 struct snd_harmony *h = snd_pcm_substream_chip(ss);
585571
586
- err = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw));
587
- if (err > 0 && h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS)
572
+ if (h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS)
588573 ss->runtime->dma_addr = __pa(ss->runtime->dma_area);
589
-
590
- return err;
591
-}
592574
593
-static int
594
-snd_harmony_hw_free(struct snd_pcm_substream *ss)
595
-{
596
- return snd_pcm_lib_free_pages(ss);
575
+ return 0;
597576 }
598577
599578 static const struct snd_pcm_ops snd_harmony_playback_ops = {
600579 .open = snd_harmony_playback_open,
601580 .close = snd_harmony_playback_close,
602
- .ioctl = snd_pcm_lib_ioctl,
603581 .hw_params = snd_harmony_hw_params,
604
- .hw_free = snd_harmony_hw_free,
605582 .prepare = snd_harmony_playback_prepare,
606583 .trigger = snd_harmony_playback_trigger,
607584 .pointer = snd_harmony_playback_pointer,
....@@ -610,9 +587,7 @@
610587 static const struct snd_pcm_ops snd_harmony_capture_ops = {
611588 .open = snd_harmony_capture_open,
612589 .close = snd_harmony_capture_close,
613
- .ioctl = snd_pcm_lib_ioctl,
614590 .hw_params = snd_harmony_hw_params,
615
- .hw_free = snd_harmony_hw_free,
616591 .prepare = snd_harmony_capture_prepare,
617592 .trigger = snd_harmony_capture_trigger,
618593 .pointer = snd_harmony_capture_pointer,
....@@ -669,14 +644,8 @@
669644 }
670645
671646 /* pre-allocate space for DMA */
672
- err = snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type,
673
- h->dma.dev,
674
- MAX_BUF_SIZE,
675
- MAX_BUF_SIZE);
676
- if (err < 0) {
677
- printk(KERN_ERR PFX "buffer allocation error: %d\n", err);
678
- return err;
679
- }
647
+ snd_pcm_set_managed_buffer_all(pcm, h->dma.type, h->dma.dev,
648
+ MAX_BUF_SIZE, MAX_BUF_SIZE);
680649
681650 h->st.format = snd_harmony_set_data_format(h,
682651 SNDRV_PCM_FORMAT_S16_BE, 1);
....@@ -828,7 +797,7 @@
828797 .private_value = ((left_shift) | ((right_shift) << 8) | \
829798 ((mask) << 16) | ((invert) << 24)) }
830799
831
-static struct snd_kcontrol_new snd_harmony_controls[] = {
800
+static const struct snd_kcontrol_new snd_harmony_controls[] = {
832801 HARMONY_VOLUME("Master Playback Volume", HARMONY_GAIN_LO_SHIFT,
833802 HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1),
834803 HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT,
....@@ -912,7 +881,7 @@
912881 {
913882 int err;
914883 struct snd_harmony *h;
915
- static struct snd_device_ops ops = {
884
+ static const struct snd_device_ops ops = {
916885 .dev_free = snd_harmony_dev_free,
917886 };
918887
....@@ -926,7 +895,7 @@
926895 h->card = card;
927896 h->dev = padev;
928897 h->irq = -1;
929
- h->iobase = ioremap_nocache(padev->hpa.start, HARMONY_SIZE);
898
+ h->iobase = ioremap(padev->hpa.start, HARMONY_SIZE);
930899 if (h->iobase == NULL) {
931900 printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n",
932901 (unsigned long)padev->hpa.start);