.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | ad1816a.c - lowlevel code for Analog Devices AD1816A chip. |
---|
3 | 4 | Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> |
---|
4 | 5 | |
---|
5 | | - This program is free software; you can redistribute it and/or modify |
---|
6 | | - it under the terms of the GNU General Public License as published by |
---|
7 | | - the Free Software Foundation; either version 2 of the License, or |
---|
8 | | - (at your option) any later version. |
---|
9 | | - |
---|
10 | | - This program is distributed in the hope that it will be useful, |
---|
11 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - GNU General Public License for more details. |
---|
14 | | - |
---|
15 | | - You should have received a copy of the GNU General Public License |
---|
16 | | - along with this program; if not, write to the Free Software |
---|
17 | | - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
18 | 6 | */ |
---|
19 | 7 | |
---|
20 | 8 | #include <linux/delay.h> |
---|
.. | .. |
---|
216 | 204 | struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); |
---|
217 | 205 | return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE, |
---|
218 | 206 | SNDRV_PCM_STREAM_CAPTURE, cmd, 1); |
---|
219 | | -} |
---|
220 | | - |
---|
221 | | -static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream, |
---|
222 | | - struct snd_pcm_hw_params *hw_params) |
---|
223 | | -{ |
---|
224 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
---|
225 | | -} |
---|
226 | | - |
---|
227 | | -static int snd_ad1816a_hw_free(struct snd_pcm_substream *substream) |
---|
228 | | -{ |
---|
229 | | - return snd_pcm_lib_free_pages(substream); |
---|
230 | 207 | } |
---|
231 | 208 | |
---|
232 | 209 | static int snd_ad1816a_playback_prepare(struct snd_pcm_substream *substream) |
---|
.. | .. |
---|
432 | 409 | return 0; |
---|
433 | 410 | } |
---|
434 | 411 | |
---|
435 | | -static struct snd_timer_hardware snd_ad1816a_timer_table = { |
---|
| 412 | +static const struct snd_timer_hardware snd_ad1816a_timer_table = { |
---|
436 | 413 | .flags = SNDRV_TIMER_HW_AUTO, |
---|
437 | 414 | .resolution = 10000, |
---|
438 | 415 | .ticks = 65535, |
---|
.. | .. |
---|
518 | 495 | int reg; |
---|
519 | 496 | unsigned long flags; |
---|
520 | 497 | |
---|
521 | | - snd_pcm_suspend_all(chip->pcm); |
---|
522 | 498 | spin_lock_irqsave(&chip->lock, flags); |
---|
523 | 499 | for (reg = 0; reg < 48; reg++) |
---|
524 | 500 | chip->image[reg] = snd_ad1816a_read(chip, reg); |
---|
.. | .. |
---|
601 | 577 | unsigned long port, int irq, int dma1, int dma2, |
---|
602 | 578 | struct snd_ad1816a *chip) |
---|
603 | 579 | { |
---|
604 | | - static struct snd_device_ops ops = { |
---|
| 580 | + static const struct snd_device_ops ops = { |
---|
605 | 581 | .dev_free = snd_ad1816a_dev_free, |
---|
606 | 582 | }; |
---|
607 | 583 | int error; |
---|
.. | .. |
---|
621 | 597 | return -EBUSY; |
---|
622 | 598 | } |
---|
623 | 599 | chip->irq = irq; |
---|
| 600 | + card->sync_irq = chip->irq; |
---|
624 | 601 | if (request_dma(dma1, "AD1816A - 1")) { |
---|
625 | 602 | snd_printk(KERN_ERR "ad1816a: can't grab DMA1 %d\n", dma1); |
---|
626 | 603 | snd_ad1816a_free(chip); |
---|
.. | .. |
---|
657 | 634 | static const struct snd_pcm_ops snd_ad1816a_playback_ops = { |
---|
658 | 635 | .open = snd_ad1816a_playback_open, |
---|
659 | 636 | .close = snd_ad1816a_playback_close, |
---|
660 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
661 | | - .hw_params = snd_ad1816a_hw_params, |
---|
662 | | - .hw_free = snd_ad1816a_hw_free, |
---|
663 | 637 | .prepare = snd_ad1816a_playback_prepare, |
---|
664 | 638 | .trigger = snd_ad1816a_playback_trigger, |
---|
665 | 639 | .pointer = snd_ad1816a_playback_pointer, |
---|
.. | .. |
---|
668 | 642 | static const struct snd_pcm_ops snd_ad1816a_capture_ops = { |
---|
669 | 643 | .open = snd_ad1816a_capture_open, |
---|
670 | 644 | .close = snd_ad1816a_capture_close, |
---|
671 | | - .ioctl = snd_pcm_lib_ioctl, |
---|
672 | | - .hw_params = snd_ad1816a_hw_params, |
---|
673 | | - .hw_free = snd_ad1816a_hw_free, |
---|
674 | 645 | .prepare = snd_ad1816a_capture_prepare, |
---|
675 | 646 | .trigger = snd_ad1816a_capture_trigger, |
---|
676 | 647 | .pointer = snd_ad1816a_capture_pointer, |
---|
.. | .. |
---|
693 | 664 | strcpy(pcm->name, snd_ad1816a_chip_id(chip)); |
---|
694 | 665 | snd_ad1816a_init(chip); |
---|
695 | 666 | |
---|
696 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
697 | | - snd_dma_isa_data(), |
---|
698 | | - 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); |
---|
| 667 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev, |
---|
| 668 | + 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); |
---|
699 | 669 | |
---|
700 | 670 | chip->pcm = pcm; |
---|
701 | 671 | return 0; |
---|
.. | .. |
---|
914 | 884 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); |
---|
915 | 885 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); |
---|
916 | 886 | |
---|
917 | | -static struct snd_kcontrol_new snd_ad1816a_controls[] = { |
---|
| 887 | +static const struct snd_kcontrol_new snd_ad1816a_controls[] = { |
---|
918 | 888 | AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1), |
---|
919 | 889 | AD1816A_DOUBLE_TLV("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1, |
---|
920 | 890 | db_scale_5bit), |
---|