.. | .. |
---|
| 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 |
---|
.. | .. |
---|
5 | 6 | * For more details look to AC '97 component specification revision 2.2 |
---|
6 | 7 | * by Intel Corporation (http://developer.intel.com) and to datasheets |
---|
7 | 8 | * for specific codecs. |
---|
8 | | - * |
---|
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 | | - * |
---|
24 | 9 | */ |
---|
25 | 10 | |
---|
26 | 11 | #include "ac97_local.h" |
---|
.. | .. |
---|
34 | 19 | const char *name); |
---|
35 | 20 | static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name, |
---|
36 | 21 | const unsigned int *tlv, |
---|
37 | | - const char * const *slaves); |
---|
| 22 | + const char * const *followers); |
---|
38 | 23 | |
---|
39 | 24 | /* |
---|
40 | 25 | * Chip specific initialization |
---|
.. | .. |
---|
1226 | 1211 | |
---|
1227 | 1212 | static int patch_sigmatel_stac9758(struct snd_ac97 * ac97) |
---|
1228 | 1213 | { |
---|
1229 | | - static unsigned short regs[4] = { |
---|
| 1214 | + static const unsigned short regs[4] = { |
---|
1230 | 1215 | AC97_SIGMATEL_OUTSEL, |
---|
1231 | 1216 | AC97_SIGMATEL_IOMISC, |
---|
1232 | 1217 | AC97_SIGMATEL_INSEL, |
---|
1233 | 1218 | AC97_SIGMATEL_VARIOUS |
---|
1234 | 1219 | }; |
---|
1235 | | - static unsigned short def_regs[4] = { |
---|
| 1220 | + static const unsigned short def_regs[4] = { |
---|
1236 | 1221 | /* OUTSEL */ 0xd794, /* CL:CL, SR:SR, LO:MX, LI:DS, MI:DS */ |
---|
1237 | 1222 | /* IOMISC */ 0x2001, |
---|
1238 | 1223 | /* INSEL */ 0x0201, /* LI:LI, MI:M1 */ |
---|
1239 | 1224 | /* VARIOUS */ 0x0040 |
---|
1240 | 1225 | }; |
---|
1241 | | - static unsigned short m675_regs[4] = { |
---|
| 1226 | + static const unsigned short m675_regs[4] = { |
---|
1242 | 1227 | /* OUTSEL */ 0xfc70, /* CL:MX, SR:MX, LO:DS, LI:MX, MI:DS */ |
---|
1243 | 1228 | /* IOMISC */ 0x2102, /* HP amp on */ |
---|
1244 | 1229 | /* INSEL */ 0x0203, /* LI:LI, MI:FR */ |
---|
1245 | 1230 | /* VARIOUS */ 0x0041 /* stereo mic */ |
---|
1246 | 1231 | }; |
---|
1247 | | - unsigned short *pregs = def_regs; |
---|
| 1232 | + const unsigned short *pregs = def_regs; |
---|
1248 | 1233 | int i; |
---|
1249 | 1234 | |
---|
1250 | 1235 | /* Gateway M675 notebook */ |
---|
.. | .. |
---|
1371 | 1356 | } |
---|
1372 | 1357 | |
---|
1373 | 1358 | /* |
---|
1374 | | - * Analog Device AD18xx, AD19xx codecs |
---|
| 1359 | + * Analog Devices AD18xx, AD19xx codecs |
---|
1375 | 1360 | */ |
---|
1376 | 1361 | #ifdef CONFIG_PM |
---|
1377 | 1362 | static void ad18xx_resume(struct snd_ac97 *ac97) |
---|
1378 | 1363 | { |
---|
1379 | | - static unsigned short setup_regs[] = { |
---|
| 1364 | + static const unsigned short setup_regs[] = { |
---|
1380 | 1365 | AC97_AD_MISC, AC97_AD_SERIAL_CFG, AC97_AD_JACK_SPDIF, |
---|
1381 | 1366 | }; |
---|
1382 | 1367 | int i, codec; |
---|
.. | .. |
---|
1485 | 1470 | |
---|
1486 | 1471 | static int patch_ad1881_chained1(struct snd_ac97 * ac97, int idx, unsigned short codec_bits) |
---|
1487 | 1472 | { |
---|
1488 | | - static int cfg_bits[3] = { 1<<12, 1<<14, 1<<13 }; |
---|
| 1473 | + static const int cfg_bits[3] = { 1<<12, 1<<14, 1<<13 }; |
---|
1489 | 1474 | unsigned short val; |
---|
1490 | 1475 | |
---|
1491 | 1476 | snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, cfg_bits[idx]); |
---|
.. | .. |
---|
1806 | 1791 | AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0), |
---|
1807 | 1792 | }; |
---|
1808 | 1793 | |
---|
1809 | | -/* black list to avoid HP/Line jack-sense controls |
---|
| 1794 | +/* deny list to avoid HP/Line jack-sense controls |
---|
1810 | 1795 | * (SS vendor << 16 | device) |
---|
1811 | 1796 | */ |
---|
1812 | | -static unsigned int ad1981_jacks_blacklist[] = { |
---|
| 1797 | +static const unsigned int ad1981_jacks_denylist[] = { |
---|
1813 | 1798 | 0x10140523, /* Thinkpad R40 */ |
---|
1814 | 1799 | 0x10140534, /* Thinkpad X31 */ |
---|
1815 | 1800 | 0x10140537, /* Thinkpad T41p */ |
---|
.. | .. |
---|
1836 | 1821 | |
---|
1837 | 1822 | static int patch_ad1981a_specific(struct snd_ac97 * ac97) |
---|
1838 | 1823 | { |
---|
1839 | | - if (check_list(ac97, ad1981_jacks_blacklist)) |
---|
| 1824 | + if (check_list(ac97, ad1981_jacks_denylist)) |
---|
1840 | 1825 | return 0; |
---|
1841 | 1826 | return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, |
---|
1842 | 1827 | ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); |
---|
.. | .. |
---|
1850 | 1835 | #endif |
---|
1851 | 1836 | }; |
---|
1852 | 1837 | |
---|
1853 | | -/* white list to enable HP jack-sense bits |
---|
| 1838 | +/* allow list to enable HP jack-sense bits |
---|
1854 | 1839 | * (SS vendor << 16 | device) |
---|
1855 | 1840 | */ |
---|
1856 | | -static unsigned int ad1981_jacks_whitelist[] = { |
---|
| 1841 | +static const unsigned int ad1981_jacks_allowlist[] = { |
---|
1857 | 1842 | 0x0e11005a, /* HP nc4000/4010 */ |
---|
1858 | 1843 | 0x103c0890, /* HP nc6000 */ |
---|
1859 | 1844 | 0x103c0938, /* HP nc4220 */ |
---|
.. | .. |
---|
1868 | 1853 | |
---|
1869 | 1854 | static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97) |
---|
1870 | 1855 | { |
---|
1871 | | - if (check_list(ac97, ad1981_jacks_whitelist)) |
---|
| 1856 | + if (check_list(ac97, ad1981_jacks_allowlist)) |
---|
1872 | 1857 | /* enable headphone jack sense */ |
---|
1873 | 1858 | snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11); |
---|
1874 | 1859 | } |
---|
.. | .. |
---|
1892 | 1877 | |
---|
1893 | 1878 | if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) |
---|
1894 | 1879 | return err; |
---|
1895 | | - if (check_list(ac97, ad1981_jacks_blacklist)) |
---|
| 1880 | + if (check_list(ac97, ad1981_jacks_denylist)) |
---|
1896 | 1881 | return 0; |
---|
1897 | 1882 | return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, |
---|
1898 | 1883 | ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); |
---|
.. | .. |
---|
3131 | 3116 | /* FIXME: check the bits for each model |
---|
3132 | 3117 | * model 83 is confirmed to work |
---|
3133 | 3118 | */ |
---|
3134 | | - static unsigned short surr_on[3][2] = { |
---|
| 3119 | + static const unsigned short surr_on[3][2] = { |
---|
3135 | 3120 | { 0x0008, 0x0000 }, /* 9761-78 & 82 */ |
---|
3136 | 3121 | { 0x0000, 0x0008 }, /* 9761-82 rev.B */ |
---|
3137 | 3122 | { 0x0000, 0x0008 }, /* 9761-83 */ |
---|
3138 | 3123 | }; |
---|
3139 | | - static unsigned short clfe_on[3][2] = { |
---|
| 3124 | + static const unsigned short clfe_on[3][2] = { |
---|
3140 | 3125 | { 0x0000, 0x1000 }, /* 9761-78 & 82 */ |
---|
3141 | 3126 | { 0x1000, 0x0000 }, /* 9761-82 rev.B */ |
---|
3142 | 3127 | { 0x0000, 0x1000 }, /* 9761-83 */ |
---|
3143 | 3128 | }; |
---|
3144 | | - static unsigned short surr_shared[3][2] = { |
---|
| 3129 | + static const unsigned short surr_shared[3][2] = { |
---|
3145 | 3130 | { 0x0000, 0x0400 }, /* 9761-78 & 82 */ |
---|
3146 | 3131 | { 0x0000, 0x0400 }, /* 9761-82 rev.B */ |
---|
3147 | 3132 | { 0x0000, 0x0400 }, /* 9761-83 */ |
---|
3148 | 3133 | }; |
---|
3149 | | - static unsigned short clfe_shared[3][2] = { |
---|
| 3134 | + static const unsigned short clfe_shared[3][2] = { |
---|
3150 | 3135 | { 0x2000, 0x0880 }, /* 9761-78 & 82 */ |
---|
3151 | 3136 | { 0x0000, 0x2880 }, /* 9761-82 rev.B */ |
---|
3152 | 3137 | { 0x2000, 0x0800 }, /* 9761-83 */ |
---|
.. | .. |
---|
3388 | 3373 | AC97_SINGLE("Downmix Surround to Front", 0x5a, 11, 1, 0), |
---|
3389 | 3374 | }; |
---|
3390 | 3375 | |
---|
3391 | | -static const char * const slave_vols_vt1616[] = { |
---|
| 3376 | +static const char * const follower_vols_vt1616[] = { |
---|
3392 | 3377 | "Front Playback Volume", |
---|
3393 | 3378 | "Surround Playback Volume", |
---|
3394 | 3379 | "Center Playback Volume", |
---|
.. | .. |
---|
3396 | 3381 | NULL |
---|
3397 | 3382 | }; |
---|
3398 | 3383 | |
---|
3399 | | -static const char * const slave_sws_vt1616[] = { |
---|
| 3384 | +static const char * const follower_sws_vt1616[] = { |
---|
3400 | 3385 | "Front Playback Switch", |
---|
3401 | 3386 | "Surround Playback Switch", |
---|
3402 | 3387 | "Center Playback Switch", |
---|
.. | .. |
---|
3415 | 3400 | return snd_ctl_find_id(ac97->bus->card, &id); |
---|
3416 | 3401 | } |
---|
3417 | 3402 | |
---|
3418 | | -/* create a virtual master control and add slaves */ |
---|
| 3403 | +/* create a virtual master control and add followers */ |
---|
3419 | 3404 | static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name, |
---|
3420 | 3405 | const unsigned int *tlv, |
---|
3421 | | - const char * const *slaves) |
---|
| 3406 | + const char * const *followers) |
---|
3422 | 3407 | { |
---|
3423 | 3408 | struct snd_kcontrol *kctl; |
---|
3424 | 3409 | const char * const *s; |
---|
.. | .. |
---|
3431 | 3416 | if (err < 0) |
---|
3432 | 3417 | return err; |
---|
3433 | 3418 | |
---|
3434 | | - for (s = slaves; *s; s++) { |
---|
| 3419 | + for (s = followers; *s; s++) { |
---|
3435 | 3420 | struct snd_kcontrol *sctl; |
---|
3436 | 3421 | |
---|
3437 | 3422 | sctl = snd_ac97_find_mixer_ctl(ac97, *s); |
---|
3438 | 3423 | if (!sctl) { |
---|
3439 | 3424 | dev_dbg(ac97->bus->card->dev, |
---|
3440 | | - "Cannot find slave %s, skipped\n", *s); |
---|
| 3425 | + "Cannot find follower %s, skipped\n", *s); |
---|
3441 | 3426 | continue; |
---|
3442 | 3427 | } |
---|
3443 | | - err = snd_ctl_add_slave(kctl, sctl); |
---|
| 3428 | + err = snd_ctl_add_follower(kctl, sctl); |
---|
3444 | 3429 | if (err < 0) |
---|
3445 | 3430 | return err; |
---|
3446 | 3431 | } |
---|
.. | .. |
---|
3466 | 3451 | snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Front Playback"); |
---|
3467 | 3452 | |
---|
3468 | 3453 | err = snd_ac97_add_vmaster(ac97, "Master Playback Volume", |
---|
3469 | | - kctl->tlv.p, slave_vols_vt1616); |
---|
| 3454 | + kctl->tlv.p, follower_vols_vt1616); |
---|
3470 | 3455 | if (err < 0) |
---|
3471 | 3456 | return err; |
---|
3472 | 3457 | |
---|
3473 | 3458 | err = snd_ac97_add_vmaster(ac97, "Master Playback Switch", |
---|
3474 | | - NULL, slave_sws_vt1616); |
---|
| 3459 | + NULL, follower_sws_vt1616); |
---|
3475 | 3460 | if (err < 0) |
---|
3476 | 3461 | return err; |
---|
3477 | 3462 | |
---|
.. | .. |
---|
3650 | 3635 | |
---|
3651 | 3636 | /* This list reflects the vt1618 docs for Vendor Defined Register 0x60. */ |
---|
3652 | 3637 | |
---|
3653 | | -static struct vt1618_uaj_item vt1618_uaj[3] = { |
---|
| 3638 | +static const struct vt1618_uaj_item vt1618_uaj[3] = { |
---|
3654 | 3639 | { |
---|
3655 | 3640 | /* speaker jack */ |
---|
3656 | 3641 | .mask = 0x03, |
---|
.. | .. |
---|
3886 | 3871 | * check_volume_resolution(). |
---|
3887 | 3872 | */ |
---|
3888 | 3873 | |
---|
3889 | | -static struct snd_ac97_res_table lm4550_restbl[] = { |
---|
| 3874 | +static const struct snd_ac97_res_table lm4550_restbl[] = { |
---|
3890 | 3875 | { AC97_MASTER, 0x1f1f }, |
---|
3891 | 3876 | { AC97_HEADPHONE, 0x1f1f }, |
---|
3892 | 3877 | { AC97_MASTER_MONO, 0x001f }, |
---|