.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /***************************************************************************** |
---|
2 | 3 | * |
---|
3 | 4 | * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and |
---|
4 | 5 | * Jean-Christian Hassler <jhassler@free.fr> |
---|
5 | 6 | * |
---|
6 | 7 | * This file is part of the Audiowerk2 ALSA driver |
---|
7 | | - * |
---|
8 | | - * The Audiowerk2 ALSA driver is free software; you can redistribute it and/or |
---|
9 | | - * modify it under the terms of the GNU General Public License as published by |
---|
10 | | - * the Free Software Foundation; version 2. |
---|
11 | | - * |
---|
12 | | - * The Audiowerk2 ALSA driver is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | | - * |
---|
17 | | - * You should have received a copy of the GNU General Public License |
---|
18 | | - * along with the Audiowerk2 ALSA driver; if not, write to the Free Software |
---|
19 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
---|
20 | | - * USA. |
---|
21 | 8 | * |
---|
22 | 9 | *****************************************************************************/ |
---|
23 | 10 | #include <linux/init.h> |
---|
.. | .. |
---|
122 | 109 | static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream); |
---|
123 | 110 | static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream); |
---|
124 | 111 | static int snd_aw2_pcm_capture_close(struct snd_pcm_substream *substream); |
---|
125 | | -static int snd_aw2_pcm_hw_params(struct snd_pcm_substream *substream, |
---|
126 | | - struct snd_pcm_hw_params *hw_params); |
---|
127 | | -static int snd_aw2_pcm_hw_free(struct snd_pcm_substream *substream); |
---|
128 | 112 | static int snd_aw2_pcm_prepare_playback(struct snd_pcm_substream *substream); |
---|
129 | 113 | static int snd_aw2_pcm_prepare_capture(struct snd_pcm_substream *substream); |
---|
130 | 114 | static int snd_aw2_pcm_trigger_playback(struct snd_pcm_substream *substream, |
---|
.. | .. |
---|
182 | 166 | static const struct snd_pcm_ops snd_aw2_playback_ops = { |
---|
183 | 167 | .open = snd_aw2_pcm_playback_open, |
---|
184 | 168 | .close = snd_aw2_pcm_playback_close, |
---|
185 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
186 | | - .hw_params = snd_aw2_pcm_hw_params, |
---|
187 | | - .hw_free = snd_aw2_pcm_hw_free, |
---|
188 | 169 | .prepare = snd_aw2_pcm_prepare_playback, |
---|
189 | 170 | .trigger = snd_aw2_pcm_trigger_playback, |
---|
190 | 171 | .pointer = snd_aw2_pcm_pointer_playback, |
---|
.. | .. |
---|
194 | 175 | static const struct snd_pcm_ops snd_aw2_capture_ops = { |
---|
195 | 176 | .open = snd_aw2_pcm_capture_open, |
---|
196 | 177 | .close = snd_aw2_pcm_capture_close, |
---|
197 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
198 | | - .hw_params = snd_aw2_pcm_hw_params, |
---|
199 | | - .hw_free = snd_aw2_pcm_hw_free, |
---|
200 | 178 | .prepare = snd_aw2_pcm_prepare_capture, |
---|
201 | 179 | .trigger = snd_aw2_pcm_trigger_capture, |
---|
202 | 180 | .pointer = snd_aw2_pcm_pointer_capture, |
---|
.. | .. |
---|
245 | 223 | { |
---|
246 | 224 | struct aw2 *chip; |
---|
247 | 225 | int err; |
---|
248 | | - static struct snd_device_ops ops = { |
---|
| 226 | + static const struct snd_device_ops ops = { |
---|
249 | 227 | .dev_free = snd_aw2_dev_free, |
---|
250 | 228 | }; |
---|
251 | 229 | |
---|
.. | .. |
---|
284 | 262 | } |
---|
285 | 263 | chip->iobase_phys = pci_resource_start(pci, 0); |
---|
286 | 264 | chip->iobase_virt = |
---|
287 | | - ioremap_nocache(chip->iobase_phys, |
---|
| 265 | + ioremap(chip->iobase_phys, |
---|
288 | 266 | pci_resource_len(pci, 0)); |
---|
289 | 267 | |
---|
290 | 268 | if (chip->iobase_virt == NULL) { |
---|
.. | .. |
---|
309 | 287 | return -EBUSY; |
---|
310 | 288 | } |
---|
311 | 289 | chip->irq = pci->irq; |
---|
| 290 | + card->sync_irq = chip->irq; |
---|
312 | 291 | |
---|
313 | 292 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
---|
314 | 293 | if (err < 0) { |
---|
.. | .. |
---|
422 | 401 | { |
---|
423 | 402 | /* TODO: something to do ? */ |
---|
424 | 403 | return 0; |
---|
425 | | -} |
---|
426 | | - |
---|
427 | | - /* hw_params callback */ |
---|
428 | | -static int snd_aw2_pcm_hw_params(struct snd_pcm_substream *substream, |
---|
429 | | - struct snd_pcm_hw_params *hw_params) |
---|
430 | | -{ |
---|
431 | | - return snd_pcm_lib_malloc_pages(substream, |
---|
432 | | - params_buffer_bytes(hw_params)); |
---|
433 | | -} |
---|
434 | | - |
---|
435 | | -/* hw_free callback */ |
---|
436 | | -static int snd_aw2_pcm_hw_free(struct snd_pcm_substream *substream) |
---|
437 | | -{ |
---|
438 | | - return snd_pcm_lib_free_pages(substream); |
---|
439 | 404 | } |
---|
440 | 405 | |
---|
441 | 406 | /* prepare callback for playback */ |
---|
.. | .. |
---|
624 | 589 | |
---|
625 | 590 | /* pre-allocation of buffers */ |
---|
626 | 591 | /* Preallocate continuous pages. */ |
---|
627 | | - err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_ana, |
---|
628 | | - SNDRV_DMA_TYPE_DEV, |
---|
629 | | - snd_dma_pci_data |
---|
630 | | - (chip->pci), |
---|
631 | | - 64 * 1024, 64 * 1024); |
---|
632 | | - if (err) |
---|
633 | | - dev_err(chip->card->dev, |
---|
634 | | - "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n", |
---|
635 | | - err); |
---|
| 592 | + snd_pcm_set_managed_buffer_all(pcm_playback_ana, |
---|
| 593 | + SNDRV_DMA_TYPE_DEV, |
---|
| 594 | + &chip->pci->dev, |
---|
| 595 | + 64 * 1024, 64 * 1024); |
---|
636 | 596 | |
---|
637 | 597 | err = snd_pcm_new(chip->card, "Audiowerk2 digital playback", 1, 1, 0, |
---|
638 | 598 | &pcm_playback_num); |
---|
.. | .. |
---|
661 | 621 | |
---|
662 | 622 | /* pre-allocation of buffers */ |
---|
663 | 623 | /* Preallocate continuous pages. */ |
---|
664 | | - err = snd_pcm_lib_preallocate_pages_for_all(pcm_playback_num, |
---|
665 | | - SNDRV_DMA_TYPE_DEV, |
---|
666 | | - snd_dma_pci_data |
---|
667 | | - (chip->pci), |
---|
668 | | - 64 * 1024, 64 * 1024); |
---|
669 | | - if (err) |
---|
670 | | - dev_err(chip->card->dev, |
---|
671 | | - "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n", |
---|
672 | | - err); |
---|
| 624 | + snd_pcm_set_managed_buffer_all(pcm_playback_num, |
---|
| 625 | + SNDRV_DMA_TYPE_DEV, |
---|
| 626 | + &chip->pci->dev, |
---|
| 627 | + 64 * 1024, 64 * 1024); |
---|
673 | 628 | |
---|
674 | 629 | err = snd_pcm_new(chip->card, "Audiowerk2 capture", 2, 0, 1, |
---|
675 | 630 | &pcm_capture); |
---|
.. | .. |
---|
699 | 654 | |
---|
700 | 655 | /* pre-allocation of buffers */ |
---|
701 | 656 | /* Preallocate continuous pages. */ |
---|
702 | | - err = snd_pcm_lib_preallocate_pages_for_all(pcm_capture, |
---|
703 | | - SNDRV_DMA_TYPE_DEV, |
---|
704 | | - snd_dma_pci_data |
---|
705 | | - (chip->pci), |
---|
706 | | - 64 * 1024, 64 * 1024); |
---|
707 | | - if (err) |
---|
708 | | - dev_err(chip->card->dev, |
---|
709 | | - "snd_pcm_lib_preallocate_pages_for_all error (0x%X)\n", |
---|
710 | | - err); |
---|
711 | | - |
---|
| 657 | + snd_pcm_set_managed_buffer_all(pcm_capture, |
---|
| 658 | + SNDRV_DMA_TYPE_DEV, |
---|
| 659 | + &chip->pci->dev, |
---|
| 660 | + 64 * 1024, 64 * 1024); |
---|
712 | 661 | |
---|
713 | 662 | /* Create control */ |
---|
714 | 663 | err = snd_ctl_add(chip->card, snd_ctl_new1(&aw2_control, chip)); |
---|