hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/pci/emu10k1/emu10k1_main.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
34 * Creative Labs, Inc.
....@@ -8,27 +9,11 @@
89 * Added EMU 1010 support.
910 * General bug fixes and enhancements.
1011 *
11
- *
1212 * BUGS:
1313 * --
1414 *
1515 * TODO:
1616 * --
17
- *
18
- * This program is free software; you can redistribute it and/or modify
19
- * it under the terms of the GNU General Public License as published by
20
- * the Free Software Foundation; either version 2 of the License, or
21
- * (at your option) any later version.
22
- *
23
- * This program is distributed in the hope that it will be useful,
24
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
- * GNU General Public License for more details.
27
- *
28
- * You should have received a copy of the GNU General Public License
29
- * along with this program; if not, write to the Free Software
30
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31
- *
3217 */
3318
3419 #include <linux/sched.h>
....@@ -115,7 +100,7 @@
115100 }
116101 }
117102
118
-static unsigned int spi_dac_init[] = {
103
+static const unsigned int spi_dac_init[] = {
119104 0x00ff,
120105 0x02ff,
121106 0x0400,
....@@ -139,7 +124,7 @@
139124 0x1400,
140125 };
141126
142
-static unsigned int i2c_adc_init[][2] = {
127
+static const unsigned int i2c_adc_init[][2] = {
143128 { 0x17, 0x00 }, /* Reset */
144129 { 0x07, 0x00 }, /* Timeout */
145130 { 0x0b, 0x22 }, /* Interface control */
....@@ -638,7 +623,7 @@
638623 static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
639624 {
640625 unsigned long special_port;
641
- unsigned int value;
626
+ __always_unused unsigned int value;
642627
643628 /* Special initialisation routine
644629 * before the rest of the IO-Ports become active.
....@@ -668,7 +653,7 @@
668653 int n, i;
669654 int reg;
670655 int value;
671
- unsigned int write_post;
656
+ __always_unused unsigned int write_post;
672657 unsigned long flags;
673658
674659 if (!fw_entry)
....@@ -1298,7 +1283,7 @@
12981283 return snd_emu10k1_free(emu);
12991284 }
13001285
1301
-static struct snd_emu_chip_details emu_chip_details[] = {
1286
+static const struct snd_emu_chip_details emu_chip_details[] = {
13021287 /* Audigy 5/Rx SB1550 */
13031288 /* Tested by michael@gernoth.net 28 Mar 2015 */
13041289 /* DSP: CA10300-IAT LF
....@@ -1804,9 +1789,10 @@
18041789 int idx, err;
18051790 int is_audigy;
18061791 size_t page_table_size;
1792
+ __le32 *pgtbl;
18071793 unsigned int silent_page;
18081794 const struct snd_emu_chip_details *c;
1809
- static struct snd_device_ops ops = {
1795
+ static const struct snd_device_ops ops = {
18101796 .dev_free = snd_emu10k1_dev_free,
18111797 };
18121798
....@@ -1882,22 +1868,8 @@
18821868 c->name, pci->vendor, pci->device,
18831869 emu->serial);
18841870
1885
- if (!*card->id && c->id) {
1886
- int i, n = 0;
1871
+ if (!*card->id && c->id)
18871872 strlcpy(card->id, c->id, sizeof(card->id));
1888
- for (;;) {
1889
- for (i = 0; i < snd_ecards_limit; i++) {
1890
- if (snd_cards[i] && !strcmp(snd_cards[i]->id, card->id))
1891
- break;
1892
- }
1893
- if (i >= snd_ecards_limit)
1894
- break;
1895
- n++;
1896
- if (n >= SNDRV_CARDS)
1897
- break;
1898
- snprintf(card->id, sizeof(card->id), "%s_%d", c->id, n);
1899
- }
1900
- }
19011873
19021874 is_audigy = emu->audigy = c->emu10k2_chip;
19031875
....@@ -2013,6 +1985,7 @@
20131985 goto error;
20141986 }
20151987 emu->irq = pci->irq;
1988
+ card->sync_irq = emu->irq;
20161989
20171990 /*
20181991 * Init to 0x02109204 :
....@@ -2037,8 +2010,9 @@
20372010 /* Clear silent pages and set up pointers */
20382011 memset(emu->silent_page.area, 0, emu->silent_page.bytes);
20392012 silent_page = emu->silent_page.addr << emu->address_mode;
2013
+ pgtbl = (__le32 *)emu->ptb_pages.area;
20402014 for (idx = 0; idx < (emu->address_mode ? MAXPAGES1 : MAXPAGES0); idx++)
2041
- ((u32 *)emu->ptb_pages.area)[idx] = cpu_to_le32(silent_page | idx);
2015
+ pgtbl[idx] = cpu_to_le32(silent_page | idx);
20422016
20432017 /* set up voice indices */
20442018 for (idx = 0; idx < NUM_G; idx++) {
....@@ -2078,7 +2052,7 @@
20782052 }
20792053
20802054 #ifdef CONFIG_PM_SLEEP
2081
-static unsigned char saved_regs[] = {
2055
+static const unsigned char saved_regs[] = {
20822056 CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP,
20832057 FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL,
20842058 ATKHLDM, DCYSUSM, LFOVAL2, IP, IFATN, PEFE, FMMOD, TREMFRQ, FM2FRQ2,
....@@ -2087,7 +2061,7 @@
20872061 SPBYPASS, AC97SLOT, CDSRCS, GPSRCS, ZVSRCS, MICIDX, ADCIDX, FXIDX,
20882062 0xff /* end */
20892063 };
2090
-static unsigned char saved_regs_audigy[] = {
2064
+static const unsigned char saved_regs_audigy[] = {
20912065 A_ADCIDX, A_MICIDX, A_FXWC1, A_FXWC2, A_SAMPLE_RATE,
20922066 A_FXRT2, A_SENDAMOUNTS, A_FXRT1,
20932067 0xff /* end */
....@@ -2122,7 +2096,7 @@
21222096 void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu)
21232097 {
21242098 int i;
2125
- unsigned char *reg;
2099
+ const unsigned char *reg;
21262100 unsigned int *val;
21272101
21282102 val = emu->saved_ptr;
....@@ -2155,7 +2129,7 @@
21552129 void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu)
21562130 {
21572131 int i;
2158
- unsigned char *reg;
2132
+ const unsigned char *reg;
21592133 unsigned int *val;
21602134
21612135 snd_emu10k1_audio_enable(emu);