aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlen Masgai <mimosius@gmx.de>2005-09-28 02:19:05 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:16:52 -0500
commitd602c885a6c30c78197b752c9241ce7e86cdf704 (patch)
tree4ee464123d2bc4bb4e5775f0ac98ae996eca94f2
parentbf3b644039d6a99076f5a87c714d94dfea3a6814 (diff)
[ALSA] ymfpci: add S/PDIF-in > S/PDIF-out loop
Modules: YMFPCI driver This patch adds a new mixer control called 'IEC958 Loop' which makes it possible to loop digital signals from S/PDIF-in to S/PDIF-out. Signed-off-by: Glen Masgai <mimosius@gmx.de> Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 27fa523639ae..2e671ee438c6 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -1421,15 +1421,18 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = {
1421 * Mixer controls 1421 * Mixer controls
1422 */ 1422 */
1423 1423
1424#define YMFPCI_SINGLE(xname, xindex, reg) \ 1424#define YMFPCI_SINGLE(xname, xindex, reg, shift) \
1425{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 1425{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1426 .info = snd_ymfpci_info_single, \ 1426 .info = snd_ymfpci_info_single, \
1427 .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \ 1427 .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \
1428 .private_value = reg } 1428 .private_value = ((reg) | ((shift) << 16)) }
1429 1429
1430static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1430static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol,
1431 snd_ctl_elem_info_t *uinfo)
1431{ 1432{
1432 switch (kcontrol->private_value) { 1433 int reg = kcontrol->private_value & 0xffff;
1434
1435 switch (reg) {
1433 case YDSXGR_SPDIFOUTCTRL: break; 1436 case YDSXGR_SPDIFOUTCTRL: break;
1434 case YDSXGR_SPDIFINCTRL: break; 1437 case YDSXGR_SPDIFINCTRL: break;
1435 default: return -EINVAL; 1438 default: return -EINVAL;
@@ -1441,30 +1444,35 @@ static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
1441 return 0; 1444 return 0;
1442} 1445}
1443 1446
1444static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1447static int snd_ymfpci_get_single(snd_kcontrol_t *kcontrol,
1448 snd_ctl_elem_value_t *ucontrol)
1445{ 1449{
1446 ymfpci_t *chip = snd_kcontrol_chip(kcontrol); 1450 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1447 int reg = kcontrol->private_value; 1451 int reg = kcontrol->private_value & 0xffff;
1448 unsigned int shift = 0, mask = 1; 1452 unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
1453 unsigned int mask = 1;
1449 1454
1450 switch (kcontrol->private_value) { 1455 switch (reg) {
1451 case YDSXGR_SPDIFOUTCTRL: break; 1456 case YDSXGR_SPDIFOUTCTRL: break;
1452 case YDSXGR_SPDIFINCTRL: break; 1457 case YDSXGR_SPDIFINCTRL: break;
1453 default: return -EINVAL; 1458 default: return -EINVAL;
1454 } 1459 }
1455 ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask; 1460 ucontrol->value.integer.value[0] =
1461 (snd_ymfpci_readl(chip, reg) >> shift) & mask;
1456 return 0; 1462 return 0;
1457} 1463}
1458 1464
1459static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1465static int snd_ymfpci_put_single(snd_kcontrol_t *kcontrol,
1466 snd_ctl_elem_value_t *ucontrol)
1460{ 1467{
1461 ymfpci_t *chip = snd_kcontrol_chip(kcontrol); 1468 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1462 int reg = kcontrol->private_value; 1469 int reg = kcontrol->private_value & 0xffff;
1463 unsigned int shift = 0, mask = 1; 1470 unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
1471 unsigned int mask = 1;
1464 int change; 1472 int change;
1465 unsigned int val, oval; 1473 unsigned int val, oval;
1466 1474
1467 switch (kcontrol->private_value) { 1475 switch (reg) {
1468 case YDSXGR_SPDIFOUTCTRL: break; 1476 case YDSXGR_SPDIFOUTCTRL: break;
1469 case YDSXGR_SPDIFINCTRL: break; 1477 case YDSXGR_SPDIFINCTRL: break;
1470 default: return -EINVAL; 1478 default: return -EINVAL;
@@ -1583,8 +1591,9 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVO
1583YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL), 1591YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL),
1584YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL), 1592YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL),
1585YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL), 1593YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
1586YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL), 1594YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
1587YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL), 1595YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
1596YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
1588{ 1597{
1589 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1598 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1590 .name = "4ch Duplication", 1599 .name = "4ch Duplication",