| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
|---|
| 3 | 4 | * Routines for control of CS4235/4236B/4237B/4238B/4239 chips |
|---|
| .. | .. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Bugs: |
|---|
| 9 | 10 | * ----- |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 13 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 14 | | - * (at your option) any later version. |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 19 | | - * GNU General Public License for more details. |
|---|
| 20 | | - * |
|---|
| 21 | | - * You should have received a copy of the GNU General Public License |
|---|
| 22 | | - * along with this program; if not, write to the Free Software |
|---|
| 23 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 24 | | - * |
|---|
| 25 | 11 | */ |
|---|
| 26 | 12 | |
|---|
| 27 | 13 | /* |
|---|
| .. | .. |
|---|
| 53 | 39 | * D7: consumer serial port enable (CS4237B,CS4238B) |
|---|
| 54 | 40 | * D6: channels status block reset (CS4237B,CS4238B) |
|---|
| 55 | 41 | * D5: user bit in sub-frame of digital audio data (CS4237B,CS4238B) |
|---|
| 56 | | - * D4: validity bit bit in sub-frame of digital audio data (CS4237B,CS4238B) |
|---|
| 42 | + * D4: validity bit in sub-frame of digital audio data (CS4237B,CS4238B) |
|---|
| 57 | 43 | * |
|---|
| 58 | 44 | * C5 lower channel status (digital serial data description) (CS4237B,CS4238B) |
|---|
| 59 | 45 | * D7-D6: first two bits of category code |
|---|
| .. | .. |
|---|
| 94 | 80 | * |
|---|
| 95 | 81 | */ |
|---|
| 96 | 82 | |
|---|
| 97 | | -static unsigned char snd_cs4236_ext_map[18] = { |
|---|
| 83 | +static const unsigned char snd_cs4236_ext_map[18] = { |
|---|
| 98 | 84 | /* CS4236_LEFT_LINE */ 0xff, |
|---|
| 99 | 85 | /* CS4236_RIGHT_LINE */ 0xff, |
|---|
| 100 | 86 | /* CS4236_LEFT_MIC */ 0xdf, |
|---|
| .. | .. |
|---|
| 772 | 758 | static const DECLARE_TLV_DB_SCALE(db_scale_2bit, -1800, 600, 0); |
|---|
| 773 | 759 | static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); |
|---|
| 774 | 760 | |
|---|
| 775 | | -static struct snd_kcontrol_new snd_cs4236_controls[] = { |
|---|
| 761 | +static const struct snd_kcontrol_new snd_cs4236_controls[] = { |
|---|
| 776 | 762 | |
|---|
| 777 | 763 | CS4236_DOUBLE("Master Digital Playback Switch", 0, |
|---|
| 778 | 764 | CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), |
|---|
| .. | .. |
|---|
| 867 | 853 | static const DECLARE_TLV_DB_SCALE(db_scale_5bit_6db_max, -5600, 200, 0); |
|---|
| 868 | 854 | static const DECLARE_TLV_DB_SCALE(db_scale_2bit_16db_max, -2400, 800, 0); |
|---|
| 869 | 855 | |
|---|
| 870 | | -static struct snd_kcontrol_new snd_cs4235_controls[] = { |
|---|
| 856 | +static const struct snd_kcontrol_new snd_cs4235_controls[] = { |
|---|
| 871 | 857 | |
|---|
| 872 | 858 | WSS_DOUBLE("Master Playback Switch", 0, |
|---|
| 873 | 859 | CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), |
|---|
| .. | .. |
|---|
| 1000 | 986 | return change; |
|---|
| 1001 | 987 | } |
|---|
| 1002 | 988 | |
|---|
| 1003 | | -static struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { |
|---|
| 989 | +static const struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { |
|---|
| 1004 | 990 | CS4236_IEC958_ENABLE("IEC958 Output Enable", 0), |
|---|
| 1005 | 991 | CS4236_SINGLEC("IEC958 Output Validity", 0, 4, 4, 1, 0), |
|---|
| 1006 | 992 | CS4236_SINGLEC("IEC958 Output User", 0, 4, 5, 1, 0), |
|---|
| .. | .. |
|---|
| 1009 | 995 | CS4236_SINGLEC("IEC958 Output Channel Status High", 0, 6, 0, 255, 0) |
|---|
| 1010 | 996 | }; |
|---|
| 1011 | 997 | |
|---|
| 1012 | | -static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { |
|---|
| 998 | +static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { |
|---|
| 1013 | 999 | CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), |
|---|
| 1014 | 1000 | CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1) |
|---|
| 1015 | 1001 | }; |
|---|
| 1016 | 1002 | |
|---|
| 1017 | | -static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { |
|---|
| 1003 | +static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { |
|---|
| 1018 | 1004 | CS4236_SINGLEC("3D Control - Switch", 0, 3, 7, 1, 0), |
|---|
| 1019 | 1005 | CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), |
|---|
| 1020 | 1006 | CS4236_SINGLEC("3D Control - Center", 0, 2, 0, 15, 1), |
|---|
| .. | .. |
|---|
| 1022 | 1008 | CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0) |
|---|
| 1023 | 1009 | }; |
|---|
| 1024 | 1010 | |
|---|
| 1025 | | -static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { |
|---|
| 1011 | +static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { |
|---|
| 1026 | 1012 | CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), |
|---|
| 1027 | 1013 | CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), |
|---|
| 1028 | 1014 | CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1), |
|---|
| .. | .. |
|---|
| 1034 | 1020 | struct snd_card *card; |
|---|
| 1035 | 1021 | unsigned int idx, count; |
|---|
| 1036 | 1022 | int err; |
|---|
| 1037 | | - struct snd_kcontrol_new *kcontrol; |
|---|
| 1023 | + const struct snd_kcontrol_new *kcontrol; |
|---|
| 1038 | 1024 | |
|---|
| 1039 | 1025 | if (snd_BUG_ON(!chip || !chip->card)) |
|---|
| 1040 | 1026 | return -EINVAL; |
|---|