aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 6580a367023e..db86b446743c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4844,88 +4844,6 @@ EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power);
4844#endif 4844#endif
4845 4845
4846/* 4846/*
4847 * Channel mode helper
4848 */
4849
4850/**
4851 * snd_hda_ch_mode_info - Info callback helper for the channel mode enum
4852 * @codec: the HDA codec
4853 * @uinfo: pointer to get/store the data
4854 * @chmode: channel mode array
4855 * @num_chmodes: channel mode array size
4856 */
4857int snd_hda_ch_mode_info(struct hda_codec *codec,
4858 struct snd_ctl_elem_info *uinfo,
4859 const struct hda_channel_mode *chmode,
4860 int num_chmodes)
4861{
4862 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4863 uinfo->count = 1;
4864 uinfo->value.enumerated.items = num_chmodes;
4865 if (uinfo->value.enumerated.item >= num_chmodes)
4866 uinfo->value.enumerated.item = num_chmodes - 1;
4867 sprintf(uinfo->value.enumerated.name, "%dch",
4868 chmode[uinfo->value.enumerated.item].channels);
4869 return 0;
4870}
4871EXPORT_SYMBOL_GPL(snd_hda_ch_mode_info);
4872
4873/**
4874 * snd_hda_ch_mode_get - Get callback helper for the channel mode enum
4875 * @codec: the HDA codec
4876 * @ucontrol: pointer to get/store the data
4877 * @chmode: channel mode array
4878 * @num_chmodes: channel mode array size
4879 * @max_channels: max number of channels
4880 */
4881int snd_hda_ch_mode_get(struct hda_codec *codec,
4882 struct snd_ctl_elem_value *ucontrol,
4883 const struct hda_channel_mode *chmode,
4884 int num_chmodes,
4885 int max_channels)
4886{
4887 int i;
4888
4889 for (i = 0; i < num_chmodes; i++) {
4890 if (max_channels == chmode[i].channels) {
4891 ucontrol->value.enumerated.item[0] = i;
4892 break;
4893 }
4894 }
4895 return 0;
4896}
4897EXPORT_SYMBOL_GPL(snd_hda_ch_mode_get);
4898
4899/**
4900 * snd_hda_ch_mode_put - Put callback helper for the channel mode enum
4901 * @codec: the HDA codec
4902 * @ucontrol: pointer to get/store the data
4903 * @chmode: channel mode array
4904 * @num_chmodes: channel mode array size
4905 * @max_channelsp: pointer to store the max channels
4906 */
4907int snd_hda_ch_mode_put(struct hda_codec *codec,
4908 struct snd_ctl_elem_value *ucontrol,
4909 const struct hda_channel_mode *chmode,
4910 int num_chmodes,
4911 int *max_channelsp)
4912{
4913 unsigned int mode;
4914
4915 mode = ucontrol->value.enumerated.item[0];
4916 if (mode >= num_chmodes)
4917 return -EINVAL;
4918 if (*max_channelsp == chmode[mode].channels)
4919 return 0;
4920 /* change the current channel setting */
4921 *max_channelsp = chmode[mode].channels;
4922 if (chmode[mode].sequence)
4923 snd_hda_sequence_write_cache(codec, chmode[mode].sequence);
4924 return 1;
4925}
4926EXPORT_SYMBOL_GPL(snd_hda_ch_mode_put);
4927
4928/*
4929 * input MUX helper 4847 * input MUX helper
4930 */ 4848 */
4931 4849