.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
---|
3 | 4 | * Creative Labs, Inc. |
---|
.. | .. |
---|
8 | 9 | * Added EMU 1010 support. |
---|
9 | 10 | * General bug fixes and enhancements. |
---|
10 | 11 | * |
---|
11 | | - * |
---|
12 | 12 | * BUGS: |
---|
13 | 13 | * -- |
---|
14 | 14 | * |
---|
15 | 15 | * TODO: |
---|
16 | 16 | * -- |
---|
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 | | - * |
---|
32 | 17 | */ |
---|
33 | 18 | |
---|
34 | 19 | #include <linux/sched.h> |
---|
.. | .. |
---|
115 | 100 | } |
---|
116 | 101 | } |
---|
117 | 102 | |
---|
118 | | -static unsigned int spi_dac_init[] = { |
---|
| 103 | +static const unsigned int spi_dac_init[] = { |
---|
119 | 104 | 0x00ff, |
---|
120 | 105 | 0x02ff, |
---|
121 | 106 | 0x0400, |
---|
.. | .. |
---|
139 | 124 | 0x1400, |
---|
140 | 125 | }; |
---|
141 | 126 | |
---|
142 | | -static unsigned int i2c_adc_init[][2] = { |
---|
| 127 | +static const unsigned int i2c_adc_init[][2] = { |
---|
143 | 128 | { 0x17, 0x00 }, /* Reset */ |
---|
144 | 129 | { 0x07, 0x00 }, /* Timeout */ |
---|
145 | 130 | { 0x0b, 0x22 }, /* Interface control */ |
---|
.. | .. |
---|
638 | 623 | static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu) |
---|
639 | 624 | { |
---|
640 | 625 | unsigned long special_port; |
---|
641 | | - unsigned int value; |
---|
| 626 | + __always_unused unsigned int value; |
---|
642 | 627 | |
---|
643 | 628 | /* Special initialisation routine |
---|
644 | 629 | * before the rest of the IO-Ports become active. |
---|
.. | .. |
---|
668 | 653 | int n, i; |
---|
669 | 654 | int reg; |
---|
670 | 655 | int value; |
---|
671 | | - unsigned int write_post; |
---|
| 656 | + __always_unused unsigned int write_post; |
---|
672 | 657 | unsigned long flags; |
---|
673 | 658 | |
---|
674 | 659 | if (!fw_entry) |
---|
.. | .. |
---|
1298 | 1283 | return snd_emu10k1_free(emu); |
---|
1299 | 1284 | } |
---|
1300 | 1285 | |
---|
1301 | | -static struct snd_emu_chip_details emu_chip_details[] = { |
---|
| 1286 | +static const struct snd_emu_chip_details emu_chip_details[] = { |
---|
1302 | 1287 | /* Audigy 5/Rx SB1550 */ |
---|
1303 | 1288 | /* Tested by michael@gernoth.net 28 Mar 2015 */ |
---|
1304 | 1289 | /* DSP: CA10300-IAT LF |
---|
.. | .. |
---|
1804 | 1789 | int idx, err; |
---|
1805 | 1790 | int is_audigy; |
---|
1806 | 1791 | size_t page_table_size; |
---|
| 1792 | + __le32 *pgtbl; |
---|
1807 | 1793 | unsigned int silent_page; |
---|
1808 | 1794 | const struct snd_emu_chip_details *c; |
---|
1809 | | - static struct snd_device_ops ops = { |
---|
| 1795 | + static const struct snd_device_ops ops = { |
---|
1810 | 1796 | .dev_free = snd_emu10k1_dev_free, |
---|
1811 | 1797 | }; |
---|
1812 | 1798 | |
---|
.. | .. |
---|
1882 | 1868 | c->name, pci->vendor, pci->device, |
---|
1883 | 1869 | emu->serial); |
---|
1884 | 1870 | |
---|
1885 | | - if (!*card->id && c->id) { |
---|
1886 | | - int i, n = 0; |
---|
| 1871 | + if (!*card->id && c->id) |
---|
1887 | 1872 | 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 | | - } |
---|
1901 | 1873 | |
---|
1902 | 1874 | is_audigy = emu->audigy = c->emu10k2_chip; |
---|
1903 | 1875 | |
---|
.. | .. |
---|
2013 | 1985 | goto error; |
---|
2014 | 1986 | } |
---|
2015 | 1987 | emu->irq = pci->irq; |
---|
| 1988 | + card->sync_irq = emu->irq; |
---|
2016 | 1989 | |
---|
2017 | 1990 | /* |
---|
2018 | 1991 | * Init to 0x02109204 : |
---|
.. | .. |
---|
2037 | 2010 | /* Clear silent pages and set up pointers */ |
---|
2038 | 2011 | memset(emu->silent_page.area, 0, emu->silent_page.bytes); |
---|
2039 | 2012 | silent_page = emu->silent_page.addr << emu->address_mode; |
---|
| 2013 | + pgtbl = (__le32 *)emu->ptb_pages.area; |
---|
2040 | 2014 | 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); |
---|
2042 | 2016 | |
---|
2043 | 2017 | /* set up voice indices */ |
---|
2044 | 2018 | for (idx = 0; idx < NUM_G; idx++) { |
---|
.. | .. |
---|
2078 | 2052 | } |
---|
2079 | 2053 | |
---|
2080 | 2054 | #ifdef CONFIG_PM_SLEEP |
---|
2081 | | -static unsigned char saved_regs[] = { |
---|
| 2055 | +static const unsigned char saved_regs[] = { |
---|
2082 | 2056 | CPF, PTRX, CVCF, VTFT, Z1, Z2, PSST, DSL, CCCA, CCR, CLP, |
---|
2083 | 2057 | FXRT, MAPA, MAPB, ENVVOL, ATKHLDV, DCYSUSV, LFOVAL1, ENVVAL, |
---|
2084 | 2058 | ATKHLDM, DCYSUSM, LFOVAL2, IP, IFATN, PEFE, FMMOD, TREMFRQ, FM2FRQ2, |
---|
.. | .. |
---|
2087 | 2061 | SPBYPASS, AC97SLOT, CDSRCS, GPSRCS, ZVSRCS, MICIDX, ADCIDX, FXIDX, |
---|
2088 | 2062 | 0xff /* end */ |
---|
2089 | 2063 | }; |
---|
2090 | | -static unsigned char saved_regs_audigy[] = { |
---|
| 2064 | +static const unsigned char saved_regs_audigy[] = { |
---|
2091 | 2065 | A_ADCIDX, A_MICIDX, A_FXWC1, A_FXWC2, A_SAMPLE_RATE, |
---|
2092 | 2066 | A_FXRT2, A_SENDAMOUNTS, A_FXRT1, |
---|
2093 | 2067 | 0xff /* end */ |
---|
.. | .. |
---|
2122 | 2096 | void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu) |
---|
2123 | 2097 | { |
---|
2124 | 2098 | int i; |
---|
2125 | | - unsigned char *reg; |
---|
| 2099 | + const unsigned char *reg; |
---|
2126 | 2100 | unsigned int *val; |
---|
2127 | 2101 | |
---|
2128 | 2102 | val = emu->saved_ptr; |
---|
.. | .. |
---|
2155 | 2129 | void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu) |
---|
2156 | 2130 | { |
---|
2157 | 2131 | int i; |
---|
2158 | | - unsigned char *reg; |
---|
| 2132 | + const unsigned char *reg; |
---|
2159 | 2133 | unsigned int *val; |
---|
2160 | 2134 | |
---|
2161 | 2135 | snd_emu10k1_audio_enable(emu); |
---|