| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ALSA soundcard driver for Miro miroSOUND PCM1 pro |
|---|
| 3 | 4 | * miroSOUND PCM12 |
|---|
| .. | .. |
|---|
| 6 | 7 | * Copyright (C) 2004-2005 Martin Langer <martin-langer@gmx.de> |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Based on OSS ACI and ALSA OPTi9xx drivers |
|---|
| 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 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 18 | | - * GNU General Public License for more details. |
|---|
| 19 | | - * |
|---|
| 20 | | - * You should have received a copy of the GNU General Public License |
|---|
| 21 | | - * along with this program; if not, write to the Free Software |
|---|
| 22 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 23 | 10 | */ |
|---|
| 24 | 11 | |
|---|
| 25 | 12 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 132 | 119 | |
|---|
| 133 | 120 | static struct snd_miro_aci aci_device; |
|---|
| 134 | 121 | |
|---|
| 135 | | -static char * snd_opti9xx_names[] = { |
|---|
| 122 | +static const char * const snd_opti9xx_names[] = { |
|---|
| 136 | 123 | "unknown", |
|---|
| 137 | 124 | "82C928", "82C929", |
|---|
| 138 | 125 | "82C924", "82C925", |
|---|
| .. | .. |
|---|
| 176 | 163 | switch (timeout-ACI_MINTIME) { |
|---|
| 177 | 164 | case 0 ... 9: |
|---|
| 178 | 165 | out /= 10; |
|---|
| 179 | | - /* fall through */ |
|---|
| 166 | + fallthrough; |
|---|
| 180 | 167 | case 10 ... 19: |
|---|
| 181 | 168 | out /= 10; |
|---|
| 182 | | - /* fall through */ |
|---|
| 169 | + fallthrough; |
|---|
| 183 | 170 | case 20 ... 30: |
|---|
| 184 | 171 | out /= 10; |
|---|
| 185 | | - /* fall through */ |
|---|
| 172 | + fallthrough; |
|---|
| 186 | 173 | default: |
|---|
| 187 | 174 | set_current_state(TASK_UNINTERRUPTIBLE); |
|---|
| 188 | 175 | schedule_timeout(out); |
|---|
| .. | .. |
|---|
| 590 | 577 | return change; |
|---|
| 591 | 578 | } |
|---|
| 592 | 579 | |
|---|
| 593 | | -static struct snd_kcontrol_new snd_miro_controls[] = { |
|---|
| 580 | +static const struct snd_kcontrol_new snd_miro_controls[] = { |
|---|
| 594 | 581 | MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), |
|---|
| 595 | 582 | MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), |
|---|
| 596 | 583 | MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), |
|---|
| .. | .. |
|---|
| 602 | 589 | |
|---|
| 603 | 590 | /* Equalizer with seven bands (only PCM20) |
|---|
| 604 | 591 | from -12dB up to +12dB on each band */ |
|---|
| 605 | | -static struct snd_kcontrol_new snd_miro_eq_controls[] = { |
|---|
| 592 | +static const struct snd_kcontrol_new snd_miro_eq_controls[] = { |
|---|
| 606 | 593 | MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), |
|---|
| 607 | 594 | MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), |
|---|
| 608 | 595 | MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), |
|---|
| .. | .. |
|---|
| 612 | 599 | MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), |
|---|
| 613 | 600 | }; |
|---|
| 614 | 601 | |
|---|
| 615 | | -static struct snd_kcontrol_new snd_miro_radio_control[] = { |
|---|
| 602 | +static const struct snd_kcontrol_new snd_miro_radio_control[] = { |
|---|
| 616 | 603 | MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), |
|---|
| 617 | 604 | }; |
|---|
| 618 | 605 | |
|---|
| 619 | | -static struct snd_kcontrol_new snd_miro_line_control[] = { |
|---|
| 606 | +static const struct snd_kcontrol_new snd_miro_line_control[] = { |
|---|
| 620 | 607 | MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), |
|---|
| 621 | 608 | }; |
|---|
| 622 | 609 | |
|---|
| 623 | | -static struct snd_kcontrol_new snd_miro_preamp_control[] = { |
|---|
| 610 | +static const struct snd_kcontrol_new snd_miro_preamp_control[] = { |
|---|
| 624 | 611 | { |
|---|
| 625 | 612 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
|---|
| 626 | 613 | .name = "Mic Boost", |
|---|
| .. | .. |
|---|
| 630 | 617 | .put = snd_miro_put_preamp, |
|---|
| 631 | 618 | }}; |
|---|
| 632 | 619 | |
|---|
| 633 | | -static struct snd_kcontrol_new snd_miro_amp_control[] = { |
|---|
| 620 | +static const struct snd_kcontrol_new snd_miro_amp_control[] = { |
|---|
| 634 | 621 | { |
|---|
| 635 | 622 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
|---|
| 636 | 623 | .name = "Line Boost", |
|---|
| .. | .. |
|---|
| 640 | 627 | .put = snd_miro_put_amp, |
|---|
| 641 | 628 | }}; |
|---|
| 642 | 629 | |
|---|
| 643 | | -static struct snd_kcontrol_new snd_miro_capture_control[] = { |
|---|
| 630 | +static const struct snd_kcontrol_new snd_miro_capture_control[] = { |
|---|
| 644 | 631 | { |
|---|
| 645 | 632 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
|---|
| 646 | 633 | .name = "PCM Capture Switch", |
|---|
| .. | .. |
|---|
| 650 | 637 | .put = snd_miro_put_capture, |
|---|
| 651 | 638 | }}; |
|---|
| 652 | 639 | |
|---|
| 653 | | -static unsigned char aci_init_values[][2] = { |
|---|
| 640 | +static const unsigned char aci_init_values[][2] = { |
|---|
| 654 | 641 | { ACI_SET_MUTE, 0x00 }, |
|---|
| 655 | 642 | { ACI_SET_POWERAMP, 0x00 }, |
|---|
| 656 | 643 | { ACI_SET_PREAMP, 0x00 }, |
|---|
| .. | .. |
|---|
| 777 | 764 | static int snd_miro_init(struct snd_miro *chip, |
|---|
| 778 | 765 | unsigned short hardware) |
|---|
| 779 | 766 | { |
|---|
| 780 | | - static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
|---|
| 767 | + static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
|---|
| 781 | 768 | |
|---|
| 782 | 769 | chip->hardware = hardware; |
|---|
| 783 | 770 | strcpy(chip->name, snd_opti9xx_names[hardware]); |
|---|
| .. | .. |
|---|
| 837 | 824 | retval = inb(chip->mc_base + 9); |
|---|
| 838 | 825 | break; |
|---|
| 839 | 826 | } |
|---|
| 840 | | - /* fall through */ |
|---|
| 827 | + fallthrough; |
|---|
| 841 | 828 | |
|---|
| 842 | 829 | case OPTi9XX_HW_82C929: |
|---|
| 843 | 830 | retval = inb(chip->mc_base + reg); |
|---|
| .. | .. |
|---|
| 867 | 854 | outb(value, chip->mc_base + 9); |
|---|
| 868 | 855 | break; |
|---|
| 869 | 856 | } |
|---|
| 870 | | - /* fall through */ |
|---|
| 857 | + fallthrough; |
|---|
| 871 | 858 | |
|---|
| 872 | 859 | case OPTi9XX_HW_82C929: |
|---|
| 873 | 860 | outb(value, chip->mc_base + reg); |
|---|
| .. | .. |
|---|
| 1000 | 987 | static void snd_miro_proc_init(struct snd_card *card, |
|---|
| 1001 | 988 | struct snd_miro *miro) |
|---|
| 1002 | 989 | { |
|---|
| 1003 | | - struct snd_info_entry *entry; |
|---|
| 1004 | | - |
|---|
| 1005 | | - if (!snd_card_proc_new(card, "miro", &entry)) |
|---|
| 1006 | | - snd_info_set_text_ops(entry, miro, snd_miro_proc_read); |
|---|
| 990 | + snd_card_ro_proc_new(card, "miro", miro, snd_miro_proc_read); |
|---|
| 1007 | 991 | } |
|---|
| 1008 | 992 | |
|---|
| 1009 | 993 | /* |
|---|
| .. | .. |
|---|
| 1406 | 1390 | |
|---|
| 1407 | 1391 | static int snd_miro_isa_probe(struct device *devptr, unsigned int n) |
|---|
| 1408 | 1392 | { |
|---|
| 1409 | | - static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
|---|
| 1410 | | - static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; |
|---|
| 1411 | | - static int possible_irqs[] = {11, 9, 10, 7, -1}; |
|---|
| 1412 | | - static int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; |
|---|
| 1413 | | - static int possible_dma1s[] = {3, 1, 0, -1}; |
|---|
| 1414 | | - static int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, |
|---|
| 1393 | + static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
|---|
| 1394 | + static const long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; |
|---|
| 1395 | + static const int possible_irqs[] = {11, 9, 10, 7, -1}; |
|---|
| 1396 | + static const int possible_mpu_irqs[] = {10, 5, 9, 7, -1}; |
|---|
| 1397 | + static const int possible_dma1s[] = {3, 1, 0, -1}; |
|---|
| 1398 | + static const int possible_dma2s[][2] = { {1, -1}, {0, -1}, {-1, -1}, |
|---|
| 1415 | 1399 | {0, -1} }; |
|---|
| 1416 | 1400 | |
|---|
| 1417 | 1401 | int error; |
|---|