| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2006-2008 Daniel Mack, Karsten Wiese |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 6 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | | - * (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program; if not, write to the Free Software |
|---|
| 16 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 17 | 4 | */ |
|---|
| 18 | 5 | |
|---|
| 19 | 6 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 43 | 30 | #define MAKE_CHECKBYTE(cdev,stream,i) \ |
|---|
| 44 | 31 | (stream << 1) | (~(i / (cdev->n_streams * BYTES_PER_SAMPLE_USB)) & 1) |
|---|
| 45 | 32 | |
|---|
| 46 | | -static struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { |
|---|
| 33 | +static const struct snd_pcm_hardware snd_usb_caiaq_pcm_hardware = { |
|---|
| 47 | 34 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
|---|
| 48 | 35 | SNDRV_PCM_INFO_BLOCK_TRANSFER), |
|---|
| 49 | 36 | .formats = SNDRV_PCM_FMTBIT_S24_3BE, |
|---|
| .. | .. |
|---|
| 180 | 167 | return 0; |
|---|
| 181 | 168 | } |
|---|
| 182 | 169 | |
|---|
| 183 | | -static int snd_usb_caiaq_pcm_hw_params(struct snd_pcm_substream *sub, |
|---|
| 184 | | - struct snd_pcm_hw_params *hw_params) |
|---|
| 185 | | -{ |
|---|
| 186 | | - return snd_pcm_lib_alloc_vmalloc_buffer(sub, |
|---|
| 187 | | - params_buffer_bytes(hw_params)); |
|---|
| 188 | | -} |
|---|
| 189 | | - |
|---|
| 190 | 170 | static int snd_usb_caiaq_pcm_hw_free(struct snd_pcm_substream *sub) |
|---|
| 191 | 171 | { |
|---|
| 192 | 172 | struct snd_usb_caiaqdev *cdev = snd_pcm_substream_chip(sub); |
|---|
| 193 | 173 | deactivate_substream(cdev, sub); |
|---|
| 194 | | - return snd_pcm_lib_free_vmalloc_buffer(sub); |
|---|
| 174 | + return 0; |
|---|
| 195 | 175 | } |
|---|
| 196 | 176 | |
|---|
| 197 | 177 | /* this should probably go upstream */ |
|---|
| .. | .. |
|---|
| 199 | 179 | #error "Change this table" |
|---|
| 200 | 180 | #endif |
|---|
| 201 | 181 | |
|---|
| 202 | | -static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, |
|---|
| 182 | +static const unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, |
|---|
| 203 | 183 | 48000, 64000, 88200, 96000, 176400, 192000 }; |
|---|
| 204 | 184 | |
|---|
| 205 | 185 | static int snd_usb_caiaq_pcm_prepare(struct snd_pcm_substream *substream) |
|---|
| .. | .. |
|---|
| 341 | 321 | static const struct snd_pcm_ops snd_usb_caiaq_ops = { |
|---|
| 342 | 322 | .open = snd_usb_caiaq_substream_open, |
|---|
| 343 | 323 | .close = snd_usb_caiaq_substream_close, |
|---|
| 344 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 345 | | - .hw_params = snd_usb_caiaq_pcm_hw_params, |
|---|
| 346 | 324 | .hw_free = snd_usb_caiaq_pcm_hw_free, |
|---|
| 347 | 325 | .prepare = snd_usb_caiaq_pcm_prepare, |
|---|
| 348 | 326 | .trigger = snd_usb_caiaq_pcm_trigger, |
|---|
| 349 | 327 | .pointer = snd_usb_caiaq_pcm_pointer, |
|---|
| 350 | | - .page = snd_pcm_lib_get_vmalloc_page, |
|---|
| 351 | 328 | }; |
|---|
| 352 | 329 | |
|---|
| 353 | 330 | static void check_for_elapsed_periods(struct snd_usb_caiaqdev *cdev, |
|---|
| .. | .. |
|---|
| 843 | 820 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_SESSIONIO): |
|---|
| 844 | 821 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): |
|---|
| 845 | 822 | cdev->samplerates |= SNDRV_PCM_RATE_192000; |
|---|
| 846 | | - /* fall thru */ |
|---|
| 823 | + fallthrough; |
|---|
| 847 | 824 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO2DJ): |
|---|
| 848 | 825 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): |
|---|
| 849 | 826 | case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): |
|---|
| .. | .. |
|---|
| 856 | 833 | &snd_usb_caiaq_ops); |
|---|
| 857 | 834 | snd_pcm_set_ops(cdev->pcm, SNDRV_PCM_STREAM_CAPTURE, |
|---|
| 858 | 835 | &snd_usb_caiaq_ops); |
|---|
| 836 | + snd_pcm_set_managed_buffer_all(cdev->pcm, SNDRV_DMA_TYPE_VMALLOC, |
|---|
| 837 | + NULL, 0, 0); |
|---|
| 859 | 838 | |
|---|
| 860 | 839 | cdev->data_cb_info = |
|---|
| 861 | 840 | kmalloc_array(N_URBS, sizeof(struct snd_usb_caiaq_cb_info), |
|---|