aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/emu10k1
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r--sound/pci/emu10k1/p16v.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 13f7e62ee56..93dff4c6b23 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -41,7 +41,13 @@
41 * Integrated with snd-emu10k1 driver. 41 * Integrated with snd-emu10k1 driver.
42 * 0.22 42 * 0.22
43 * Removed #if 0 ... #endif 43 * Removed #if 0 ... #endif
44 * 44 * 0.23
45 * Implement different capture rates.
46 * 0.24
47 * Implement different capture source channels.
48 * e.g. When HD Capture source is set to SPDIF,
49 * setting HD Capture channel to 0 captures from CDROM digital input.
50 * setting HD Capture channel to 1 captures from SPDIF in.
45 * 51 *
46 * BUGS: 52 * BUGS:
47 * Some stability problems when unloading the snd-p16v kernel module. 53 * Some stability problems when unloading the snd-p16v kernel module.
@@ -933,6 +939,56 @@ static snd_kcontrol_new_t snd_p16v_capture_source __devinitdata =
933 .get = snd_p16v_capture_source_get, 939 .get = snd_p16v_capture_source_get,
934 .put = snd_p16v_capture_source_put 940 .put = snd_p16v_capture_source_put
935}; 941};
942
943static int snd_p16v_capture_channel_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
944{
945 static char *texts[4] = { "0", "1", "2", "3", };
946
947 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
948 uinfo->count = 1;
949 uinfo->value.enumerated.items = 4;
950 if (uinfo->value.enumerated.item > 3)
951 uinfo->value.enumerated.item = 3;
952 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
953 return 0;
954}
955
956static int snd_p16v_capture_channel_get(snd_kcontrol_t * kcontrol,
957 snd_ctl_elem_value_t * ucontrol)
958{
959 emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
960
961 ucontrol->value.enumerated.item[0] = emu->p16v_capture_channel;
962 return 0;
963}
964
965static int snd_p16v_capture_channel_put(snd_kcontrol_t * kcontrol,
966 snd_ctl_elem_value_t * ucontrol)
967{
968 emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
969 unsigned int val;
970 int change = 0;
971 u32 tmp;
972
973 val = ucontrol->value.enumerated.item[0] ;
974 change = (emu->p16v_capture_channel != val);
975 if (change) {
976 emu->p16v_capture_channel = val;
977 tmp = snd_emu10k1_ptr20_read(emu, CAPTURE_P16V_SOURCE, 0) & 0xfffc;
978 snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, tmp | val);
979 }
980 return change;
981}
982
983static snd_kcontrol_new_t snd_p16v_capture_channel __devinitdata =
984{
985 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
986 .name = "HD Capture channel",
987 .info = snd_p16v_capture_channel_info,
988 .get = snd_p16v_capture_channel_get,
989 .put = snd_p16v_capture_channel_put
990};
991
936int snd_p16v_mixer(emu10k1_t *emu) 992int snd_p16v_mixer(emu10k1_t *emu)
937{ 993{
938 int err; 994 int err;
@@ -974,6 +1030,10 @@ int snd_p16v_mixer(emu10k1_t *emu)
974 return -ENOMEM; 1030 return -ENOMEM;
975 if ((err = snd_ctl_add(card, kctl))) 1031 if ((err = snd_ctl_add(card, kctl)))
976 return err; 1032 return err;
1033 if ((kctl = snd_ctl_new1(&snd_p16v_capture_channel, emu)) == NULL)
1034 return -ENOMEM;
1035 if ((err = snd_ctl_add(card, kctl)))
1036 return err;
977 return 0; 1037 return 0;
978} 1038}
979 1039