| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
|---|
| 3 | 4 | * Routines for control of 16-bit SoundBlaster cards and clones |
|---|
| .. | .. |
|---|
| 15 | 16 | * 16bit DMA transfers from DSP chip (capture) until 8bit transfer |
|---|
| 16 | 17 | * to DSP chip (playback) starts. This bug can be avoided with |
|---|
| 17 | 18 | * "16bit DMA Allocation" setting set to Playback or Capture. |
|---|
| 18 | | - * |
|---|
| 19 | | - * |
|---|
| 20 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 21 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 22 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 23 | | - * (at your option) any later version. |
|---|
| 24 | | - * |
|---|
| 25 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 26 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 27 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 28 | | - * GNU General Public License for more details. |
|---|
| 29 | | - * |
|---|
| 30 | | - * You should have received a copy of the GNU General Public License |
|---|
| 31 | | - * along with this program; if not, write to the Free Software |
|---|
| 32 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 33 | | - * |
|---|
| 34 | 19 | */ |
|---|
| 35 | 20 | |
|---|
| 36 | 21 | #include <linux/io.h> |
|---|
| .. | .. |
|---|
| 245 | 230 | snd_sbdsp_command(chip, rate & 0xff); |
|---|
| 246 | 231 | } |
|---|
| 247 | 232 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
|---|
| 248 | | -} |
|---|
| 249 | | - |
|---|
| 250 | | -static int snd_sb16_hw_params(struct snd_pcm_substream *substream, |
|---|
| 251 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 252 | | -{ |
|---|
| 253 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
|---|
| 254 | | -} |
|---|
| 255 | | - |
|---|
| 256 | | -static int snd_sb16_hw_free(struct snd_pcm_substream *substream) |
|---|
| 257 | | -{ |
|---|
| 258 | | - snd_pcm_lib_free_pages(substream); |
|---|
| 259 | | - return 0; |
|---|
| 260 | 233 | } |
|---|
| 261 | 234 | |
|---|
| 262 | 235 | static int snd_sb16_playback_prepare(struct snd_pcm_substream *substream) |
|---|
| .. | .. |
|---|
| 844 | 817 | static const struct snd_pcm_ops snd_sb16_playback_ops = { |
|---|
| 845 | 818 | .open = snd_sb16_playback_open, |
|---|
| 846 | 819 | .close = snd_sb16_playback_close, |
|---|
| 847 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 848 | | - .hw_params = snd_sb16_hw_params, |
|---|
| 849 | | - .hw_free = snd_sb16_hw_free, |
|---|
| 850 | 820 | .prepare = snd_sb16_playback_prepare, |
|---|
| 851 | 821 | .trigger = snd_sb16_playback_trigger, |
|---|
| 852 | 822 | .pointer = snd_sb16_playback_pointer, |
|---|
| .. | .. |
|---|
| 855 | 825 | static const struct snd_pcm_ops snd_sb16_capture_ops = { |
|---|
| 856 | 826 | .open = snd_sb16_capture_open, |
|---|
| 857 | 827 | .close = snd_sb16_capture_close, |
|---|
| 858 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 859 | | - .hw_params = snd_sb16_hw_params, |
|---|
| 860 | | - .hw_free = snd_sb16_hw_free, |
|---|
| 861 | 828 | .prepare = snd_sb16_capture_prepare, |
|---|
| 862 | 829 | .trigger = snd_sb16_capture_trigger, |
|---|
| 863 | 830 | .pointer = snd_sb16_capture_pointer, |
|---|
| .. | .. |
|---|
| 884 | 851 | else |
|---|
| 885 | 852 | pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; |
|---|
| 886 | 853 | |
|---|
| 887 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 888 | | - snd_dma_isa_data(), |
|---|
| 889 | | - 64*1024, 128*1024); |
|---|
| 854 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 855 | + card->dev, 64*1024, 128*1024); |
|---|
| 890 | 856 | return 0; |
|---|
| 891 | 857 | } |
|---|
| 892 | 858 | |
|---|