Commit d602c885 authored by Glen Masgai's avatar Glen Masgai Committed by Jaroslav Kysela

[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: default avatarGlen Masgai <mimosius@gmx.de>
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent bf3b6440
...@@ -1421,15 +1421,18 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = { ...@@ -1421,15 +1421,18 @@ static snd_kcontrol_new_t snd_ymfpci_drec_source __devinitdata = {
* Mixer controls * Mixer controls
*/ */
#define YMFPCI_SINGLE(xname, xindex, reg) \ #define YMFPCI_SINGLE(xname, xindex, reg, shift) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
.info = snd_ymfpci_info_single, \ .info = snd_ymfpci_info_single, \
.get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \ .get = snd_ymfpci_get_single, .put = snd_ymfpci_put_single, \
.private_value = reg } .private_value = ((reg) | ((shift) << 16)) }
static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol,
snd_ctl_elem_info_t *uinfo)
{ {
switch (kcontrol->private_value) { int reg = kcontrol->private_value & 0xffff;
switch (reg) {
case YDSXGR_SPDIFOUTCTRL: break; case YDSXGR_SPDIFOUTCTRL: break;
case YDSXGR_SPDIFINCTRL: break; case YDSXGR_SPDIFINCTRL: break;
default: return -EINVAL; default: return -EINVAL;
...@@ -1441,30 +1444,35 @@ static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t ...@@ -1441,30 +1444,35 @@ static int snd_ymfpci_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
return 0; return 0;
} }
static int snd_ymfpci_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_ymfpci_get_single(snd_kcontrol_t *kcontrol,
snd_ctl_elem_value_t *ucontrol)
{ {
ymfpci_t *chip = snd_kcontrol_chip(kcontrol); ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value; int reg = kcontrol->private_value & 0xffff;
unsigned int shift = 0, mask = 1; unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
unsigned int mask = 1;
switch (kcontrol->private_value) { switch (reg) {
case YDSXGR_SPDIFOUTCTRL: break; case YDSXGR_SPDIFOUTCTRL: break;
case YDSXGR_SPDIFINCTRL: break; case YDSXGR_SPDIFINCTRL: break;
default: return -EINVAL; default: return -EINVAL;
} }
ucontrol->value.integer.value[0] = (snd_ymfpci_readl(chip, reg) >> shift) & mask; ucontrol->value.integer.value[0] =
(snd_ymfpci_readl(chip, reg) >> shift) & mask;
return 0; return 0;
} }
static int snd_ymfpci_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) static int snd_ymfpci_put_single(snd_kcontrol_t *kcontrol,
snd_ctl_elem_value_t *ucontrol)
{ {
ymfpci_t *chip = snd_kcontrol_chip(kcontrol); ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
int reg = kcontrol->private_value; int reg = kcontrol->private_value & 0xffff;
unsigned int shift = 0, mask = 1; unsigned int shift = (kcontrol->private_value >> 16) & 0xff;
unsigned int mask = 1;
int change; int change;
unsigned int val, oval; unsigned int val, oval;
switch (kcontrol->private_value) { switch (reg) {
case YDSXGR_SPDIFOUTCTRL: break; case YDSXGR_SPDIFOUTCTRL: break;
case YDSXGR_SPDIFINCTRL: break; case YDSXGR_SPDIFINCTRL: break;
default: return -EINVAL; default: return -EINVAL;
...@@ -1583,8 +1591,9 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVO ...@@ -1583,8 +1591,9 @@ YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ", PLAYBACK,VOLUME), 0, YDSXGR_ZVOUTVO
YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL), YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("", CAPTURE,VOLUME), 0, YDSXGR_ZVLOOPVOL),
YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL), YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("AC97 ",PLAYBACK,VOLUME), 1, YDSXGR_SPDIFOUTVOL),
YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL), YMFPCI_DOUBLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,VOLUME), 1, YDSXGR_SPDIFLOOPVOL),
YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL), YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 0, YDSXGR_SPDIFOUTCTRL, 0),
YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL), YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, YDSXGR_SPDIFINCTRL, 0),
YMFPCI_SINGLE(SNDRV_CTL_NAME_IEC958("Loop",NONE,NONE), 0, YDSXGR_SPDIFINCTRL, 4),
{ {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "4ch Duplication", .name = "4ch Duplication",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment