| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | card-opti92x-ad1848.c - driver for OPTi 82c92x based soundcards. |
|---|
| 3 | 4 | Copyright (C) 1998-2000 by Massimo Piccioni <dafastidio@libero.it> |
|---|
| .. | .. |
|---|
| 7 | 8 | |
|---|
| 8 | 9 | Thanks to Maria Grazia Pollarini, Salvatore Vassallo. |
|---|
| 9 | 10 | |
|---|
| 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 | 11 | */ |
|---|
| 24 | 12 | |
|---|
| 25 | 13 | |
|---|
| .. | .. |
|---|
| 175 | 163 | |
|---|
| 176 | 164 | #define DEV_NAME KBUILD_MODNAME |
|---|
| 177 | 165 | |
|---|
| 178 | | -static char * snd_opti9xx_names[] = { |
|---|
| 166 | +static const char * const snd_opti9xx_names[] = { |
|---|
| 179 | 167 | "unknown", |
|---|
| 180 | 168 | "82C928", "82C929", |
|---|
| 181 | 169 | "82C924", "82C925", |
|---|
| .. | .. |
|---|
| 185 | 173 | static int snd_opti9xx_init(struct snd_opti9xx *chip, |
|---|
| 186 | 174 | unsigned short hardware) |
|---|
| 187 | 175 | { |
|---|
| 188 | | - static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
|---|
| 176 | + static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; |
|---|
| 189 | 177 | |
|---|
| 190 | 178 | chip->hardware = hardware; |
|---|
| 191 | 179 | strcpy(chip->name, snd_opti9xx_names[hardware]); |
|---|
| .. | .. |
|---|
| 261 | 249 | retval = inb(chip->mc_base + 9); |
|---|
| 262 | 250 | break; |
|---|
| 263 | 251 | } |
|---|
| 264 | | - /* Fall through */ |
|---|
| 252 | + fallthrough; |
|---|
| 265 | 253 | |
|---|
| 266 | 254 | case OPTi9XX_HW_82C928: |
|---|
| 267 | 255 | case OPTi9XX_HW_82C929: |
|---|
| .. | .. |
|---|
| 304 | 292 | outb(value, chip->mc_base + 9); |
|---|
| 305 | 293 | break; |
|---|
| 306 | 294 | } |
|---|
| 307 | | - /* Fall through */ |
|---|
| 295 | + fallthrough; |
|---|
| 308 | 296 | |
|---|
| 309 | 297 | case OPTi9XX_HW_82C928: |
|---|
| 310 | 298 | case OPTi9XX_HW_82C929: |
|---|
| .. | .. |
|---|
| 355 | 343 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0xf0, 0xfc); |
|---|
| 356 | 344 | /* enable wave audio */ |
|---|
| 357 | 345 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); |
|---|
| 358 | | - /* Fall through */ |
|---|
| 346 | + fallthrough; |
|---|
| 359 | 347 | |
|---|
| 360 | 348 | case OPTi9XX_HW_82C925: |
|---|
| 361 | 349 | /* enable WSS mode */ |
|---|
| .. | .. |
|---|
| 392 | 380 | case OPTi9XX_HW_82C931: |
|---|
| 393 | 381 | /* disable 3D sound (set GPIO1 as output, low) */ |
|---|
| 394 | 382 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c); |
|---|
| 395 | | - case OPTi9XX_HW_82C933: /* FALL THROUGH */ |
|---|
| 383 | + fallthrough; |
|---|
| 384 | + |
|---|
| 385 | + case OPTi9XX_HW_82C933: |
|---|
| 396 | 386 | /* |
|---|
| 397 | 387 | * The BTC 1817DW has QS1000 wavetable which is connected |
|---|
| 398 | 388 | * to the serial digital input of the OPTI931. |
|---|
| .. | .. |
|---|
| 403 | 393 | * or digital input signal. |
|---|
| 404 | 394 | */ |
|---|
| 405 | 395 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(26), 0x01, 0x01); |
|---|
| 406 | | - case OPTi9XX_HW_82C930: /* FALL THROUGH */ |
|---|
| 396 | + fallthrough; |
|---|
| 397 | + |
|---|
| 398 | + case OPTi9XX_HW_82C930: |
|---|
| 407 | 399 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03); |
|---|
| 408 | 400 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff); |
|---|
| 409 | 401 | snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(4), 0x10 | |
|---|
| .. | .. |
|---|
| 563 | 555 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0); |
|---|
| 564 | 556 | static const DECLARE_TLV_DB_SCALE(db_scale_4bit_12db_max, -3300, 300, 0); |
|---|
| 565 | 557 | |
|---|
| 566 | | -static struct snd_kcontrol_new snd_opti93x_controls[] = { |
|---|
| 558 | +static const struct snd_kcontrol_new snd_opti93x_controls[] = { |
|---|
| 567 | 559 | WSS_DOUBLE("Master Playback Switch", 0, |
|---|
| 568 | 560 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), |
|---|
| 569 | 561 | WSS_DOUBLE_TLV("Master Playback Volume", 0, |
|---|
| .. | .. |
|---|
| 821 | 813 | |
|---|
| 822 | 814 | static int snd_opti9xx_probe(struct snd_card *card) |
|---|
| 823 | 815 | { |
|---|
| 824 | | - static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
|---|
| 816 | + static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; |
|---|
| 825 | 817 | int error; |
|---|
| 826 | 818 | int xdma2; |
|---|
| 827 | 819 | struct snd_opti9xx *chip = card->private_data; |
|---|
| .. | .. |
|---|
| 882 | 874 | } |
|---|
| 883 | 875 | #endif |
|---|
| 884 | 876 | chip->irq = irq; |
|---|
| 877 | + card->sync_irq = chip->irq; |
|---|
| 885 | 878 | strcpy(card->driver, chip->name); |
|---|
| 886 | 879 | sprintf(card->shortname, "OPTi %s", card->driver); |
|---|
| 887 | 880 | #if defined(CS4231) || defined(OPTi93X) |
|---|
| .. | .. |
|---|
| 970 | 963 | { |
|---|
| 971 | 964 | struct snd_card *card; |
|---|
| 972 | 965 | int error; |
|---|
| 973 | | - static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; |
|---|
| 966 | + static const long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; |
|---|
| 974 | 967 | #ifdef OPTi93X |
|---|
| 975 | | - static int possible_irqs[] = {5, 9, 10, 11, 7, -1}; |
|---|
| 968 | + static const int possible_irqs[] = {5, 9, 10, 11, 7, -1}; |
|---|
| 976 | 969 | #else |
|---|
| 977 | | - static int possible_irqs[] = {9, 10, 11, 7, -1}; |
|---|
| 970 | + static const int possible_irqs[] = {9, 10, 11, 7, -1}; |
|---|
| 978 | 971 | #endif /* OPTi93X */ |
|---|
| 979 | | - static int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; |
|---|
| 980 | | - static int possible_dma1s[] = {3, 1, 0, -1}; |
|---|
| 972 | + static const int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; |
|---|
| 973 | + static const int possible_dma1s[] = {3, 1, 0, -1}; |
|---|
| 981 | 974 | #if defined(CS4231) || defined(OPTi93X) |
|---|
| 982 | | - static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; |
|---|
| 975 | + static const int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; |
|---|
| 983 | 976 | #endif /* CS4231 || OPTi93X */ |
|---|
| 984 | 977 | |
|---|
| 985 | 978 | if (mpu_port == SNDRV_AUTO_PORT) { |
|---|