| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | | -* This code is licenced under |
|---|
| 3 | | -* the General Public Licence |
|---|
| 4 | | -* version 2 |
|---|
| 5 | 3 | * |
|---|
| 6 | 4 | * Copyright Adrian McMenamin 2005, 2006, 2007 |
|---|
| 7 | 5 | * <adrian@mcmen.demon.co.uk> |
|---|
| 8 | 6 | * Requires firmware (BSD licenced) available from: |
|---|
| 9 | 7 | * http://linuxdc.cvs.sourceforge.net/linuxdc/linux-sh-dc/sound/oss/aica/firmware/ |
|---|
| 10 | 8 | * or the maintainer |
|---|
| 11 | | -* |
|---|
| 12 | | -* This program is free software; you can redistribute it and/or modify |
|---|
| 13 | | -* it under the terms of version 2 of the GNU General Public License as published by |
|---|
| 14 | | -* the Free Software Foundation. |
|---|
| 15 | | -* |
|---|
| 16 | | -* This program is distributed in the hope that it will be useful, |
|---|
| 17 | | -* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | | -* GNU General Public License for more details. |
|---|
| 20 | | -* |
|---|
| 21 | | -* You should have received a copy of the GNU General Public License |
|---|
| 22 | | -* along with this program; if not, write to the Free Software |
|---|
| 23 | | -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 24 | | -* |
|---|
| 25 | 9 | */ |
|---|
| 26 | 10 | |
|---|
| 27 | 11 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 379 | 363 | return 0; |
|---|
| 380 | 364 | } |
|---|
| 381 | 365 | |
|---|
| 382 | | -static int snd_aicapcm_pcm_hw_free(struct snd_pcm_substream |
|---|
| 383 | | - *substream) |
|---|
| 384 | | -{ |
|---|
| 385 | | - /* Free the DMA buffer */ |
|---|
| 386 | | - return snd_pcm_lib_free_pages(substream); |
|---|
| 387 | | -} |
|---|
| 388 | | - |
|---|
| 389 | | -static int snd_aicapcm_pcm_hw_params(struct snd_pcm_substream |
|---|
| 390 | | - *substream, struct snd_pcm_hw_params |
|---|
| 391 | | - *hw_params) |
|---|
| 392 | | -{ |
|---|
| 393 | | - /* Allocate a DMA buffer using ALSA built-ins */ |
|---|
| 394 | | - return |
|---|
| 395 | | - snd_pcm_lib_malloc_pages(substream, |
|---|
| 396 | | - params_buffer_bytes(hw_params)); |
|---|
| 397 | | -} |
|---|
| 398 | | - |
|---|
| 399 | 366 | static int snd_aicapcm_pcm_prepare(struct snd_pcm_substream |
|---|
| 400 | 367 | *substream) |
|---|
| 401 | 368 | { |
|---|
| .. | .. |
|---|
| 432 | 399 | static const struct snd_pcm_ops snd_aicapcm_playback_ops = { |
|---|
| 433 | 400 | .open = snd_aicapcm_pcm_open, |
|---|
| 434 | 401 | .close = snd_aicapcm_pcm_close, |
|---|
| 435 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 436 | | - .hw_params = snd_aicapcm_pcm_hw_params, |
|---|
| 437 | | - .hw_free = snd_aicapcm_pcm_hw_free, |
|---|
| 438 | 402 | .prepare = snd_aicapcm_pcm_prepare, |
|---|
| 439 | 403 | .trigger = snd_aicapcm_pcm_trigger, |
|---|
| 440 | 404 | .pointer = snd_aicapcm_pcm_pointer, |
|---|
| .. | .. |
|---|
| 457 | 421 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, |
|---|
| 458 | 422 | &snd_aicapcm_playback_ops); |
|---|
| 459 | 423 | /* Allocate the DMA buffers */ |
|---|
| 460 | | - err = |
|---|
| 461 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, |
|---|
| 462 | | - SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 463 | | - snd_dma_continuous_data |
|---|
| 464 | | - (GFP_KERNEL), |
|---|
| 465 | | - AICA_BUFFER_SIZE, |
|---|
| 466 | | - AICA_BUFFER_SIZE); |
|---|
| 467 | | - return err; |
|---|
| 424 | + snd_pcm_set_managed_buffer_all(pcm, |
|---|
| 425 | + SNDRV_DMA_TYPE_CONTINUOUS, |
|---|
| 426 | + NULL, |
|---|
| 427 | + AICA_BUFFER_SIZE, |
|---|
| 428 | + AICA_BUFFER_SIZE); |
|---|
| 429 | + return 0; |
|---|
| 468 | 430 | } |
|---|
| 469 | 431 | |
|---|
| 470 | 432 | /* Mixer controls */ |
|---|