.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for audio on multifunction CS5535 companion device |
---|
3 | 4 | * Copyright (C) Jaya Kumar |
---|
4 | 5 | * |
---|
5 | 6 | * Based on Jaroslav Kysela and Takashi Iwai's examples. |
---|
6 | 7 | * 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 |
---|
21 | 8 | * |
---|
22 | 9 | * todo: add be fmt support, spdif, pm |
---|
23 | 10 | */ |
---|
.. | .. |
---|
130 | 117 | |
---|
131 | 118 | if (dma->desc_buf.area == NULL) { |
---|
132 | 119 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
---|
133 | | - snd_dma_pci_data(cs5535au->pci), |
---|
| 120 | + &cs5535au->pci->dev, |
---|
134 | 121 | CS5535AUDIO_DESC_LIST_SIZE+1, |
---|
135 | 122 | &dma->desc_buf) < 0) |
---|
136 | 123 | return -ENOMEM; |
---|
.. | .. |
---|
249 | 236 | struct cs5535audio_dma *dma = substream->runtime->private_data; |
---|
250 | 237 | int err; |
---|
251 | 238 | |
---|
252 | | - err = snd_pcm_lib_malloc_pages(substream, |
---|
253 | | - params_buffer_bytes(hw_params)); |
---|
254 | | - if (err < 0) |
---|
255 | | - return err; |
---|
256 | 239 | dma->buf_addr = substream->runtime->dma_addr; |
---|
257 | 240 | dma->buf_bytes = params_buffer_bytes(hw_params); |
---|
258 | 241 | |
---|
.. | .. |
---|
280 | 263 | dma->pcm_open_flag = 0; |
---|
281 | 264 | } |
---|
282 | 265 | cs5535audio_clear_dma_packets(cs5535au, dma, substream); |
---|
283 | | - return snd_pcm_lib_free_pages(substream); |
---|
| 266 | + return 0; |
---|
284 | 267 | } |
---|
285 | 268 | |
---|
286 | 269 | static int snd_cs5535audio_playback_prepare(struct snd_pcm_substream *substream) |
---|
.. | .. |
---|
383 | 366 | static const struct snd_pcm_ops snd_cs5535audio_playback_ops = { |
---|
384 | 367 | .open = snd_cs5535audio_playback_open, |
---|
385 | 368 | .close = snd_cs5535audio_playback_close, |
---|
386 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
387 | 369 | .hw_params = snd_cs5535audio_hw_params, |
---|
388 | 370 | .hw_free = snd_cs5535audio_hw_free, |
---|
389 | 371 | .prepare = snd_cs5535audio_playback_prepare, |
---|
.. | .. |
---|
394 | 376 | static const struct snd_pcm_ops snd_cs5535audio_capture_ops = { |
---|
395 | 377 | .open = snd_cs5535audio_capture_open, |
---|
396 | 378 | .close = snd_cs5535audio_capture_close, |
---|
397 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
398 | 379 | .hw_params = snd_cs5535audio_hw_params, |
---|
399 | 380 | .hw_free = snd_cs5535audio_hw_free, |
---|
400 | 381 | .prepare = snd_cs5535audio_capture_prepare, |
---|
.. | .. |
---|
444 | 425 | pcm->info_flags = 0; |
---|
445 | 426 | strcpy(pcm->name, "CS5535 Audio"); |
---|
446 | 427 | |
---|
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); |
---|
450 | 431 | cs5535au->pcm = pcm; |
---|
451 | 432 | |
---|
452 | 433 | return 0; |
---|