| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* -*- linux-c -*- * |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * ALSA driver for the digigram lx6464es interface |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (c) 2008, 2009 Tim Blechmann <tim@klingt.org> |
|---|
| 6 | | - * |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | | - * |
|---|
| 18 | | - * You should have received a copy of the GNU General Public License |
|---|
| 19 | | - * along with this program; see the file COPYING. If not, write to |
|---|
| 20 | | - * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|---|
| 21 | | - * Boston, MA 02111-1307, USA. |
|---|
| 22 | | - * |
|---|
| 23 | 7 | */ |
|---|
| 24 | 8 | |
|---|
| 25 | 9 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 277 | 261 | |
|---|
| 278 | 262 | static int lx_pcm_close(struct snd_pcm_substream *substream) |
|---|
| 279 | 263 | { |
|---|
| 280 | | - int err = 0; |
|---|
| 281 | 264 | dev_dbg(substream->pcm->card->dev, "->lx_pcm_close\n"); |
|---|
| 282 | | - return err; |
|---|
| 265 | + return 0; |
|---|
| 283 | 266 | } |
|---|
| 284 | 267 | |
|---|
| 285 | 268 | static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream |
|---|
| .. | .. |
|---|
| 359 | 342 | struct snd_pcm_hw_params *hw_params, int is_capture) |
|---|
| 360 | 343 | { |
|---|
| 361 | 344 | struct lx6464es *chip = snd_pcm_substream_chip(substream); |
|---|
| 362 | | - int err = 0; |
|---|
| 363 | 345 | |
|---|
| 364 | 346 | dev_dbg(chip->card->dev, "->lx_pcm_hw_params\n"); |
|---|
| 365 | 347 | |
|---|
| 366 | 348 | mutex_lock(&chip->setup_mutex); |
|---|
| 367 | | - |
|---|
| 368 | | - /* set dma buffer */ |
|---|
| 369 | | - err = snd_pcm_lib_malloc_pages(substream, |
|---|
| 370 | | - params_buffer_bytes(hw_params)); |
|---|
| 371 | 349 | |
|---|
| 372 | 350 | if (is_capture) |
|---|
| 373 | 351 | chip->capture_stream.stream = substream; |
|---|
| .. | .. |
|---|
| 375 | 353 | chip->playback_stream.stream = substream; |
|---|
| 376 | 354 | |
|---|
| 377 | 355 | mutex_unlock(&chip->setup_mutex); |
|---|
| 378 | | - return err; |
|---|
| 356 | + return 0; |
|---|
| 379 | 357 | } |
|---|
| 380 | 358 | |
|---|
| 381 | 359 | static int lx_pcm_hw_params_playback(struct snd_pcm_substream *substream, |
|---|
| .. | .. |
|---|
| 416 | 394 | |
|---|
| 417 | 395 | chip->hardware_running[is_capture] = 0; |
|---|
| 418 | 396 | } |
|---|
| 419 | | - |
|---|
| 420 | | - err = snd_pcm_lib_free_pages(substream); |
|---|
| 421 | 397 | |
|---|
| 422 | 398 | if (is_capture) |
|---|
| 423 | 399 | chip->capture_stream.stream = NULL; |
|---|
| .. | .. |
|---|
| 815 | 791 | static const struct snd_pcm_ops lx_ops_playback = { |
|---|
| 816 | 792 | .open = lx_pcm_open, |
|---|
| 817 | 793 | .close = lx_pcm_close, |
|---|
| 818 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 819 | 794 | .prepare = lx_pcm_prepare, |
|---|
| 820 | 795 | .hw_params = lx_pcm_hw_params_playback, |
|---|
| 821 | 796 | .hw_free = lx_pcm_hw_free, |
|---|
| .. | .. |
|---|
| 826 | 801 | static const struct snd_pcm_ops lx_ops_capture = { |
|---|
| 827 | 802 | .open = lx_pcm_open, |
|---|
| 828 | 803 | .close = lx_pcm_close, |
|---|
| 829 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 830 | 804 | .prepare = lx_pcm_prepare, |
|---|
| 831 | 805 | .hw_params = lx_pcm_hw_params_capture, |
|---|
| 832 | 806 | .hw_free = lx_pcm_hw_free, |
|---|
| .. | .. |
|---|
| 862 | 836 | pcm->nonatomic = true; |
|---|
| 863 | 837 | strcpy(pcm->name, card_name); |
|---|
| 864 | 838 | |
|---|
| 865 | | - err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 866 | | - snd_dma_pci_data(chip->pci), |
|---|
| 867 | | - size, size); |
|---|
| 868 | | - if (err < 0) |
|---|
| 869 | | - return err; |
|---|
| 839 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, |
|---|
| 840 | + &chip->pci->dev, size, size); |
|---|
| 870 | 841 | |
|---|
| 871 | 842 | chip->pcm = pcm; |
|---|
| 872 | 843 | chip->capture_stream.is_capture = 1; |
|---|
| .. | .. |
|---|
| 956 | 927 | |
|---|
| 957 | 928 | static int lx_proc_create(struct snd_card *card, struct lx6464es *chip) |
|---|
| 958 | 929 | { |
|---|
| 959 | | - struct snd_info_entry *entry; |
|---|
| 960 | | - int err = snd_card_proc_new(card, "levels", &entry); |
|---|
| 961 | | - if (err < 0) |
|---|
| 962 | | - return err; |
|---|
| 963 | | - |
|---|
| 964 | | - snd_info_set_text_ops(entry, chip, lx_proc_levels_read); |
|---|
| 965 | | - return 0; |
|---|
| 930 | + return snd_card_ro_proc_new(card, "levels", chip, lx_proc_levels_read); |
|---|
| 966 | 931 | } |
|---|
| 967 | 932 | |
|---|
| 968 | 933 | |
|---|
| .. | .. |
|---|
| 973 | 938 | struct lx6464es *chip; |
|---|
| 974 | 939 | int err; |
|---|
| 975 | 940 | |
|---|
| 976 | | - static struct snd_device_ops ops = { |
|---|
| 941 | + static const struct snd_device_ops ops = { |
|---|
| 977 | 942 | .dev_free = snd_lx6464es_dev_free, |
|---|
| 978 | 943 | }; |
|---|
| 979 | 944 | |
|---|
| .. | .. |
|---|
| 1037 | 1002 | goto request_irq_failed; |
|---|
| 1038 | 1003 | } |
|---|
| 1039 | 1004 | chip->irq = pci->irq; |
|---|
| 1005 | + card->sync_irq = chip->irq; |
|---|
| 1040 | 1006 | |
|---|
| 1041 | 1007 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
|---|
| 1042 | 1008 | if (err < 0) |
|---|