forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/isa/es1688/es1688_lib.c
....@@ -1,22 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
34 * Routines for control of ESS ES1688/688/488 chip
4
- *
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
- *
205 */
216
227 #include <linux/init.h>
....@@ -121,7 +106,7 @@
121106 static int snd_es1688_probe(struct snd_es1688 *chip)
122107 {
123108 unsigned long flags;
124
- unsigned short major, minor, hw;
109
+ unsigned short major, minor;
125110 int i;
126111
127112 /*
....@@ -166,14 +151,12 @@
166151 if (!chip->version)
167152 return -ENODEV; /* probably SB */
168153
169
- hw = ES1688_HW_AUTO;
170154 switch (chip->version & 0xfff0) {
171155 case 0x4880:
172156 snd_printk(KERN_ERR "[0x%lx] ESS: AudioDrive ES488 detected, "
173157 "but driver is in another place\n", chip->port);
174158 return -ENODEV;
175159 case 0x6880:
176
- hw = (chip->version & 0x0f) >= 8 ? ES1688_HW_1688 : ES1688_HW_688;
177160 break;
178161 default:
179162 snd_printk(KERN_ERR "[0x%lx] ESS: unknown AudioDrive chip "
....@@ -197,7 +180,7 @@
197180
198181 static int snd_es1688_init(struct snd_es1688 * chip, int enable)
199182 {
200
- static int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1};
183
+ static const int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1};
201184 unsigned long flags;
202185 int cfg, irq_bits, dma, dma_bits, tmp, tmp1;
203186
....@@ -326,12 +309,6 @@
326309 snd_es1688_write(chip, 0xa2, divider);
327310 }
328311
329
-static int snd_es1688_ioctl(struct snd_pcm_substream *substream,
330
- unsigned int cmd, void *arg)
331
-{
332
- return snd_pcm_lib_ioctl(substream, cmd, arg);
333
-}
334
-
335312 static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char value)
336313 {
337314 int val;
....@@ -356,17 +333,6 @@
356333 snd_es1688_write(chip, 0xb8, (val & 0xf0) | value);
357334 spin_unlock(&chip->reg_lock);
358335 return 0;
359
-}
360
-
361
-static int snd_es1688_hw_params(struct snd_pcm_substream *substream,
362
- struct snd_pcm_hw_params *hw_params)
363
-{
364
- return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
365
-}
366
-
367
-static int snd_es1688_hw_free(struct snd_pcm_substream *substream)
368
-{
369
- return snd_pcm_lib_free_pages(substream);
370336 }
371337
372338 static int snd_es1688_playback_prepare(struct snd_pcm_substream *substream)
....@@ -646,7 +612,7 @@
646612 int dma8,
647613 unsigned short hardware)
648614 {
649
- static struct snd_device_ops ops = {
615
+ static const struct snd_device_ops ops = {
650616 .dev_free = snd_es1688_dev_free,
651617 };
652618
....@@ -672,6 +638,7 @@
672638 }
673639
674640 chip->irq = irq;
641
+ card->sync_irq = chip->irq;
675642 err = request_dma(dma8, "ES1688");
676643
677644 if (err < 0) {
....@@ -709,9 +676,6 @@
709676 static const struct snd_pcm_ops snd_es1688_playback_ops = {
710677 .open = snd_es1688_playback_open,
711678 .close = snd_es1688_playback_close,
712
- .ioctl = snd_es1688_ioctl,
713
- .hw_params = snd_es1688_hw_params,
714
- .hw_free = snd_es1688_hw_free,
715679 .prepare = snd_es1688_playback_prepare,
716680 .trigger = snd_es1688_playback_trigger,
717681 .pointer = snd_es1688_playback_pointer,
....@@ -720,9 +684,6 @@
720684 static const struct snd_pcm_ops snd_es1688_capture_ops = {
721685 .open = snd_es1688_capture_open,
722686 .close = snd_es1688_capture_close,
723
- .ioctl = snd_es1688_ioctl,
724
- .hw_params = snd_es1688_hw_params,
725
- .hw_free = snd_es1688_hw_free,
726687 .prepare = snd_es1688_capture_prepare,
727688 .trigger = snd_es1688_capture_trigger,
728689 .pointer = snd_es1688_capture_pointer,
....@@ -745,9 +706,8 @@
745706 strcpy(pcm->name, snd_es1688_chip_id(chip));
746707 chip->pcm = pcm;
747708
748
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
749
- snd_dma_isa_data(),
750
- 64*1024, 64*1024);
709
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev,
710
+ 64*1024, 64*1024);
751711 return 0;
752712 }
753713
....@@ -964,7 +924,7 @@
964924 return change;
965925 }
966926
967
-static struct snd_kcontrol_new snd_es1688_controls[] = {
927
+static const struct snd_kcontrol_new snd_es1688_controls[] = {
968928 ES1688_DOUBLE("Master Playback Volume", 0, ES1688_MASTER_DEV, ES1688_MASTER_DEV, 4, 0, 15, 0),
969929 ES1688_DOUBLE("PCM Playback Volume", 0, ES1688_PCM_DEV, ES1688_PCM_DEV, 4, 0, 15, 0),
970930 ES1688_DOUBLE("Line Playback Volume", 0, ES1688_LINE_DEV, ES1688_LINE_DEV, 4, 0, 15, 0),
....@@ -986,7 +946,7 @@
986946
987947 #define ES1688_INIT_TABLE_SIZE (sizeof(snd_es1688_init_table)/2)
988948
989
-static unsigned char snd_es1688_init_table[][2] = {
949
+static const unsigned char snd_es1688_init_table[][2] = {
990950 { ES1688_MASTER_DEV, 0 },
991951 { ES1688_PCM_DEV, 0 },
992952 { ES1688_LINE_DEV, 0 },