.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * sh_dac_audio.c - SuperH DAC audio driver for ALSA |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2009 by Rafael Ignacio Zurita <rizurita@yahoo.com> |
---|
5 | 6 | * |
---|
6 | | - * |
---|
7 | 7 | * Based on sh_dac_audio.c (Copyright (C) 2004, 2005 by Andriy Skulysh) |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | | - * |
---|
23 | 8 | */ |
---|
24 | 9 | |
---|
25 | 10 | #include <linux/hrtimer.h> |
---|
.. | .. |
---|
140 | 125 | return 0; |
---|
141 | 126 | } |
---|
142 | 127 | |
---|
143 | | -static int snd_sh_dac_pcm_hw_params(struct snd_pcm_substream *substream, |
---|
144 | | - struct snd_pcm_hw_params *hw_params) |
---|
145 | | -{ |
---|
146 | | - return snd_pcm_lib_malloc_pages(substream, |
---|
147 | | - params_buffer_bytes(hw_params)); |
---|
148 | | -} |
---|
149 | | - |
---|
150 | | -static int snd_sh_dac_pcm_hw_free(struct snd_pcm_substream *substream) |
---|
151 | | -{ |
---|
152 | | - return snd_pcm_lib_free_pages(substream); |
---|
153 | | -} |
---|
154 | | - |
---|
155 | 128 | static int snd_sh_dac_pcm_prepare(struct snd_pcm_substream *substream) |
---|
156 | 129 | { |
---|
157 | 130 | struct snd_sh_dac *chip = snd_pcm_substream_chip(substream); |
---|
.. | .. |
---|
252 | 225 | static const struct snd_pcm_ops snd_sh_dac_pcm_ops = { |
---|
253 | 226 | .open = snd_sh_dac_pcm_open, |
---|
254 | 227 | .close = snd_sh_dac_pcm_close, |
---|
255 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
256 | | - .hw_params = snd_sh_dac_pcm_hw_params, |
---|
257 | | - .hw_free = snd_sh_dac_pcm_hw_free, |
---|
258 | 228 | .prepare = snd_sh_dac_pcm_prepare, |
---|
259 | 229 | .trigger = snd_sh_dac_pcm_trigger, |
---|
260 | 230 | .pointer = snd_sh_dac_pcm_pointer, |
---|
.. | .. |
---|
279 | 249 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sh_dac_pcm_ops); |
---|
280 | 250 | |
---|
281 | 251 | /* buffer size=48K */ |
---|
282 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, |
---|
283 | | - snd_dma_continuous_data(GFP_KERNEL), |
---|
284 | | - 48 * 1024, |
---|
285 | | - 48 * 1024); |
---|
| 252 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, |
---|
| 253 | + NULL, 48 * 1024, 48 * 1024); |
---|
286 | 254 | |
---|
287 | 255 | return 0; |
---|
288 | 256 | } |
---|
.. | .. |
---|
354 | 322 | struct snd_sh_dac *chip; |
---|
355 | 323 | int err; |
---|
356 | 324 | |
---|
357 | | - static struct snd_device_ops ops = { |
---|
| 325 | + static const struct snd_device_ops ops = { |
---|
358 | 326 | .dev_free = snd_sh_dac_dev_free, |
---|
359 | 327 | }; |
---|
360 | 328 | |
---|