aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-05-13 11:18:42 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 04:10:36 -0400
commitfd2c326de8cd35a36514a887541426b1ef7c5516 (patch)
tree465e67a3bd2bba7180731a418e418bfecc23de84 /sound/pci/hda/patch_realtek.c
parent9bc533f58e8515cf346932fc84a58dd706342635 (diff)
[ALSA] Allow more than 2 channel modes
HDA Codec driver Allow 'Channel Mode' control to have more than 2 modes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8a104827a95c..9f12d1fd02dc 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -301,13 +301,14 @@ static int alc880_ch_mode_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *ui
301{ 301{
302 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 302 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
303 struct alc_spec *spec = codec->spec; 303 struct alc_spec *spec = codec->spec;
304 int items = kcontrol->private_value ? (int)kcontrol->private_value : 2;
304 305
305 snd_assert(spec->channel_mode, return -ENXIO); 306 snd_assert(spec->channel_mode, return -ENXIO);
306 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 307 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
307 uinfo->count = 1; 308 uinfo->count = 1;
308 uinfo->value.enumerated.items = 2; 309 uinfo->value.enumerated.items = items;
309 if (uinfo->value.enumerated.item >= 2) 310 if (uinfo->value.enumerated.item >= items)
310 uinfo->value.enumerated.item = 1; 311 uinfo->value.enumerated.item = items - 1;
311 sprintf(uinfo->value.enumerated.name, "%dch", 312 sprintf(uinfo->value.enumerated.name, "%dch",
312 spec->channel_mode[uinfo->value.enumerated.item].channels); 313 spec->channel_mode[uinfo->value.enumerated.item].channels);
313 return 0; 314 return 0;
@@ -317,10 +318,16 @@ static int alc880_ch_mode_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
317{ 318{
318 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 319 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
319 struct alc_spec *spec = codec->spec; 320 struct alc_spec *spec = codec->spec;
321 int items = kcontrol->private_value ? (int)kcontrol->private_value : 2;
322 int i;
320 323
321 snd_assert(spec->channel_mode, return -ENXIO); 324 snd_assert(spec->channel_mode, return -ENXIO);
322 ucontrol->value.enumerated.item[0] = 325 for (i = 0; i < items; i++) {
323 (spec->multiout.max_channels == spec->channel_mode[0].channels) ? 0 : 1; 326 if (spec->multiout.max_channels == spec->channel_mode[i].channels) {
327 ucontrol->value.enumerated.item[0] = i;
328 break;
329 }
330 }
324 return 0; 331 return 0;
325} 332}
326 333
@@ -1036,9 +1043,11 @@ static struct hda_input_mux alc880_test_capture_source = {
1036 }, 1043 },
1037}; 1044};
1038 1045
1039static struct alc_channel_mode alc880_test_modes[2] = { 1046static struct alc_channel_mode alc880_test_modes[4] = {
1040 { 2, NULL }, 1047 { 2, NULL },
1048 { 4, NULL },
1041 { 6, NULL }, 1049 { 6, NULL },
1050 { 8, NULL },
1042}; 1051};
1043 1052
1044static int alc_test_pin_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1053static int alc_test_pin_ctl_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
@@ -1211,6 +1220,7 @@ static snd_kcontrol_new_t alc880_test_mixer[] = {
1211 .info = alc880_ch_mode_info, 1220 .info = alc880_ch_mode_info,
1212 .get = alc880_ch_mode_get, 1221 .get = alc880_ch_mode_get,
1213 .put = alc880_ch_mode_put, 1222 .put = alc880_ch_mode_put,
1223 .private_value = ARRAY_SIZE(alc880_test_modes),
1214 }, 1224 },
1215 { } /* end */ 1225 { } /* end */
1216}; 1226};