forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 1f93a7dfd1f8d5ff7a5c53246c7534fe2332d6f4
kernel/sound/pci/ctxfi/ctpcm.c
....@@ -1,9 +1,6 @@
1
-/**
1
+// SPDX-License-Identifier: GPL-2.0-only
2
+/*
23 * Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
3
- *
4
- * This source file is released under GPL v2 license (no other versions).
5
- * See the COPYING file included in the main directory of this source
6
- * distribution for the license terms and conditions.
74 *
85 * @File ctpcm.c
96 *
....@@ -12,7 +9,6 @@
129 *
1310 * @Author Liu Chun
1411 * @Date Apr 2 2008
15
- *
1612 */
1713
1814 #include "ctpcm.h"
....@@ -182,15 +178,10 @@
182178 {
183179 struct ct_atc *atc = snd_pcm_substream_chip(substream);
184180 struct ct_atc_pcm *apcm = substream->runtime->private_data;
185
- int err;
186181
187
- err = snd_pcm_lib_malloc_pages(substream,
188
- params_buffer_bytes(hw_params));
189
- if (err < 0)
190
- return err;
191182 /* clear previous resources */
192183 atc->pcm_release_resources(atc, apcm);
193
- return err;
184
+ return 0;
194185 }
195186
196187 static int ct_pcm_hw_free(struct snd_pcm_substream *substream)
....@@ -200,8 +191,7 @@
200191
201192 /* clear previous resources */
202193 atc->pcm_release_resources(atc, apcm);
203
- /* Free snd-allocated pages */
204
- return snd_pcm_lib_free_pages(substream);
194
+ return 0;
205195 }
206196
207197
....@@ -377,26 +367,22 @@
377367 static const struct snd_pcm_ops ct_pcm_playback_ops = {
378368 .open = ct_pcm_playback_open,
379369 .close = ct_pcm_playback_close,
380
- .ioctl = snd_pcm_lib_ioctl,
381370 .hw_params = ct_pcm_hw_params,
382371 .hw_free = ct_pcm_hw_free,
383372 .prepare = ct_pcm_playback_prepare,
384373 .trigger = ct_pcm_playback_trigger,
385374 .pointer = ct_pcm_playback_pointer,
386
- .page = snd_pcm_sgbuf_ops_page,
387375 };
388376
389377 /* PCM operators for capture */
390378 static const struct snd_pcm_ops ct_pcm_capture_ops = {
391379 .open = ct_pcm_capture_open,
392380 .close = ct_pcm_capture_close,
393
- .ioctl = snd_pcm_lib_ioctl,
394381 .hw_params = ct_pcm_hw_params,
395382 .hw_free = ct_pcm_hw_free,
396383 .prepare = ct_pcm_capture_prepare,
397384 .trigger = ct_pcm_capture_trigger,
398385 .pointer = ct_pcm_capture_pointer,
399
- .page = snd_pcm_sgbuf_ops_page,
400386 };
401387
402388 static const struct snd_pcm_chmap_elem surround_map[] = {
....@@ -455,8 +441,8 @@
455441 snd_pcm_set_ops(pcm,
456442 SNDRV_PCM_STREAM_CAPTURE, &ct_pcm_capture_ops);
457443
458
- snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
459
- snd_dma_pci_data(atc->pci), 128*1024, 128*1024);
444
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
445
+ &atc->pci->dev, 128*1024, 128*1024);
460446
461447 chs = 2;
462448 switch (device) {