| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2004 James Courtier-Dutton <James@superbug.demon.co.uk> |
|---|
| 3 | 4 | * Driver CA0106 chips. e.g. Sound Blaster Audigy LS and Live 24bit |
|---|
| .. | .. |
|---|
| 44 | 45 | * |
|---|
| 45 | 46 | * This code was initially based on code from ALSA's emu10k1x.c which is: |
|---|
| 46 | 47 | * Copyright (c) by Francisco Moraes <fmoraes@nc.rr.com> |
|---|
| 47 | | - * |
|---|
| 48 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 49 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 50 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 51 | | - * (at your option) any later version. |
|---|
| 52 | | - * |
|---|
| 53 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 54 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 55 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 56 | | - * GNU General Public License for more details. |
|---|
| 57 | | - * |
|---|
| 58 | | - * You should have received a copy of the GNU General Public License |
|---|
| 59 | | - * along with this program; if not, write to the Free Software |
|---|
| 60 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 61 | | - * |
|---|
| 62 | 48 | */ |
|---|
| 63 | 49 | #include <linux/delay.h> |
|---|
| 64 | 50 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 564 | 550 | .private_value = ((chid) << 8) | (reg) \ |
|---|
| 565 | 551 | } |
|---|
| 566 | 552 | |
|---|
| 567 | | -static struct snd_kcontrol_new snd_ca0106_volume_ctls[] = { |
|---|
| 553 | +static const struct snd_kcontrol_new snd_ca0106_volume_ctls[] = { |
|---|
| 568 | 554 | CA_VOLUME("Analog Front Playback Volume", |
|---|
| 569 | 555 | CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2), |
|---|
| 570 | 556 | CA_VOLUME("Analog Rear Playback Volume", |
|---|
| .. | .. |
|---|
| 645 | 631 | .private_value = chid \ |
|---|
| 646 | 632 | } |
|---|
| 647 | 633 | |
|---|
| 648 | | -static struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = { |
|---|
| 634 | +static const struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = { |
|---|
| 649 | 635 | I2C_VOLUME("Phone Capture Volume", 0), |
|---|
| 650 | 636 | I2C_VOLUME("Mic Capture Volume", 1), |
|---|
| 651 | 637 | I2C_VOLUME("Line in Capture Volume", 2), |
|---|
| .. | .. |
|---|
| 668 | 654 | }; |
|---|
| 669 | 655 | |
|---|
| 670 | 656 | static struct snd_kcontrol_new |
|---|
| 671 | | -snd_ca0106_volume_spi_dac_ctl(struct snd_ca0106_details *details, |
|---|
| 657 | +snd_ca0106_volume_spi_dac_ctl(const struct snd_ca0106_details *details, |
|---|
| 672 | 658 | int channel_id) |
|---|
| 673 | 659 | { |
|---|
| 674 | 660 | struct snd_kcontrol_new spi_switch = {0}; |
|---|
| .. | .. |
|---|
| 753 | 739 | static |
|---|
| 754 | 740 | DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 25, 1); |
|---|
| 755 | 741 | |
|---|
| 756 | | -static char *slave_vols[] = { |
|---|
| 742 | +static const char * const follower_vols[] = { |
|---|
| 757 | 743 | "Analog Front Playback Volume", |
|---|
| 758 | 744 | "Analog Rear Playback Volume", |
|---|
| 759 | 745 | "Analog Center/LFE Playback Volume", |
|---|
| .. | .. |
|---|
| 766 | 752 | NULL |
|---|
| 767 | 753 | }; |
|---|
| 768 | 754 | |
|---|
| 769 | | -static char *slave_sws[] = { |
|---|
| 755 | +static const char * const follower_sws[] = { |
|---|
| 770 | 756 | "Analog Front Playback Switch", |
|---|
| 771 | 757 | "Analog Rear Playback Switch", |
|---|
| 772 | 758 | "Analog Center/LFE Playback Switch", |
|---|
| .. | .. |
|---|
| 775 | 761 | NULL |
|---|
| 776 | 762 | }; |
|---|
| 777 | 763 | |
|---|
| 778 | | -static void add_slaves(struct snd_card *card, |
|---|
| 779 | | - struct snd_kcontrol *master, char **list) |
|---|
| 764 | +static void add_followers(struct snd_card *card, |
|---|
| 765 | + struct snd_kcontrol *master, const char * const *list) |
|---|
| 780 | 766 | { |
|---|
| 781 | 767 | for (; *list; list++) { |
|---|
| 782 | | - struct snd_kcontrol *slave = ctl_find(card, *list); |
|---|
| 783 | | - if (slave) |
|---|
| 784 | | - snd_ctl_add_slave(master, slave); |
|---|
| 768 | + struct snd_kcontrol *follower = ctl_find(card, *list); |
|---|
| 769 | + if (follower) |
|---|
| 770 | + snd_ctl_add_follower(master, follower); |
|---|
| 785 | 771 | } |
|---|
| 786 | 772 | } |
|---|
| 787 | 773 | |
|---|
| .. | .. |
|---|
| 789 | 775 | { |
|---|
| 790 | 776 | int err; |
|---|
| 791 | 777 | struct snd_card *card = emu->card; |
|---|
| 792 | | - char **c; |
|---|
| 778 | + const char * const *c; |
|---|
| 793 | 779 | struct snd_kcontrol *vmaster; |
|---|
| 794 | | - static char *ca0106_remove_ctls[] = { |
|---|
| 780 | + static const char * const ca0106_remove_ctls[] = { |
|---|
| 795 | 781 | "Master Mono Playback Switch", |
|---|
| 796 | 782 | "Master Mono Playback Volume", |
|---|
| 797 | 783 | "3D Control - Switch", |
|---|
| .. | .. |
|---|
| 815 | 801 | "Surround Phase Inversion Playback Switch", |
|---|
| 816 | 802 | NULL |
|---|
| 817 | 803 | }; |
|---|
| 818 | | - static char *ca0106_rename_ctls[] = { |
|---|
| 804 | + static const char * const ca0106_rename_ctls[] = { |
|---|
| 819 | 805 | "Master Playback Switch", "Capture Switch", |
|---|
| 820 | 806 | "Master Playback Volume", "Capture Volume", |
|---|
| 821 | 807 | "Line Playback Switch", "AC97 Line Capture Switch", |
|---|
| .. | .. |
|---|
| 866 | 852 | err = snd_ctl_add(card, vmaster); |
|---|
| 867 | 853 | if (err < 0) |
|---|
| 868 | 854 | return err; |
|---|
| 869 | | - add_slaves(card, vmaster, slave_vols); |
|---|
| 855 | + add_followers(card, vmaster, follower_vols); |
|---|
| 870 | 856 | |
|---|
| 871 | 857 | if (emu->details->spi_dac) { |
|---|
| 872 | 858 | vmaster = snd_ctl_make_virtual_master("Master Playback Switch", |
|---|
| .. | .. |
|---|
| 876 | 862 | err = snd_ctl_add(card, vmaster); |
|---|
| 877 | 863 | if (err < 0) |
|---|
| 878 | 864 | return err; |
|---|
| 879 | | - add_slaves(card, vmaster, slave_sws); |
|---|
| 865 | + add_followers(card, vmaster, follower_sws); |
|---|
| 880 | 866 | } |
|---|
| 881 | 867 | |
|---|
| 882 | 868 | strcpy(card->mixername, "CA0106"); |
|---|
| .. | .. |
|---|
| 889 | 875 | unsigned int reg; |
|---|
| 890 | 876 | }; |
|---|
| 891 | 877 | |
|---|
| 892 | | -static struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = { |
|---|
| 878 | +static const struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = { |
|---|
| 893 | 879 | { CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2 }, |
|---|
| 894 | 880 | { CONTROL_REAR_CHANNEL, PLAYBACK_VOLUME2 }, |
|---|
| 895 | 881 | { CONTROL_CENTER_LFE_CHANNEL, PLAYBACK_VOLUME2 }, |
|---|