| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Linux driver for TerraTec DMX 6Fire USB |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Author: Torsten Schenk <torsten.schenk@zoho.com> |
|---|
| 7 | 8 | * Created: Jan 01, 2011 |
|---|
| 8 | 9 | * Copyright: (C) Torsten Schenk |
|---|
| 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 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #include "pcm.h" |
|---|
| .. | .. |
|---|
| 450 | 446 | return 0; |
|---|
| 451 | 447 | } |
|---|
| 452 | 448 | |
|---|
| 453 | | -static int usb6fire_pcm_hw_params(struct snd_pcm_substream *alsa_sub, |
|---|
| 454 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 455 | | -{ |
|---|
| 456 | | - return snd_pcm_lib_alloc_vmalloc_buffer(alsa_sub, |
|---|
| 457 | | - params_buffer_bytes(hw_params)); |
|---|
| 458 | | -} |
|---|
| 459 | | - |
|---|
| 460 | | -static int usb6fire_pcm_hw_free(struct snd_pcm_substream *alsa_sub) |
|---|
| 461 | | -{ |
|---|
| 462 | | - return snd_pcm_lib_free_vmalloc_buffer(alsa_sub); |
|---|
| 463 | | -} |
|---|
| 464 | | - |
|---|
| 465 | 449 | static int usb6fire_pcm_prepare(struct snd_pcm_substream *alsa_sub) |
|---|
| 466 | 450 | { |
|---|
| 467 | 451 | struct pcm_runtime *rt = snd_pcm_substream_chip(alsa_sub); |
|---|
| .. | .. |
|---|
| 558 | 542 | static const struct snd_pcm_ops pcm_ops = { |
|---|
| 559 | 543 | .open = usb6fire_pcm_open, |
|---|
| 560 | 544 | .close = usb6fire_pcm_close, |
|---|
| 561 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 562 | | - .hw_params = usb6fire_pcm_hw_params, |
|---|
| 563 | | - .hw_free = usb6fire_pcm_hw_free, |
|---|
| 564 | 545 | .prepare = usb6fire_pcm_prepare, |
|---|
| 565 | 546 | .trigger = usb6fire_pcm_trigger, |
|---|
| 566 | 547 | .pointer = usb6fire_pcm_pointer, |
|---|
| 567 | | - .page = snd_pcm_lib_get_vmalloc_page, |
|---|
| 568 | 548 | }; |
|---|
| 569 | 549 | |
|---|
| 570 | 550 | static void usb6fire_pcm_init_urb(struct pcm_urb *urb, |
|---|
| .. | .. |
|---|
| 663 | 643 | strcpy(pcm->name, "DMX 6Fire USB"); |
|---|
| 664 | 644 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &pcm_ops); |
|---|
| 665 | 645 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pcm_ops); |
|---|
| 646 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0); |
|---|
| 666 | 647 | |
|---|
| 667 | | - if (ret) { |
|---|
| 668 | | - usb6fire_pcm_buffers_destroy(rt); |
|---|
| 669 | | - kfree(rt); |
|---|
| 670 | | - dev_err(&chip->dev->dev, |
|---|
| 671 | | - "error preallocating pcm buffers.\n"); |
|---|
| 672 | | - return ret; |
|---|
| 673 | | - } |
|---|
| 674 | 648 | rt->instance = pcm; |
|---|
| 675 | 649 | |
|---|
| 676 | 650 | chip->pcm = rt; |
|---|