.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
---|
3 | 4 | * Universal interface for Audio Codec '97 |
---|
4 | 5 | * |
---|
5 | 6 | * For more details look to AC '97 component specification revision 2.2 |
---|
6 | 7 | * by Intel Corporation (http://developer.intel.com). |
---|
7 | | - * |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | | - * |
---|
23 | 8 | */ |
---|
24 | 9 | |
---|
25 | 10 | #include <linux/delay.h> |
---|
.. | .. |
---|
233 | 218 | case AC97_ID_ST_AC97_ID4: |
---|
234 | 219 | if (reg == 0x08) |
---|
235 | 220 | return 0; |
---|
236 | | - /* fall through */ |
---|
| 221 | + fallthrough; |
---|
237 | 222 | case AC97_ID_ST7597: |
---|
238 | 223 | if (reg == 0x22 || reg == 0x7a) |
---|
239 | 224 | return 1; |
---|
240 | | - /* fall through */ |
---|
| 225 | + fallthrough; |
---|
241 | 226 | case AC97_ID_AK4540: |
---|
242 | 227 | case AC97_ID_AK4542: |
---|
243 | 228 | if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) |
---|
.. | .. |
---|
611 | 596 | return err; |
---|
612 | 597 | } |
---|
613 | 598 | |
---|
614 | | -static const struct snd_kcontrol_new snd_ac97_controls_master_mono[2] = { |
---|
615 | | -AC97_SINGLE("Master Mono Playback Switch", AC97_MASTER_MONO, 15, 1, 1), |
---|
616 | | -AC97_SINGLE("Master Mono Playback Volume", AC97_MASTER_MONO, 0, 31, 1) |
---|
617 | | -}; |
---|
618 | | - |
---|
619 | 599 | static const struct snd_kcontrol_new snd_ac97_controls_tone[2] = { |
---|
620 | 600 | AC97_SINGLE("Tone Control - Bass", AC97_MASTER_TONE, 8, 15, 1), |
---|
621 | 601 | AC97_SINGLE("Tone Control - Treble", AC97_MASTER_TONE, 0, 15, 1) |
---|
.. | .. |
---|
958 | 938 | int codec = kcontrol->private_value & 3; |
---|
959 | 939 | |
---|
960 | 940 | mutex_lock(&ac97->page_mutex); |
---|
961 | | - ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31); |
---|
962 | | - ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31); |
---|
| 941 | + ucontrol->value.integer.value[0] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 8) & 31); |
---|
| 942 | + ucontrol->value.integer.value[1] = 31 - ((ac97->spec.ad18xx.pcmreg[codec] >> 0) & 31); |
---|
963 | 943 | mutex_unlock(&ac97->page_mutex); |
---|
964 | 944 | return 0; |
---|
965 | 945 | } |
---|
.. | .. |
---|
1773 | 1753 | { |
---|
1774 | 1754 | unsigned int result = 0; |
---|
1775 | 1755 | int i; |
---|
1776 | | - static unsigned short ctl_bits[] = { |
---|
| 1756 | + static const unsigned short ctl_bits[] = { |
---|
1777 | 1757 | AC97_SC_SPSR_44K, AC97_SC_SPSR_32K, AC97_SC_SPSR_48K |
---|
1778 | 1758 | }; |
---|
1779 | | - static unsigned int rate_bits[] = { |
---|
| 1759 | + static const unsigned int rate_bits[] = { |
---|
1780 | 1760 | SNDRV_PCM_RATE_44100, SNDRV_PCM_RATE_32000, SNDRV_PCM_RATE_48000 |
---|
1781 | 1761 | }; |
---|
1782 | 1762 | |
---|
.. | .. |
---|
1914 | 1894 | * |
---|
1915 | 1895 | * Return: Zero if successful, or a negative error code on failure. |
---|
1916 | 1896 | */ |
---|
1917 | | -int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops, |
---|
| 1897 | +int snd_ac97_bus(struct snd_card *card, int num, |
---|
| 1898 | + const struct snd_ac97_bus_ops *ops, |
---|
1918 | 1899 | void *private_data, struct snd_ac97_bus **rbus) |
---|
1919 | 1900 | { |
---|
1920 | 1901 | int err; |
---|
1921 | 1902 | struct snd_ac97_bus *bus; |
---|
1922 | | - static struct snd_device_ops dev_ops = { |
---|
| 1903 | + static const struct snd_device_ops dev_ops = { |
---|
1923 | 1904 | .dev_free = snd_ac97_bus_dev_free, |
---|
1924 | 1905 | }; |
---|
1925 | 1906 | |
---|
.. | .. |
---|
1965 | 1946 | snd_ac97_get_short_name(ac97)); |
---|
1966 | 1947 | if ((err = device_register(&ac97->dev)) < 0) { |
---|
1967 | 1948 | ac97_err(ac97, "Can't register ac97 bus\n"); |
---|
| 1949 | + put_device(&ac97->dev); |
---|
1968 | 1950 | ac97->dev.bus = NULL; |
---|
1969 | 1951 | return err; |
---|
1970 | 1952 | } |
---|
.. | .. |
---|
2019 | 2001 | unsigned long end_time; |
---|
2020 | 2002 | unsigned int reg; |
---|
2021 | 2003 | const struct ac97_codec_id *pid; |
---|
2022 | | - static struct snd_device_ops ops = { |
---|
| 2004 | + static const struct snd_device_ops ops = { |
---|
2023 | 2005 | .dev_free = snd_ac97_dev_free, |
---|
2024 | 2006 | .dev_register = snd_ac97_dev_register, |
---|
2025 | 2007 | .dev_disconnect = snd_ac97_dev_disconnect, |
---|
.. | .. |
---|
2365 | 2347 | |
---|
2366 | 2348 | enum { PWIDX_ADC, PWIDX_FRONT, PWIDX_CLFE, PWIDX_SURR, PWIDX_MIC, PWIDX_SIZE }; |
---|
2367 | 2349 | |
---|
2368 | | -static struct ac97_power_reg power_regs[PWIDX_SIZE] = { |
---|
| 2350 | +static const struct ac97_power_reg power_regs[PWIDX_SIZE] = { |
---|
2369 | 2351 | [PWIDX_ADC] = { AC97_PCM_LR_ADC_RATE, AC97_POWERDOWN, AC97_PD_PR0}, |
---|
2370 | 2352 | [PWIDX_FRONT] = { AC97_PCM_FRONT_DAC_RATE, AC97_POWERDOWN, AC97_PD_PR1}, |
---|
2371 | 2353 | [PWIDX_CLFE] = { AC97_PCM_LFE_DAC_RATE, AC97_EXTENDED_STATUS, |
---|
.. | .. |
---|
2848 | 2830 | int (*func)(struct snd_ac97 *); |
---|
2849 | 2831 | }; |
---|
2850 | 2832 | |
---|
2851 | | -static struct quirk_table applicable_quirks[] = { |
---|
| 2833 | +static const struct quirk_table applicable_quirks[] = { |
---|
2852 | 2834 | { "none", NULL }, |
---|
2853 | 2835 | { "hp_only", tune_hp_only }, |
---|
2854 | 2836 | { "swap_hp", tune_swap_hp }, |
---|
.. | .. |
---|
2876 | 2858 | static int apply_quirk_str(struct snd_ac97 *ac97, const char *typestr) |
---|
2877 | 2859 | { |
---|
2878 | 2860 | int i; |
---|
2879 | | - struct quirk_table *q; |
---|
| 2861 | + const struct quirk_table *q; |
---|
2880 | 2862 | |
---|
2881 | 2863 | for (i = 0; i < ARRAY_SIZE(applicable_quirks); i++) { |
---|
2882 | 2864 | q = &applicable_quirks[i]; |
---|