| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 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. |
|---|
| 15 | 3 | */ |
|---|
| 16 | 4 | |
|---|
| 17 | 5 | /* |
|---|
| .. | .. |
|---|
| 221 | 209 | { |
|---|
| 222 | 210 | vortex_t *chip = snd_pcm_substream_chip(substream); |
|---|
| 223 | 211 | stream_t *stream = (stream_t *) (substream->runtime->private_data); |
|---|
| 224 | | - int err; |
|---|
| 225 | 212 | |
|---|
| 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 | | - } |
|---|
| 233 | 213 | /* |
|---|
| 234 | 214 | pr_info( "Vortex: periods %d, period_bytes %d, channels = %d\n", params_periods(hw_params), |
|---|
| 235 | 215 | params_period_bytes(hw_params), params_channels(hw_params)); |
|---|
| .. | .. |
|---|
| 316 | 296 | substream->runtime->private_data = NULL; |
|---|
| 317 | 297 | spin_unlock_irq(&chip->lock); |
|---|
| 318 | 298 | |
|---|
| 319 | | - return snd_pcm_lib_free_pages(substream); |
|---|
| 299 | + return 0; |
|---|
| 320 | 300 | } |
|---|
| 321 | 301 | |
|---|
| 322 | 302 | /* prepare callback */ |
|---|
| .. | .. |
|---|
| 442 | 422 | static const struct snd_pcm_ops snd_vortex_playback_ops = { |
|---|
| 443 | 423 | .open = snd_vortex_pcm_open, |
|---|
| 444 | 424 | .close = snd_vortex_pcm_close, |
|---|
| 445 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 446 | 425 | .hw_params = snd_vortex_pcm_hw_params, |
|---|
| 447 | 426 | .hw_free = snd_vortex_pcm_hw_free, |
|---|
| 448 | 427 | .prepare = snd_vortex_pcm_prepare, |
|---|
| 449 | 428 | .trigger = snd_vortex_pcm_trigger, |
|---|
| 450 | 429 | .pointer = snd_vortex_pcm_pointer, |
|---|
| 451 | | - .page = snd_pcm_sgbuf_ops_page, |
|---|
| 452 | 430 | }; |
|---|
| 453 | 431 | |
|---|
| 454 | 432 | /* |
|---|
| 455 | 433 | * definitions of capture are omitted here... |
|---|
| 456 | 434 | */ |
|---|
| 457 | 435 | |
|---|
| 458 | | -static char *vortex_pcm_prettyname[VORTEX_PCM_LAST] = { |
|---|
| 436 | +static const char * const vortex_pcm_prettyname[VORTEX_PCM_LAST] = { |
|---|
| 459 | 437 | CARD_NAME " ADB", |
|---|
| 460 | 438 | CARD_NAME " SPDIF", |
|---|
| 461 | 439 | CARD_NAME " A3D", |
|---|
| 462 | 440 | CARD_NAME " WT", |
|---|
| 463 | 441 | CARD_NAME " I2S", |
|---|
| 464 | 442 | }; |
|---|
| 465 | | -static char *vortex_pcm_name[VORTEX_PCM_LAST] = { |
|---|
| 443 | +static const char * const vortex_pcm_name[VORTEX_PCM_LAST] = { |
|---|
| 466 | 444 | "adb", |
|---|
| 467 | 445 | "spdif", |
|---|
| 468 | 446 | "a3d", |
|---|
| .. | .. |
|---|
| 519 | 497 | } |
|---|
| 520 | 498 | |
|---|
| 521 | 499 | /* spdif controls */ |
|---|
| 522 | | -static struct snd_kcontrol_new snd_vortex_mixer_spdif[] = { |
|---|
| 500 | +static const struct snd_kcontrol_new snd_vortex_mixer_spdif[] = { |
|---|
| 523 | 501 | { |
|---|
| 524 | 502 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
|---|
| 525 | 503 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
|---|
| .. | .. |
|---|
| 649 | 627 | |
|---|
| 650 | 628 | /* pre-allocation of Scatter-Gather buffers */ |
|---|
| 651 | 629 | |
|---|
| 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); |
|---|
| 655 | 632 | |
|---|
| 656 | 633 | switch (VORTEX_PCM_TYPE(pcm)) { |
|---|
| 657 | 634 | case VORTEX_PCM_ADB: |
|---|