[ALSA] emu10k1 - Clean up p16v code
Modules: EMU10K1/EMU10K2 driver Clean up and optimize the codes in p16v.c - Add proper __devinit* tags - Reduce unnecessary functions using a closure - Fix whitespaces - Rename 'Unknown' to 'Side' controls Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
committed by
Jaroslav Kysela
parent
f951fd3cc4
commit
eff49137dd
@@ -107,11 +107,11 @@
|
|||||||
#define PCM_FRONT_CHANNEL 0
|
#define PCM_FRONT_CHANNEL 0
|
||||||
#define PCM_REAR_CHANNEL 1
|
#define PCM_REAR_CHANNEL 1
|
||||||
#define PCM_CENTER_LFE_CHANNEL 2
|
#define PCM_CENTER_LFE_CHANNEL 2
|
||||||
#define PCM_UNKNOWN_CHANNEL 3
|
#define PCM_SIDE_CHANNEL 3
|
||||||
#define CONTROL_FRONT_CHANNEL 0
|
#define CONTROL_FRONT_CHANNEL 0
|
||||||
#define CONTROL_REAR_CHANNEL 3
|
#define CONTROL_REAR_CHANNEL 3
|
||||||
#define CONTROL_CENTER_LFE_CHANNEL 1
|
#define CONTROL_CENTER_LFE_CHANNEL 1
|
||||||
#define CONTROL_UNKNOWN_CHANNEL 2
|
#define CONTROL_SIDE_CHANNEL 2
|
||||||
|
|
||||||
/* Card IDs:
|
/* Card IDs:
|
||||||
* Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2002 -> Audigy2 ZS 7.1 Model:SB0350
|
* Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2002 -> Audigy2 ZS 7.1 Model:SB0350
|
||||||
@@ -590,7 +590,7 @@ int snd_p16v_free(struct snd_emu10k1 *chip)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
|
int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
|
||||||
{
|
{
|
||||||
struct snd_pcm *pcm;
|
struct snd_pcm *pcm;
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
@@ -644,7 +644,8 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_p16v_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
static int snd_p16v_volume_info(struct snd_kcontrol *kcontrol,
|
||||||
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
||||||
uinfo->count = 2;
|
uinfo->count = 2;
|
||||||
@@ -654,240 +655,56 @@ static int snd_p16v_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_el
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int snd_p16v_volume_get(struct snd_kcontrol *kcontrol,
|
static int snd_p16v_volume_get(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol, int reg, int high_low)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
|
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
|
||||||
u32 value;
|
int high_low = (kcontrol->private_value >> 8) & 0xff;
|
||||||
|
int reg = kcontrol->private_value & 0xff;
|
||||||
|
u32 value;
|
||||||
|
|
||||||
value = snd_emu10k1_ptr20_read(emu, reg, high_low);
|
value = snd_emu10k1_ptr20_read(emu, reg, high_low);
|
||||||
if (high_low == 1) {
|
if (high_low) {
|
||||||
ucontrol->value.integer.value[0] = 0xff - ((value >> 24) & 0xff); /* Left */
|
ucontrol->value.integer.value[0] = 0xff - ((value >> 24) & 0xff); /* Left */
|
||||||
ucontrol->value.integer.value[1] = 0xff - ((value >> 16) & 0xff); /* Right */
|
ucontrol->value.integer.value[1] = 0xff - ((value >> 16) & 0xff); /* Right */
|
||||||
} else {
|
} else {
|
||||||
ucontrol->value.integer.value[0] = 0xff - ((value >> 8) & 0xff); /* Left */
|
ucontrol->value.integer.value[0] = 0xff - ((value >> 8) & 0xff); /* Left */
|
||||||
ucontrol->value.integer.value[1] = 0xff - ((value >> 0) & 0xff); /* Right */
|
ucontrol->value.integer.value[1] = 0xff - ((value >> 0) & 0xff); /* Right */
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_get_spdif_front(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER7;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_get_spdif_center_lfe(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER7;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
static int snd_p16v_volume_get_spdif_unknown(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER8;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
static int snd_p16v_volume_get_spdif_rear(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER8;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_get_analog_front(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER9;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_get_analog_center_lfe(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER9;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
static int snd_p16v_volume_get_analog_rear(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER10;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_get_analog_unknown(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER10;
|
|
||||||
return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_p16v_volume_put(struct snd_kcontrol *kcontrol,
|
static int snd_p16v_volume_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol, int reg, int high_low)
|
struct snd_ctl_elem_value *ucontrol)
|
||||||
{
|
{
|
||||||
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
|
struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
|
||||||
u32 value;
|
int high_low = (kcontrol->private_value >> 8) & 0xff;
|
||||||
value = snd_emu10k1_ptr20_read(emu, reg, 0);
|
int reg = kcontrol->private_value & 0xff;
|
||||||
//value = value & 0xffff;
|
u32 value, oval;
|
||||||
|
|
||||||
|
oval = value = snd_emu10k1_ptr20_read(emu, reg, 0);
|
||||||
if (high_low == 1) {
|
if (high_low == 1) {
|
||||||
value &= 0xffff;
|
value &= 0xffff;
|
||||||
value = value | ((0xff - ucontrol->value.integer.value[0]) << 24) | ((0xff - ucontrol->value.integer.value[1]) << 16);
|
value |= ((0xff - ucontrol->value.integer.value[0]) << 24) |
|
||||||
|
((0xff - ucontrol->value.integer.value[1]) << 16);
|
||||||
} else {
|
} else {
|
||||||
value &= 0xffff0000;
|
value &= 0xffff0000;
|
||||||
value = value | ((0xff - ucontrol->value.integer.value[0]) << 8) | ((0xff - ucontrol->value.integer.value[1]) );
|
value |= ((0xff - ucontrol->value.integer.value[0]) << 8) |
|
||||||
|
((0xff - ucontrol->value.integer.value[1]) );
|
||||||
}
|
}
|
||||||
snd_emu10k1_ptr20_write(emu, reg, 0, value);
|
if (value != oval) {
|
||||||
return 1;
|
snd_emu10k1_ptr20_write(emu, reg, 0, value);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_p16v_volume_put_spdif_front(struct snd_kcontrol *kcontrol,
|
static int snd_p16v_capture_source_info(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
int high_low = 0;
|
static char *texts[8] = {
|
||||||
int reg = PLAYBACK_VOLUME_MIXER7;
|
"SPDIF", "I2S", "SRC48", "SRCMulti_SPDIF", "SRCMulti_I2S",
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
"CDIF", "FX", "AC97"
|
||||||
}
|
};
|
||||||
|
|
||||||
static int snd_p16v_volume_put_spdif_center_lfe(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER7;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_put_spdif_unknown(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER8;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_put_spdif_rear(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER8;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_put_analog_front(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER9;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_put_analog_center_lfe(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER9;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_put_analog_rear(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 1;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER10;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_p16v_volume_put_analog_unknown(struct snd_kcontrol *kcontrol,
|
|
||||||
struct snd_ctl_elem_value *ucontrol)
|
|
||||||
{
|
|
||||||
int high_low = 0;
|
|
||||||
int reg = PLAYBACK_VOLUME_MIXER10;
|
|
||||||
return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_analog_front =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD Analog Front Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_analog_front,
|
|
||||||
.put = snd_p16v_volume_put_analog_front
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_analog_center_lfe =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD Analog Center/LFE Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_analog_center_lfe,
|
|
||||||
.put = snd_p16v_volume_put_analog_center_lfe
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_analog_unknown =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD Analog Unknown Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_analog_unknown,
|
|
||||||
.put = snd_p16v_volume_put_analog_unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_analog_rear =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD Analog Rear Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_analog_rear,
|
|
||||||
.put = snd_p16v_volume_put_analog_rear
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_spdif_front =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD SPDIF Front Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_spdif_front,
|
|
||||||
.put = snd_p16v_volume_put_spdif_front
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_spdif_center_lfe =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD SPDIF Center/LFE Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_spdif_center_lfe,
|
|
||||||
.put = snd_p16v_volume_put_spdif_center_lfe
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_spdif_unknown =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD SPDIF Unknown Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_spdif_unknown,
|
|
||||||
.put = snd_p16v_volume_put_spdif_unknown
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_volume_control_spdif_rear =
|
|
||||||
{
|
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD SPDIF Rear Playback Volume",
|
|
||||||
.info = snd_p16v_volume_info,
|
|
||||||
.get = snd_p16v_volume_get_spdif_rear,
|
|
||||||
.put = snd_p16v_volume_put_spdif_rear
|
|
||||||
};
|
|
||||||
|
|
||||||
static int snd_p16v_capture_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
|
||||||
{
|
|
||||||
static char *texts[8] = { "SPDIF", "I2S", "SRC48", "SRCMulti_SPDIF", "SRCMulti_I2S", "CDIF", "FX", "AC97" };
|
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||||
uinfo->count = 1;
|
uinfo->count = 1;
|
||||||
@@ -927,16 +744,8 @@ static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
|
|||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_capture_source __devinitdata =
|
static int snd_p16v_capture_channel_info(struct snd_kcontrol *kcontrol,
|
||||||
{
|
struct snd_ctl_elem_info *uinfo)
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
||||||
.name = "HD source Capture",
|
|
||||||
.info = snd_p16v_capture_source_info,
|
|
||||||
.get = snd_p16v_capture_source_get,
|
|
||||||
.put = snd_p16v_capture_source_put
|
|
||||||
};
|
|
||||||
|
|
||||||
static int snd_p16v_capture_channel_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
|
|
||||||
{
|
{
|
||||||
static char *texts[4] = { "0", "1", "2", "3", };
|
static char *texts[4] = { "0", "1", "2", "3", };
|
||||||
|
|
||||||
@@ -976,60 +785,50 @@ static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
|
|||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_p16v_capture_channel __devinitdata =
|
#define P16V_VOL(xname,xreg,xhl) { \
|
||||||
{
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.info = snd_p16v_volume_info, \
|
||||||
.name = "HD channel Capture",
|
.get = snd_p16v_volume_get, \
|
||||||
.info = snd_p16v_capture_channel_info,
|
.put = snd_p16v_volume_put, \
|
||||||
.get = snd_p16v_capture_channel_get,
|
.private_value = ((xreg) | ((xhl) << 8)) \
|
||||||
.put = snd_p16v_capture_channel_put
|
}
|
||||||
|
|
||||||
|
static struct snd_kcontrol_new p16v_mixer_controls[] __devinitdata = {
|
||||||
|
P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0),
|
||||||
|
P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1),
|
||||||
|
P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1),
|
||||||
|
P16V_VOL("HD Analog Side Playback Volume", PLAYBACK_VOLUME_MIXER10, 0),
|
||||||
|
P16V_VOL("HD SPDIF Front Playback Volume", PLAYBACK_VOLUME_MIXER7, 0),
|
||||||
|
P16V_VOL("HD SPDIF Rear Playback Volume", PLAYBACK_VOLUME_MIXER8, 1),
|
||||||
|
P16V_VOL("HD SPDIF Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER7, 1),
|
||||||
|
P16V_VOL("HD SPDIF Side Playback Volume", PLAYBACK_VOLUME_MIXER8, 0),
|
||||||
|
{
|
||||||
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.name = "HD source Capture",
|
||||||
|
.info = snd_p16v_capture_source_info,
|
||||||
|
.get = snd_p16v_capture_source_get,
|
||||||
|
.put = snd_p16v_capture_source_put
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.name = "HD channel Capture",
|
||||||
|
.info = snd_p16v_capture_channel_info,
|
||||||
|
.get = snd_p16v_capture_channel_get,
|
||||||
|
.put = snd_p16v_capture_channel_put
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
int snd_p16v_mixer(struct snd_emu10k1 *emu)
|
|
||||||
|
int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu)
|
||||||
{
|
{
|
||||||
int err;
|
int i, err;
|
||||||
struct snd_kcontrol *kctl;
|
|
||||||
struct snd_card *card = emu->card;
|
struct snd_card *card = emu->card;
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_front, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
for (i = 0; i < ARRAY_SIZE(p16v_mixer_controls); i++) {
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
if ((err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i],
|
||||||
return err;
|
emu))) < 0)
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_rear, emu)) == NULL)
|
return err;
|
||||||
return -ENOMEM;
|
}
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_center_lfe, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_unknown, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_front, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_rear, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_center_lfe, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_unknown, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_capture_source, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
if ((kctl = snd_ctl_new1(&snd_p16v_capture_channel, emu)) == NULL)
|
|
||||||
return -ENOMEM;
|
|
||||||
if ((err = snd_ctl_add(card, kctl)))
|
|
||||||
return err;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user