forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/pci/cs5535audio/cs5535audio_pcm.c
....@@ -1,23 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for audio on multifunction CS5535 companion device
34 * Copyright (C) Jaya Kumar
45 *
56 * Based on Jaroslav Kysela and Takashi Iwai's examples.
67 * This work was sponsored by CIS(M) Sdn Bhd.
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
218 *
229 * todo: add be fmt support, spdif, pm
2310 */
....@@ -130,7 +117,7 @@
130117
131118 if (dma->desc_buf.area == NULL) {
132119 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
133
- snd_dma_pci_data(cs5535au->pci),
120
+ &cs5535au->pci->dev,
134121 CS5535AUDIO_DESC_LIST_SIZE+1,
135122 &dma->desc_buf) < 0)
136123 return -ENOMEM;
....@@ -249,10 +236,6 @@
249236 struct cs5535audio_dma *dma = substream->runtime->private_data;
250237 int err;
251238
252
- err = snd_pcm_lib_malloc_pages(substream,
253
- params_buffer_bytes(hw_params));
254
- if (err < 0)
255
- return err;
256239 dma->buf_addr = substream->runtime->dma_addr;
257240 dma->buf_bytes = params_buffer_bytes(hw_params);
258241
....@@ -280,7 +263,7 @@
280263 dma->pcm_open_flag = 0;
281264 }
282265 cs5535audio_clear_dma_packets(cs5535au, dma, substream);
283
- return snd_pcm_lib_free_pages(substream);
266
+ return 0;
284267 }
285268
286269 static int snd_cs5535audio_playback_prepare(struct snd_pcm_substream *substream)
....@@ -383,7 +366,6 @@
383366 static const struct snd_pcm_ops snd_cs5535audio_playback_ops = {
384367 .open = snd_cs5535audio_playback_open,
385368 .close = snd_cs5535audio_playback_close,
386
- .ioctl = snd_pcm_lib_ioctl,
387369 .hw_params = snd_cs5535audio_hw_params,
388370 .hw_free = snd_cs5535audio_hw_free,
389371 .prepare = snd_cs5535audio_playback_prepare,
....@@ -394,7 +376,6 @@
394376 static const struct snd_pcm_ops snd_cs5535audio_capture_ops = {
395377 .open = snd_cs5535audio_capture_open,
396378 .close = snd_cs5535audio_capture_close,
397
- .ioctl = snd_pcm_lib_ioctl,
398379 .hw_params = snd_cs5535audio_hw_params,
399380 .hw_free = snd_cs5535audio_hw_free,
400381 .prepare = snd_cs5535audio_capture_prepare,
....@@ -444,9 +425,9 @@
444425 pcm->info_flags = 0;
445426 strcpy(pcm->name, "CS5535 Audio");
446427
447
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
448
- snd_dma_pci_data(cs5535au->pci),
449
- 64*1024, 128*1024);
428
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
429
+ &cs5535au->pci->dev,
430
+ 64*1024, 128*1024);
450431 cs5535au->pcm = pcm;
451432
452433 return 0;