forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/sound/pci/au88x0/au88x0_pcm.c
....@@ -1,17 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
2
- * This program is free software; you can redistribute it and/or modify
3
- * it under the terms of the GNU General Public License as published by
4
- * the Free Software Foundation; either version 2 of the License, or
5
- * (at your option) any later version.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU Library General Public License for more details.
11
- *
12
- * You should have received a copy of the GNU General Public License
13
- * along with this program; if not, write to the Free Software
14
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
153 */
164
175 /*
....@@ -221,15 +209,7 @@
221209 {
222210 vortex_t *chip = snd_pcm_substream_chip(substream);
223211 stream_t *stream = (stream_t *) (substream->runtime->private_data);
224
- int err;
225212
226
- // Alloc buffer memory.
227
- err =
228
- snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
229
- if (err < 0) {
230
- dev_err(chip->card->dev, "Vortex: pcm page alloc failed!\n");
231
- return err;
232
- }
233213 /*
234214 pr_info( "Vortex: periods %d, period_bytes %d, channels = %d\n", params_periods(hw_params),
235215 params_period_bytes(hw_params), params_channels(hw_params));
....@@ -316,7 +296,7 @@
316296 substream->runtime->private_data = NULL;
317297 spin_unlock_irq(&chip->lock);
318298
319
- return snd_pcm_lib_free_pages(substream);
299
+ return 0;
320300 }
321301
322302 /* prepare callback */
....@@ -442,27 +422,25 @@
442422 static const struct snd_pcm_ops snd_vortex_playback_ops = {
443423 .open = snd_vortex_pcm_open,
444424 .close = snd_vortex_pcm_close,
445
- .ioctl = snd_pcm_lib_ioctl,
446425 .hw_params = snd_vortex_pcm_hw_params,
447426 .hw_free = snd_vortex_pcm_hw_free,
448427 .prepare = snd_vortex_pcm_prepare,
449428 .trigger = snd_vortex_pcm_trigger,
450429 .pointer = snd_vortex_pcm_pointer,
451
- .page = snd_pcm_sgbuf_ops_page,
452430 };
453431
454432 /*
455433 * definitions of capture are omitted here...
456434 */
457435
458
-static char *vortex_pcm_prettyname[VORTEX_PCM_LAST] = {
436
+static const char * const vortex_pcm_prettyname[VORTEX_PCM_LAST] = {
459437 CARD_NAME " ADB",
460438 CARD_NAME " SPDIF",
461439 CARD_NAME " A3D",
462440 CARD_NAME " WT",
463441 CARD_NAME " I2S",
464442 };
465
-static char *vortex_pcm_name[VORTEX_PCM_LAST] = {
443
+static const char * const vortex_pcm_name[VORTEX_PCM_LAST] = {
466444 "adb",
467445 "spdif",
468446 "a3d",
....@@ -519,7 +497,7 @@
519497 }
520498
521499 /* spdif controls */
522
-static struct snd_kcontrol_new snd_vortex_mixer_spdif[] = {
500
+static const struct snd_kcontrol_new snd_vortex_mixer_spdif[] = {
523501 {
524502 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
525503 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
....@@ -649,9 +627,8 @@
649627
650628 /* pre-allocation of Scatter-Gather buffers */
651629
652
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
653
- snd_dma_pci_data(chip->pci_dev),
654
- 0x10000, 0x10000);
630
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
631
+ &chip->pci_dev->dev, 0x10000, 0x10000);
655632
656633 switch (VORTEX_PCM_TYPE(pcm)) {
657634 case VORTEX_PCM_ADB: