| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * card-als4000.c - driver for Avance Logic ALS4000 based soundcards. |
|---|
| 3 | 4 | * Copyright (C) 2000 by Bart Hartgers <bart@etpmod.phys.tue.nl>, |
|---|
| .. | .. |
|---|
| 5 | 6 | * Copyright (C) 2002, 2008 by Andreas Mohr <hw7oshyuv3001@sneakemail.com> |
|---|
| 6 | 7 | * |
|---|
| 7 | 8 | * Framework borrowed from Massimo Piccioni's card-als100.c. |
|---|
| 8 | | - * |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 12 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 13 | | - * (at your option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | | - * GNU General Public License for more details. |
|---|
| 19 | | - |
|---|
| 20 | | - * You should have received a copy of the GNU General Public License |
|---|
| 21 | | - * along with this program; if not, write to the Free Software |
|---|
| 22 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 23 | 9 | * |
|---|
| 24 | 10 | * NOTES |
|---|
| 25 | 11 | * |
|---|
| .. | .. |
|---|
| 368 | 354 | }; |
|---|
| 369 | 355 | #define capture_cmd(chip) (capture_cmd_vals[(chip)->capture_format]) |
|---|
| 370 | 356 | |
|---|
| 371 | | -static int snd_als4000_hw_params(struct snd_pcm_substream *substream, |
|---|
| 372 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 373 | | -{ |
|---|
| 374 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
|---|
| 375 | | -} |
|---|
| 376 | | - |
|---|
| 377 | | -static int snd_als4000_hw_free(struct snd_pcm_substream *substream) |
|---|
| 378 | | -{ |
|---|
| 379 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 380 | | - return 0; |
|---|
| 381 | | -} |
|---|
| 382 | | - |
|---|
| 383 | 357 | static int snd_als4000_capture_prepare(struct snd_pcm_substream *substream) |
|---|
| 384 | 358 | { |
|---|
| 385 | 359 | struct snd_sb *chip = snd_pcm_substream_chip(substream); |
|---|
| .. | .. |
|---|
| 647 | 621 | struct snd_sb *chip = snd_pcm_substream_chip(substream); |
|---|
| 648 | 622 | |
|---|
| 649 | 623 | chip->playback_substream = NULL; |
|---|
| 650 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 651 | 624 | return 0; |
|---|
| 652 | 625 | } |
|---|
| 653 | 626 | |
|---|
| .. | .. |
|---|
| 666 | 639 | struct snd_sb *chip = snd_pcm_substream_chip(substream); |
|---|
| 667 | 640 | |
|---|
| 668 | 641 | chip->capture_substream = NULL; |
|---|
| 669 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 670 | 642 | return 0; |
|---|
| 671 | 643 | } |
|---|
| 672 | 644 | |
|---|
| .. | .. |
|---|
| 675 | 647 | static const struct snd_pcm_ops snd_als4000_playback_ops = { |
|---|
| 676 | 648 | .open = snd_als4000_playback_open, |
|---|
| 677 | 649 | .close = snd_als4000_playback_close, |
|---|
| 678 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 679 | | - .hw_params = snd_als4000_hw_params, |
|---|
| 680 | | - .hw_free = snd_als4000_hw_free, |
|---|
| 681 | 650 | .prepare = snd_als4000_playback_prepare, |
|---|
| 682 | 651 | .trigger = snd_als4000_playback_trigger, |
|---|
| 683 | 652 | .pointer = snd_als4000_playback_pointer |
|---|
| .. | .. |
|---|
| 686 | 655 | static const struct snd_pcm_ops snd_als4000_capture_ops = { |
|---|
| 687 | 656 | .open = snd_als4000_capture_open, |
|---|
| 688 | 657 | .close = snd_als4000_capture_close, |
|---|
| 689 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 690 | | - .hw_params = snd_als4000_hw_params, |
|---|
| 691 | | - .hw_free = snd_als4000_hw_free, |
|---|
| 692 | 658 | .prepare = snd_als4000_capture_prepare, |
|---|
| 693 | 659 | .trigger = snd_als4000_capture_trigger, |
|---|
| 694 | 660 | .pointer = snd_als4000_capture_pointer |
|---|
| .. | .. |
|---|
| 707 | 673 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_als4000_playback_ops); |
|---|
| 708 | 674 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_als4000_capture_ops); |
|---|
| 709 | 675 | |
|---|
| 710 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), |
|---|
| 711 | | - 64*1024, 64*1024); |
|---|
| 676 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 677 | + &chip->pci->dev, 64*1024, 64*1024); |
|---|
| 712 | 678 | |
|---|
| 713 | 679 | chip->pcm = pcm; |
|---|
| 714 | 680 | |
|---|
| .. | .. |
|---|
| 994 | 960 | |
|---|
| 995 | 961 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
|---|
| 996 | 962 | |
|---|
| 997 | | - snd_pcm_suspend_all(chip->pcm); |
|---|
| 998 | 963 | snd_sbmixer_suspend(chip); |
|---|
| 999 | 964 | return 0; |
|---|
| 1000 | 965 | } |
|---|