.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
---|
3 | 4 | * Routines for control of ESS ES1688/688/488 chip |
---|
4 | | - * |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, write to the Free Software |
---|
18 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
19 | | - * |
---|
20 | 5 | */ |
---|
21 | 6 | |
---|
22 | 7 | #include <linux/init.h> |
---|
.. | .. |
---|
121 | 106 | static int snd_es1688_probe(struct snd_es1688 *chip) |
---|
122 | 107 | { |
---|
123 | 108 | unsigned long flags; |
---|
124 | | - unsigned short major, minor, hw; |
---|
| 109 | + unsigned short major, minor; |
---|
125 | 110 | int i; |
---|
126 | 111 | |
---|
127 | 112 | /* |
---|
.. | .. |
---|
166 | 151 | if (!chip->version) |
---|
167 | 152 | return -ENODEV; /* probably SB */ |
---|
168 | 153 | |
---|
169 | | - hw = ES1688_HW_AUTO; |
---|
170 | 154 | switch (chip->version & 0xfff0) { |
---|
171 | 155 | case 0x4880: |
---|
172 | 156 | snd_printk(KERN_ERR "[0x%lx] ESS: AudioDrive ES488 detected, " |
---|
173 | 157 | "but driver is in another place\n", chip->port); |
---|
174 | 158 | return -ENODEV; |
---|
175 | 159 | case 0x6880: |
---|
176 | | - hw = (chip->version & 0x0f) >= 8 ? ES1688_HW_1688 : ES1688_HW_688; |
---|
177 | 160 | break; |
---|
178 | 161 | default: |
---|
179 | 162 | snd_printk(KERN_ERR "[0x%lx] ESS: unknown AudioDrive chip " |
---|
.. | .. |
---|
197 | 180 | |
---|
198 | 181 | static int snd_es1688_init(struct snd_es1688 * chip, int enable) |
---|
199 | 182 | { |
---|
200 | | - static int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; |
---|
| 183 | + static const int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; |
---|
201 | 184 | unsigned long flags; |
---|
202 | 185 | int cfg, irq_bits, dma, dma_bits, tmp, tmp1; |
---|
203 | 186 | |
---|
.. | .. |
---|
326 | 309 | snd_es1688_write(chip, 0xa2, divider); |
---|
327 | 310 | } |
---|
328 | 311 | |
---|
329 | | -static int snd_es1688_ioctl(struct snd_pcm_substream *substream, |
---|
330 | | - unsigned int cmd, void *arg) |
---|
331 | | -{ |
---|
332 | | - return snd_pcm_lib_ioctl(substream, cmd, arg); |
---|
333 | | -} |
---|
334 | | - |
---|
335 | 312 | static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char value) |
---|
336 | 313 | { |
---|
337 | 314 | int val; |
---|
.. | .. |
---|
356 | 333 | snd_es1688_write(chip, 0xb8, (val & 0xf0) | value); |
---|
357 | 334 | spin_unlock(&chip->reg_lock); |
---|
358 | 335 | return 0; |
---|
359 | | -} |
---|
360 | | - |
---|
361 | | -static int snd_es1688_hw_params(struct snd_pcm_substream *substream, |
---|
362 | | - struct snd_pcm_hw_params *hw_params) |
---|
363 | | -{ |
---|
364 | | - return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
---|
365 | | -} |
---|
366 | | - |
---|
367 | | -static int snd_es1688_hw_free(struct snd_pcm_substream *substream) |
---|
368 | | -{ |
---|
369 | | - return snd_pcm_lib_free_pages(substream); |
---|
370 | 336 | } |
---|
371 | 337 | |
---|
372 | 338 | static int snd_es1688_playback_prepare(struct snd_pcm_substream *substream) |
---|
.. | .. |
---|
646 | 612 | int dma8, |
---|
647 | 613 | unsigned short hardware) |
---|
648 | 614 | { |
---|
649 | | - static struct snd_device_ops ops = { |
---|
| 615 | + static const struct snd_device_ops ops = { |
---|
650 | 616 | .dev_free = snd_es1688_dev_free, |
---|
651 | 617 | }; |
---|
652 | 618 | |
---|
.. | .. |
---|
672 | 638 | } |
---|
673 | 639 | |
---|
674 | 640 | chip->irq = irq; |
---|
| 641 | + card->sync_irq = chip->irq; |
---|
675 | 642 | err = request_dma(dma8, "ES1688"); |
---|
676 | 643 | |
---|
677 | 644 | if (err < 0) { |
---|
.. | .. |
---|
709 | 676 | static const struct snd_pcm_ops snd_es1688_playback_ops = { |
---|
710 | 677 | .open = snd_es1688_playback_open, |
---|
711 | 678 | .close = snd_es1688_playback_close, |
---|
712 | | - .ioctl = snd_es1688_ioctl, |
---|
713 | | - .hw_params = snd_es1688_hw_params, |
---|
714 | | - .hw_free = snd_es1688_hw_free, |
---|
715 | 679 | .prepare = snd_es1688_playback_prepare, |
---|
716 | 680 | .trigger = snd_es1688_playback_trigger, |
---|
717 | 681 | .pointer = snd_es1688_playback_pointer, |
---|
.. | .. |
---|
720 | 684 | static const struct snd_pcm_ops snd_es1688_capture_ops = { |
---|
721 | 685 | .open = snd_es1688_capture_open, |
---|
722 | 686 | .close = snd_es1688_capture_close, |
---|
723 | | - .ioctl = snd_es1688_ioctl, |
---|
724 | | - .hw_params = snd_es1688_hw_params, |
---|
725 | | - .hw_free = snd_es1688_hw_free, |
---|
726 | 687 | .prepare = snd_es1688_capture_prepare, |
---|
727 | 688 | .trigger = snd_es1688_capture_trigger, |
---|
728 | 689 | .pointer = snd_es1688_capture_pointer, |
---|
.. | .. |
---|
745 | 706 | strcpy(pcm->name, snd_es1688_chip_id(chip)); |
---|
746 | 707 | chip->pcm = pcm; |
---|
747 | 708 | |
---|
748 | | - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
---|
749 | | - snd_dma_isa_data(), |
---|
750 | | - 64*1024, 64*1024); |
---|
| 709 | + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, |
---|
| 710 | + 64*1024, 64*1024); |
---|
751 | 711 | return 0; |
---|
752 | 712 | } |
---|
753 | 713 | |
---|
.. | .. |
---|
964 | 924 | return change; |
---|
965 | 925 | } |
---|
966 | 926 | |
---|
967 | | -static struct snd_kcontrol_new snd_es1688_controls[] = { |
---|
| 927 | +static const struct snd_kcontrol_new snd_es1688_controls[] = { |
---|
968 | 928 | ES1688_DOUBLE("Master Playback Volume", 0, ES1688_MASTER_DEV, ES1688_MASTER_DEV, 4, 0, 15, 0), |
---|
969 | 929 | ES1688_DOUBLE("PCM Playback Volume", 0, ES1688_PCM_DEV, ES1688_PCM_DEV, 4, 0, 15, 0), |
---|
970 | 930 | ES1688_DOUBLE("Line Playback Volume", 0, ES1688_LINE_DEV, ES1688_LINE_DEV, 4, 0, 15, 0), |
---|
.. | .. |
---|
986 | 946 | |
---|
987 | 947 | #define ES1688_INIT_TABLE_SIZE (sizeof(snd_es1688_init_table)/2) |
---|
988 | 948 | |
---|
989 | | -static unsigned char snd_es1688_init_table[][2] = { |
---|
| 949 | +static const unsigned char snd_es1688_init_table[][2] = { |
---|
990 | 950 | { ES1688_MASTER_DEV, 0 }, |
---|
991 | 951 | { ES1688_PCM_DEV, 0 }, |
---|
992 | 952 | { ES1688_LINE_DEV, 0 }, |
---|