// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>,
 *                   Takashi Iwai <tiwai@suse.de>
 *                   Creative Labs, Inc.
 *  Routines for control of EMU10K1 chips / mixer routines
 *  Multichannel PCM support Copyright (c) Lee Revell <rlrevell@joe-job.com>
 *
 *  Copyright (c) by James Courtier-Dutton <James@superbug.co.uk>
 *  	Added EMU 1010 support.
 *
 *  BUGS:
 *    --
 *
 *  TODO:
 *    --
 */

#include <linux/time.h>
#include <linux/init.h>
#include <sound/core.h>
#include <sound/emu10k1.h>
#include <linux/delay.h>
#include <sound/tlv.h>

#include "p17v.h"

#define AC97_ID_STAC9758	0x83847658

static const DECLARE_TLV_DB_SCALE(snd_audigy_db_scale2, -10350, 50, 1); /* WM8775 gain scale */


static int add_ctls(struct snd_emu10k1 *emu, const struct snd_kcontrol_new *tpl,
		    const char * const *ctls, unsigned nctls)
{
	struct snd_kcontrol_new kctl = *tpl;
	int err;

	for (unsigned i = 0; i < nctls; i++) {
		kctl.name = ctls[i];
		kctl.private_value = i;
		err = snd_ctl_add(emu->card, snd_ctl_new1(&kctl, emu));
		if (err < 0)
			return err;
	}
	return 0;
}


static int snd_emu10k1_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
	uinfo->count = 1;
	return 0;
}

static int snd_emu10k1_spdif_get(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);

	/* Limit: emu->spdif_bits */
	if (idx >= 3)
		return -EINVAL;
	ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff;
	ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff;
	ucontrol->value.iec958.status[2] = (emu->spdif_bits[idx] >> 16) & 0xff;
	ucontrol->value.iec958.status[3] = (emu->spdif_bits[idx] >> 24) & 0xff;
	return 0;
}

static int snd_emu10k1_spdif_get_mask(struct snd_kcontrol *kcontrol,
				      struct snd_ctl_elem_value *ucontrol)
{
	ucontrol->value.iec958.status[0] = 0xff;
	ucontrol->value.iec958.status[1] = 0xff;
	ucontrol->value.iec958.status[2] = 0xff;
	ucontrol->value.iec958.status[3] = 0xff;
	return 0;
}

#define PAIR_PS(base, one, two, sfx) base " " one sfx, base " " two sfx
#define LR_PS(base, sfx) PAIR_PS(base, "Left", "Right", sfx)

#define ADAT_PS(pfx, sfx) \
	pfx "ADAT 0" sfx, pfx "ADAT 1" sfx, pfx "ADAT 2" sfx, pfx "ADAT 3" sfx, \
	pfx "ADAT 4" sfx, pfx "ADAT 5" sfx, pfx "ADAT 6" sfx, pfx "ADAT 7" sfx

#define PAIR_REGS(base, one, two) \
	base ## one ## 1, \
	base ## two ## 1

#define LR_REGS(base) PAIR_REGS(base, _LEFT, _RIGHT)

#define ADAT_REGS(base) \
	base+0, base+1, base+2, base+3, base+4, base+5, base+6, base+7

/*
 * List of data sources available for each destination
 */

#define DSP_TEXTS \
	"DSP 0", "DSP 1", "DSP 2", "DSP 3", "DSP 4", "DSP 5", "DSP 6", "DSP 7", \
	"DSP 8", "DSP 9", "DSP 10", "DSP 11", "DSP 12", "DSP 13", "DSP 14", "DSP 15", \
	"DSP 16", "DSP 17", "DSP 18", "DSP 19", "DSP 20", "DSP 21", "DSP 22", "DSP 23", \
	"DSP 24", "DSP 25", "DSP 26", "DSP 27", "DSP 28", "DSP 29", "DSP 30", "DSP 31"

#define PAIR_TEXTS(base, one, two) PAIR_PS(base, one, two, "")
#define LR_TEXTS(base) LR_PS(base, "")
#define ADAT_TEXTS(pfx) ADAT_PS(pfx, "")

#define EMU32_SRC_REGS \
	EMU_SRC_ALICE_EMU32A, \
	EMU_SRC_ALICE_EMU32A+1, \
	EMU_SRC_ALICE_EMU32A+2, \
	EMU_SRC_ALICE_EMU32A+3, \
	EMU_SRC_ALICE_EMU32A+4, \
	EMU_SRC_ALICE_EMU32A+5, \
	EMU_SRC_ALICE_EMU32A+6, \
	EMU_SRC_ALICE_EMU32A+7, \
	EMU_SRC_ALICE_EMU32A+8, \
	EMU_SRC_ALICE_EMU32A+9, \
	EMU_SRC_ALICE_EMU32A+0xa, \
	EMU_SRC_ALICE_EMU32A+0xb, \
	EMU_SRC_ALICE_EMU32A+0xc, \
	EMU_SRC_ALICE_EMU32A+0xd, \
	EMU_SRC_ALICE_EMU32A+0xe, \
	EMU_SRC_ALICE_EMU32A+0xf, \
	EMU_SRC_ALICE_EMU32B, \
	EMU_SRC_ALICE_EMU32B+1, \
	EMU_SRC_ALICE_EMU32B+2, \
	EMU_SRC_ALICE_EMU32B+3, \
	EMU_SRC_ALICE_EMU32B+4, \
	EMU_SRC_ALICE_EMU32B+5, \
	EMU_SRC_ALICE_EMU32B+6, \
	EMU_SRC_ALICE_EMU32B+7, \
	EMU_SRC_ALICE_EMU32B+8, \
	EMU_SRC_ALICE_EMU32B+9, \
	EMU_SRC_ALICE_EMU32B+0xa, \
	EMU_SRC_ALICE_EMU32B+0xb, \
	EMU_SRC_ALICE_EMU32B+0xc, \
	EMU_SRC_ALICE_EMU32B+0xd, \
	EMU_SRC_ALICE_EMU32B+0xe, \
	EMU_SRC_ALICE_EMU32B+0xf

/* 1010 rev1 */

#define EMU1010_COMMON_TEXTS \
	"Silence", \
	PAIR_TEXTS("Dock Mic", "A", "B"), \
	LR_TEXTS("Dock ADC1"), \
	LR_TEXTS("Dock ADC2"), \
	LR_TEXTS("Dock ADC3"), \
	LR_TEXTS("0202 ADC"), \
	LR_TEXTS("1010 SPDIF"), \
	ADAT_TEXTS("1010 ")

static const char * const emu1010_src_texts[] = {
	EMU1010_COMMON_TEXTS,
	DSP_TEXTS,
};

static const unsigned short emu1010_src_regs[] = {
	EMU_SRC_SILENCE,
	PAIR_REGS(EMU_SRC_DOCK_MIC, _A, _B),
	LR_REGS(EMU_SRC_DOCK_ADC1),
	LR_REGS(EMU_SRC_DOCK_ADC2),
	LR_REGS(EMU_SRC_DOCK_ADC3),
	LR_REGS(EMU_SRC_HAMOA_ADC),
	LR_REGS(EMU_SRC_HANA_SPDIF),
	ADAT_REGS(EMU_SRC_HANA_ADAT),
	EMU32_SRC_REGS,
};
static_assert(ARRAY_SIZE(emu1010_src_regs) == ARRAY_SIZE(emu1010_src_texts));

/* 1010 rev2 */

#define EMU1010b_COMMON_TEXTS \
	"Silence", \
	PAIR_TEXTS("Dock Mic", "A", "B"), \
	LR_TEXTS("Dock ADC1"), \
	LR_TEXTS("Dock ADC2"), \
	LR_TEXTS("0202 ADC"), \
	LR_TEXTS("Dock SPDIF"), \
	LR_TEXTS("1010 SPDIF"), \
	ADAT_TEXTS("Dock "), \
	ADAT_TEXTS("1010 ")

static const char * const emu1010b_src_texts[] = {
	EMU1010b_COMMON_TEXTS,
	DSP_TEXTS,
};

static const unsigned short emu1010b_src_regs[] = {
	EMU_SRC_SILENCE,
	PAIR_REGS(EMU_SRC_DOCK_MIC, _A, _B),
	LR_REGS(EMU_SRC_DOCK_ADC1),
	LR_REGS(EMU_SRC_DOCK_ADC2),
	LR_REGS(EMU_SRC_HAMOA_ADC),
	LR_REGS(EMU_SRC_MDOCK_SPDIF),
	LR_REGS(EMU_SRC_HANA_SPDIF),
	ADAT_REGS(EMU_SRC_MDOCK_ADAT),
	ADAT_REGS(EMU_SRC_HANA_ADAT),
	EMU32_SRC_REGS,
};
static_assert(ARRAY_SIZE(emu1010b_src_regs) == ARRAY_SIZE(emu1010b_src_texts));

/* 1616(m) cardbus */

#define EMU1616_COMMON_TEXTS \
	"Silence", \
	PAIR_TEXTS("Mic", "A", "B"), \
	LR_TEXTS("ADC1"), \
	LR_TEXTS("ADC2"), \
	LR_TEXTS("SPDIF"), \
	ADAT_TEXTS("")

static const char * const emu1616_src_texts[] = {
	EMU1616_COMMON_TEXTS,
	DSP_TEXTS,
};

static const unsigned short emu1616_src_regs[] = {
	EMU_SRC_SILENCE,
	PAIR_REGS(EMU_SRC_DOCK_MIC, _A, _B),
	LR_REGS(EMU_SRC_DOCK_ADC1),
	LR_REGS(EMU_SRC_DOCK_ADC2),
	LR_REGS(EMU_SRC_MDOCK_SPDIF),
	ADAT_REGS(EMU_SRC_MDOCK_ADAT),
	EMU32_SRC_REGS,
};
static_assert(ARRAY_SIZE(emu1616_src_regs) == ARRAY_SIZE(emu1616_src_texts));

/* 0404 rev1 & rev2 */

#define EMU0404_COMMON_TEXTS \
	"Silence", \
	LR_TEXTS("ADC"), \
	LR_TEXTS("SPDIF")

static const char * const emu0404_src_texts[] = {
	EMU0404_COMMON_TEXTS,
	DSP_TEXTS,
};

static const unsigned short emu0404_src_regs[] = {
	EMU_SRC_SILENCE,
	LR_REGS(EMU_SRC_HAMOA_ADC),
	LR_REGS(EMU_SRC_HANA_SPDIF),
	EMU32_SRC_REGS,
};
static_assert(ARRAY_SIZE(emu0404_src_regs) == ARRAY_SIZE(emu0404_src_texts));

/*
 * Data destinations - physical EMU outputs.
 * Each destination has an enum mixer control to choose a data source
 */

#define LR_CTLS(base) LR_PS(base, " Playback Enum")
#define ADAT_CTLS(pfx) ADAT_PS(pfx, " Playback Enum")

/* 1010 rev1 */

static const char * const emu1010_output_texts[] = {
	LR_CTLS("Dock DAC1"),
	LR_CTLS("Dock DAC2"),
	LR_CTLS("Dock DAC3"),
	LR_CTLS("Dock DAC4"),
	LR_CTLS("Dock Phones"),
	LR_CTLS("Dock SPDIF"),
	LR_CTLS("0202 DAC"),
	LR_CTLS("1010 SPDIF"),
	ADAT_CTLS("1010 "),
};
static_assert(ARRAY_SIZE(emu1010_output_texts) <= NUM_OUTPUT_DESTS);

static const unsigned short emu1010_output_dst[] = {
	LR_REGS(EMU_DST_DOCK_DAC1),
	LR_REGS(EMU_DST_DOCK_DAC2),
	LR_REGS(EMU_DST_DOCK_DAC3),
	LR_REGS(EMU_DST_DOCK_DAC4),
	LR_REGS(EMU_DST_DOCK_PHONES),
	LR_REGS(EMU_DST_DOCK_SPDIF),
	LR_REGS(EMU_DST_HAMOA_DAC),
	LR_REGS(EMU_DST_HANA_SPDIF),
	ADAT_REGS(EMU_DST_HANA_ADAT),
};
static_assert(ARRAY_SIZE(emu1010_output_dst) == ARRAY_SIZE(emu1010_output_texts));

static const unsigned short emu1010_output_dflt[] = {
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5,
	EMU_SRC_ALICE_EMU32A+6, EMU_SRC_ALICE_EMU32A+7,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1, EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5, EMU_SRC_ALICE_EMU32A+6, EMU_SRC_ALICE_EMU32A+7,
};
static_assert(ARRAY_SIZE(emu1010_output_dflt) == ARRAY_SIZE(emu1010_output_dst));

/* 1010 rev2 */

static const char * const snd_emu1010b_output_texts[] = {
	LR_CTLS("Dock DAC1"),
	LR_CTLS("Dock DAC2"),
	LR_CTLS("Dock DAC3"),
	LR_CTLS("Dock SPDIF"),
	ADAT_CTLS("Dock "),
	LR_CTLS("0202 DAC"),
	LR_CTLS("1010 SPDIF"),
	ADAT_CTLS("1010 "),
};
static_assert(ARRAY_SIZE(snd_emu1010b_output_texts) <= NUM_OUTPUT_DESTS);

static const unsigned short emu1010b_output_dst[] = {
	LR_REGS(EMU_DST_DOCK_DAC1),
	LR_REGS(EMU_DST_DOCK_DAC2),
	LR_REGS(EMU_DST_DOCK_DAC3),
	LR_REGS(EMU_DST_MDOCK_SPDIF),
	ADAT_REGS(EMU_DST_MDOCK_ADAT),
	LR_REGS(EMU_DST_HAMOA_DAC),
	LR_REGS(EMU_DST_HANA_SPDIF),
	ADAT_REGS(EMU_DST_HANA_ADAT),
};
static_assert(ARRAY_SIZE(emu1010b_output_dst) == ARRAY_SIZE(snd_emu1010b_output_texts));

static const unsigned short emu1010b_output_dflt[] = {
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1, EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5, EMU_SRC_ALICE_EMU32A+6, EMU_SRC_ALICE_EMU32A+7,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1, EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5, EMU_SRC_ALICE_EMU32A+6, EMU_SRC_ALICE_EMU32A+7,
};

/* 1616(m) cardbus */

static const char * const snd_emu1616_output_texts[] = {
	LR_CTLS("Dock DAC1"),
	LR_CTLS("Dock DAC2"),
	LR_CTLS("Dock DAC3"),
	LR_CTLS("Dock SPDIF"),
	ADAT_CTLS("Dock "),
	LR_CTLS("Mana DAC"),
};
static_assert(ARRAY_SIZE(snd_emu1616_output_texts) <= NUM_OUTPUT_DESTS);

static const unsigned short emu1616_output_dst[] = {
	LR_REGS(EMU_DST_DOCK_DAC1),
	LR_REGS(EMU_DST_DOCK_DAC2),
	LR_REGS(EMU_DST_DOCK_DAC3),
	LR_REGS(EMU_DST_MDOCK_SPDIF),
	ADAT_REGS(EMU_DST_MDOCK_ADAT),
	EMU_DST_MANA_DAC_LEFT, EMU_DST_MANA_DAC_RIGHT,
};
static_assert(ARRAY_SIZE(emu1616_output_dst) == ARRAY_SIZE(snd_emu1616_output_texts));

static const unsigned short emu1616_output_dflt[] = {
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1, EMU_SRC_ALICE_EMU32A+2, EMU_SRC_ALICE_EMU32A+3,
	EMU_SRC_ALICE_EMU32A+4, EMU_SRC_ALICE_EMU32A+5, EMU_SRC_ALICE_EMU32A+6, EMU_SRC_ALICE_EMU32A+7,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
};
static_assert(ARRAY_SIZE(emu1616_output_dflt) == ARRAY_SIZE(emu1616_output_dst));

/* 0404 rev1 & rev2 */

static const char * const snd_emu0404_output_texts[] = {
	LR_CTLS("DAC"),
	LR_CTLS("SPDIF"),
};
static_assert(ARRAY_SIZE(snd_emu0404_output_texts) <= NUM_OUTPUT_DESTS);

static const unsigned short emu0404_output_dst[] = {
	LR_REGS(EMU_DST_HAMOA_DAC),
	LR_REGS(EMU_DST_HANA_SPDIF),
};
static_assert(ARRAY_SIZE(emu0404_output_dst) == ARRAY_SIZE(snd_emu0404_output_texts));

static const unsigned short emu0404_output_dflt[] = {
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
	EMU_SRC_ALICE_EMU32A+0, EMU_SRC_ALICE_EMU32A+1,
};
static_assert(ARRAY_SIZE(emu0404_output_dflt) == ARRAY_SIZE(emu0404_output_dst));

/*
 * Data destinations - FPGA outputs going to Alice2 (Audigy) for
 *   capture (EMU32 + I2S links)
 * Each destination has an enum mixer control to choose a data source
 */

static const char * const emu1010_input_texts[] = {
	"DSP 0 Capture Enum",
	"DSP 1 Capture Enum",
	"DSP 2 Capture Enum",
	"DSP 3 Capture Enum",
	"DSP 4 Capture Enum",
	"DSP 5 Capture Enum",
	"DSP 6 Capture Enum",
	"DSP 7 Capture Enum",
	"DSP 8 Capture Enum",
	"DSP 9 Capture Enum",
	"DSP A Capture Enum",
	"DSP B Capture Enum",
	"DSP C Capture Enum",
	"DSP D Capture Enum",
	"DSP E Capture Enum",
	"DSP F Capture Enum",
	/* These exist only on rev1 EMU1010 cards. */
	"DSP 10 Capture Enum",
	"DSP 11 Capture Enum",
	"DSP 12 Capture Enum",
	"DSP 13 Capture Enum",
	"DSP 14 Capture Enum",
	"DSP 15 Capture Enum",
};
static_assert(ARRAY_SIZE(emu1010_input_texts) <= NUM_INPUT_DESTS);

static const unsigned short emu1010_input_dst[] = {
	EMU_DST_ALICE2_EMU32_0,
	EMU_DST_ALICE2_EMU32_1,
	EMU_DST_ALICE2_EMU32_2,
	EMU_DST_ALICE2_EMU32_3,
	EMU_DST_ALICE2_EMU32_4,
	EMU_DST_ALICE2_EMU32_5,
	EMU_DST_ALICE2_EMU32_6,
	EMU_DST_ALICE2_EMU32_7,
	EMU_DST_ALICE2_EMU32_8,
	EMU_DST_ALICE2_EMU32_9,
	EMU_DST_ALICE2_EMU32_A,
	EMU_DST_ALICE2_EMU32_B,
	EMU_DST_ALICE2_EMU32_C,
	EMU_DST_ALICE2_EMU32_D,
	EMU_DST_ALICE2_EMU32_E,
	EMU_DST_ALICE2_EMU32_F,
	/* These exist only on rev1 EMU1010 cards. */
	EMU_DST_ALICE_I2S0_LEFT,
	EMU_DST_ALICE_I2S0_RIGHT,
	EMU_DST_ALICE_I2S1_LEFT,
	EMU_DST_ALICE_I2S1_RIGHT,
	EMU_DST_ALICE_I2S2_LEFT,
	EMU_DST_ALICE_I2S2_RIGHT,
};
static_assert(ARRAY_SIZE(emu1010_input_dst) == ARRAY_SIZE(emu1010_input_texts));

static const unsigned short emu1010_input_dflt[] = {
	EMU_SRC_DOCK_MIC_A1,
	EMU_SRC_DOCK_MIC_B1,
	EMU_SRC_HAMOA_ADC_LEFT1,
	EMU_SRC_HAMOA_ADC_RIGHT1,
	EMU_SRC_DOCK_ADC1_LEFT1,
	EMU_SRC_DOCK_ADC1_RIGHT1,
	EMU_SRC_DOCK_ADC2_LEFT1,
	EMU_SRC_DOCK_ADC2_RIGHT1,
	/* Pavel Hofman - setting defaults for all capture channels.
	 * Defaults only, users will set their own values anyways, let's
	 * just copy/paste. */
	EMU_SRC_DOCK_MIC_A1,
	EMU_SRC_DOCK_MIC_B1,
	EMU_SRC_HAMOA_ADC_LEFT1,
	EMU_SRC_HAMOA_ADC_RIGHT1,
	EMU_SRC_DOCK_ADC1_LEFT1,
	EMU_SRC_DOCK_ADC1_RIGHT1,
	EMU_SRC_DOCK_ADC2_LEFT1,
	EMU_SRC_DOCK_ADC2_RIGHT1,

	EMU_SRC_DOCK_ADC1_LEFT1,
	EMU_SRC_DOCK_ADC1_RIGHT1,
	EMU_SRC_DOCK_ADC2_LEFT1,
	EMU_SRC_DOCK_ADC2_RIGHT1,
	EMU_SRC_DOCK_ADC3_LEFT1,
	EMU_SRC_DOCK_ADC3_RIGHT1,
};
static_assert(ARRAY_SIZE(emu1010_input_dflt) == ARRAY_SIZE(emu1010_input_dst));

static const unsigned short emu0404_input_dflt[] = {
	EMU_SRC_HAMOA_ADC_LEFT1,
	EMU_SRC_HAMOA_ADC_RIGHT1,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_HANA_SPDIF_LEFT1,
	EMU_SRC_HANA_SPDIF_RIGHT1,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
	EMU_SRC_SILENCE,
};

struct snd_emu1010_routing_info {
	const char * const *src_texts;
	const char * const *out_texts;
	const unsigned short *src_regs;
	const unsigned short *out_regs;
	const unsigned short *in_regs;
	const unsigned short *out_dflts;
	const unsigned short *in_dflts;
	unsigned n_srcs;
	unsigned n_outs;
	unsigned n_ins;
};

static const struct snd_emu1010_routing_info emu1010_routing_info[] = {
	{
		/* rev1 1010 */
		.src_regs = emu1010_src_regs,
		.src_texts = emu1010_src_texts,
		.n_srcs = ARRAY_SIZE(emu1010_src_texts),

		.out_dflts = emu1010_output_dflt,
		.out_regs = emu1010_output_dst,
		.out_texts = emu1010_output_texts,
		.n_outs = ARRAY_SIZE(emu1010_output_dst),

		.in_dflts = emu1010_input_dflt,
		.in_regs = emu1010_input_dst,
		.n_ins = ARRAY_SIZE(emu1010_input_dst),
	},
	{
		/* rev2 1010 */
		.src_regs = emu1010b_src_regs,
		.src_texts = emu1010b_src_texts,
		.n_srcs = ARRAY_SIZE(emu1010b_src_texts),

		.out_dflts = emu1010b_output_dflt,
		.out_regs = emu1010b_output_dst,
		.out_texts = snd_emu1010b_output_texts,
		.n_outs = ARRAY_SIZE(emu1010b_output_dst),

		.in_dflts = emu1010_input_dflt,
		.in_regs = emu1010_input_dst,
		.n_ins = ARRAY_SIZE(emu1010_input_dst) - 6,
	},
	{
		/* 1616(m) cardbus */
		.src_regs = emu1616_src_regs,
		.src_texts = emu1616_src_texts,
		.n_srcs = ARRAY_SIZE(emu1616_src_texts),

		.out_dflts = emu1616_output_dflt,
		.out_regs = emu1616_output_dst,
		.out_texts = snd_emu1616_output_texts,
		.n_outs = ARRAY_SIZE(emu1616_output_dst),

		.in_dflts = emu1010_input_dflt,
		.in_regs = emu1010_input_dst,
		.n_ins = ARRAY_SIZE(emu1010_input_dst) - 6,
	},
	{
		/* 0404 */
		.src_regs = emu0404_src_regs,
		.src_texts = emu0404_src_texts,
		.n_srcs = ARRAY_SIZE(emu0404_src_texts),

		.out_dflts = emu0404_output_dflt,
		.out_regs = emu0404_output_dst,
		.out_texts = snd_emu0404_output_texts,
		.n_outs = ARRAY_SIZE(emu0404_output_dflt),

		.in_dflts = emu0404_input_dflt,
		.in_regs = emu1010_input_dst,
		.n_ins = ARRAY_SIZE(emu1010_input_dst) - 6,
	},
};

static unsigned emu1010_idx(struct snd_emu10k1 *emu)
{
	return emu->card_capabilities->emu_model - 1;
}

static void snd_emu1010_output_source_apply(struct snd_emu10k1 *emu,
					    int channel, int src)
{
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];

	snd_emu1010_fpga_link_dst_src_write(emu,
		emu_ri->out_regs[channel], emu_ri->src_regs[src]);
}

static void snd_emu1010_input_source_apply(struct snd_emu10k1 *emu,
					   int channel, int src)
{
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];

	snd_emu1010_fpga_link_dst_src_write(emu,
		emu_ri->in_regs[channel], emu_ri->src_regs[src]);
}

static void snd_emu1010_apply_sources(struct snd_emu10k1 *emu)
{
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];

	for (unsigned i = 0; i < emu_ri->n_outs; i++)
		snd_emu1010_output_source_apply(
			emu, i, emu->emu1010.output_source[i]);
	for (unsigned i = 0; i < emu_ri->n_ins; i++)
		snd_emu1010_input_source_apply(
			emu, i, emu->emu1010.input_source[i]);
}

static u8 emu1010_map_source(const struct snd_emu1010_routing_info *emu_ri,
			     unsigned val)
{
	for (unsigned i = 0; i < emu_ri->n_srcs; i++)
		if (val == emu_ri->src_regs[i])
			return i;
	return 0;
}

static int snd_emu1010_input_output_source_info(struct snd_kcontrol *kcontrol,
						struct snd_ctl_elem_info *uinfo)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];

	return snd_ctl_enum_info(uinfo, 1, emu_ri->n_srcs, emu_ri->src_texts);
}

static int snd_emu1010_output_source_get(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];
	unsigned channel = kcontrol->private_value;

	if (channel >= emu_ri->n_outs)
		return -EINVAL;
	ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
	return 0;
}

static int snd_emu1010_output_source_put(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];
	unsigned val = ucontrol->value.enumerated.item[0];
	unsigned channel = kcontrol->private_value;
	int change;

	if (val >= emu_ri->n_srcs)
		return -EINVAL;
	if (channel >= emu_ri->n_outs)
		return -EINVAL;
	change = (emu->emu1010.output_source[channel] != val);
	if (change) {
		emu->emu1010.output_source[channel] = val;
		snd_emu1010_output_source_apply(emu, channel, val);
	}
	return change;
}

static const struct snd_kcontrol_new emu1010_output_source_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.info = snd_emu1010_input_output_source_info,
	.get = snd_emu1010_output_source_get,
	.put = snd_emu1010_output_source_put
};

static int snd_emu1010_input_source_get(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];
	unsigned channel = kcontrol->private_value;

	if (channel >= emu_ri->n_ins)
		return -EINVAL;
	ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel];
	return 0;
}

static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];
	unsigned val = ucontrol->value.enumerated.item[0];
	unsigned channel = kcontrol->private_value;
	int change;

	if (val >= emu_ri->n_srcs)
		return -EINVAL;
	if (channel >= emu_ri->n_ins)
		return -EINVAL;
	change = (emu->emu1010.input_source[channel] != val);
	if (change) {
		emu->emu1010.input_source[channel] = val;
		snd_emu1010_input_source_apply(emu, channel, val);
	}
	return change;
}

static const struct snd_kcontrol_new emu1010_input_source_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.info = snd_emu1010_input_output_source_info,
	.get = snd_emu1010_input_source_get,
	.put = snd_emu1010_input_source_put
};

static int add_emu1010_source_mixers(struct snd_emu10k1 *emu)
{
	const struct snd_emu1010_routing_info *emu_ri =
		&emu1010_routing_info[emu1010_idx(emu)];
	int err;

	err = add_ctls(emu, &emu1010_output_source_ctl,
		       emu_ri->out_texts, emu_ri->n_outs);
	if (err < 0)
		return err;
	err = add_ctls(emu, &emu1010_input_source_ctl,
		       emu1010_input_texts, emu_ri->n_ins);
	return err;
}


static const char * const snd_emu1010_adc_pads[] = {
	"ADC1 14dB PAD 0202 Capture Switch",
	"ADC1 14dB PAD Audio Dock Capture Switch",
	"ADC2 14dB PAD Audio Dock Capture Switch",
	"ADC3 14dB PAD Audio Dock Capture Switch",
};

static const unsigned short snd_emu1010_adc_pad_regs[] = {
	EMU_HANA_0202_ADC_PAD1,
	EMU_HANA_DOCK_ADC_PAD1,
	EMU_HANA_DOCK_ADC_PAD2,
	EMU_HANA_DOCK_ADC_PAD3,
};

#define snd_emu1010_adc_pads_info	snd_ctl_boolean_mono_info

static int snd_emu1010_adc_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int mask = snd_emu1010_adc_pad_regs[kcontrol->private_value];

	ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0;
	return 0;
}

static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int mask = snd_emu1010_adc_pad_regs[kcontrol->private_value];
	unsigned int val, cache;
	val = ucontrol->value.integer.value[0];
	cache = emu->emu1010.adc_pads;
	if (val == 1) 
		cache = cache | mask;
	else
		cache = cache & ~mask;
	if (cache != emu->emu1010.adc_pads) {
		snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, cache );
	        emu->emu1010.adc_pads = cache;
	}

	return 0;
}

static const struct snd_kcontrol_new emu1010_adc_pads_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.info = snd_emu1010_adc_pads_info,
	.get = snd_emu1010_adc_pads_get,
	.put = snd_emu1010_adc_pads_put
};


static const char * const snd_emu1010_dac_pads[] = {
	"DAC1 0202 14dB PAD Playback Switch",
	"DAC1 Audio Dock 14dB PAD Playback Switch",
	"DAC2 Audio Dock 14dB PAD Playback Switch",
	"DAC3 Audio Dock 14dB PAD Playback Switch",
	"DAC4 Audio Dock 14dB PAD Playback Switch",
};

static const unsigned short snd_emu1010_dac_regs[] = {
	EMU_HANA_0202_DAC_PAD1,
	EMU_HANA_DOCK_DAC_PAD1,
	EMU_HANA_DOCK_DAC_PAD2,
	EMU_HANA_DOCK_DAC_PAD3,
	EMU_HANA_DOCK_DAC_PAD4,
};

#define snd_emu1010_dac_pads_info	snd_ctl_boolean_mono_info

static int snd_emu1010_dac_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int mask = snd_emu1010_dac_regs[kcontrol->private_value];

	ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0;
	return 0;
}

static int snd_emu1010_dac_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int mask = snd_emu1010_dac_regs[kcontrol->private_value];
	unsigned int val, cache;
	int change;

	val = ucontrol->value.integer.value[0];
	cache = emu->emu1010.dac_pads;
	if (val == 1) 
		cache = cache | mask;
	else
		cache = cache & ~mask;
	change = (cache != emu->emu1010.dac_pads);
	if (change) {
		snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, cache );
	        emu->emu1010.dac_pads = cache;
	}

	return change;
}

static const struct snd_kcontrol_new emu1010_dac_pads_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.info = snd_emu1010_dac_pads_info,
	.get = snd_emu1010_dac_pads_get,
	.put = snd_emu1010_dac_pads_put
};


struct snd_emu1010_pads_info {
	const char * const *adc_ctls, * const *dac_ctls;
	unsigned n_adc_ctls, n_dac_ctls;
};

static const struct snd_emu1010_pads_info emu1010_pads_info[] = {
	{
		/* rev1 1010 */
		.adc_ctls = snd_emu1010_adc_pads,
		.n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads),
		.dac_ctls = snd_emu1010_dac_pads,
		.n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads),
	},
	{
		/* rev2 1010 */
		.adc_ctls = snd_emu1010_adc_pads,
		.n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads) - 1,
		.dac_ctls = snd_emu1010_dac_pads,
		.n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads) - 1,
	},
	{
		/* 1616(m) cardbus */
		.adc_ctls = snd_emu1010_adc_pads + 1,
		.n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads) - 2,
		.dac_ctls = snd_emu1010_dac_pads + 1,
		.n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads) - 2,
	},
	{
		/* 0404 */
		.adc_ctls = NULL,
		.n_adc_ctls = 0,
		.dac_ctls = NULL,
		.n_dac_ctls = 0,
	},
};

static const char * const emu1010_clock_texts[] = {
	"44100", "48000", "SPDIF", "ADAT", "Dock", "BNC"
};

static const u8 emu1010_clock_vals[] = {
	EMU_HANA_WCLOCK_INT_44_1K,
	EMU_HANA_WCLOCK_INT_48K,
	EMU_HANA_WCLOCK_HANA_SPDIF_IN,
	EMU_HANA_WCLOCK_HANA_ADAT_IN,
	EMU_HANA_WCLOCK_2ND_HANA,
	EMU_HANA_WCLOCK_SYNC_BNC,
};

static const char * const emu0404_clock_texts[] = {
	"44100", "48000", "SPDIF", "BNC"
};

static const u8 emu0404_clock_vals[] = {
	EMU_HANA_WCLOCK_INT_44_1K,
	EMU_HANA_WCLOCK_INT_48K,
	EMU_HANA_WCLOCK_HANA_SPDIF_IN,
	EMU_HANA_WCLOCK_SYNC_BNC,
};

struct snd_emu1010_clock_info {
	const char * const *texts;
	const u8 *vals;
	unsigned num;
};

static const struct snd_emu1010_clock_info emu1010_clock_info[] = {
	{
		// rev1 1010
		.texts = emu1010_clock_texts,
		.vals = emu1010_clock_vals,
		.num = ARRAY_SIZE(emu1010_clock_vals),
	},
	{
		// rev2 1010
		.texts = emu1010_clock_texts,
		.vals = emu1010_clock_vals,
		.num = ARRAY_SIZE(emu1010_clock_vals) - 1,
	},
	{
		// 1616(m) CardBus
		.texts = emu1010_clock_texts,
		// TODO: determine what is actually available.
		// Pedantically, *every* source comes from the 2nd FPGA, as the
		// card itself has no own (digital) audio ports. The user manual
		// claims that ADAT and S/PDIF clock sources are separate, which
		// can mean two things: either E-MU mapped the dock's sources to
		// the primary ones, or they determine the meaning of the "Dock"
		// source depending on how the ports are actually configured
		// (which the 2nd FPGA must be doing anyway).
		.vals = emu1010_clock_vals,
		.num = ARRAY_SIZE(emu1010_clock_vals),
	},
	{
		// 0404
		.texts = emu0404_clock_texts,
		.vals = emu0404_clock_vals,
		.num = ARRAY_SIZE(emu0404_clock_vals),
	},
};

static int snd_emu1010_clock_source_info(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_info *uinfo)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_clock_info *emu_ci =
		&emu1010_clock_info[emu1010_idx(emu)];
		
	return snd_ctl_enum_info(uinfo, 1, emu_ci->num, emu_ci->texts);
}

static int snd_emu1010_clock_source_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);

	ucontrol->value.enumerated.item[0] = emu->emu1010.clock_source;
	return 0;
}

static int snd_emu1010_clock_source_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	const struct snd_emu1010_clock_info *emu_ci =
		&emu1010_clock_info[emu1010_idx(emu)];
	unsigned int val;
	int change = 0;

	val = ucontrol->value.enumerated.item[0] ;
	if (val >= emu_ci->num)
		return -EINVAL;
	change = (emu->emu1010.clock_source != val);
	if (change) {
		emu->emu1010.clock_source = val;
		emu->emu1010.wclock = emu_ci->vals[val];

		snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE);
		snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, emu->emu1010.wclock);
		msleep(10);  // Allow DLL to settle
		snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);

		snd_emu1010_update_clock(emu);
	}
	return change;
}

static const struct snd_kcontrol_new snd_emu1010_clock_source =
{
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Clock Source",
	.count = 1,
	.info = snd_emu1010_clock_source_info,
	.get = snd_emu1010_clock_source_get,
	.put = snd_emu1010_clock_source_put
};

static int snd_emu1010_clock_fallback_info(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_info *uinfo)
{
	static const char * const texts[2] = {
		"44100", "48000"
	};

	return snd_ctl_enum_info(uinfo, 1, 2, texts);
}

static int snd_emu1010_clock_fallback_get(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);

	ucontrol->value.enumerated.item[0] = emu->emu1010.clock_fallback;
	return 0;
}

static int snd_emu1010_clock_fallback_put(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int val = ucontrol->value.enumerated.item[0];
	int change;

	if (val >= 2)
		return -EINVAL;
	change = (emu->emu1010.clock_fallback != val);
	if (change) {
		emu->emu1010.clock_fallback = val;
		snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 1 - val);
	}
	return change;
}

static const struct snd_kcontrol_new snd_emu1010_clock_fallback =
{
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.name = "Clock Fallback",
	.count = 1,
	.info = snd_emu1010_clock_fallback_info,
	.get = snd_emu1010_clock_fallback_get,
	.put = snd_emu1010_clock_fallback_put
};

static int snd_emu1010_optical_out_info(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_info *uinfo)
{
	static const char * const texts[2] = {
		"SPDIF", "ADAT"
	};

	return snd_ctl_enum_info(uinfo, 1, 2, texts);
}

static int snd_emu1010_optical_out_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);

	ucontrol->value.enumerated.item[0] = emu->emu1010.optical_out;
	return 0;
}

static int snd_emu1010_optical_out_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int val;
	u32 tmp;
	int change = 0;

	val = ucontrol->value.enumerated.item[0];
	/* Limit: uinfo->value.enumerated.items = 2; */
	if (val >= 2)
		return -EINVAL;
	change = (emu->emu1010.optical_out != val);
	if (change) {
		emu->emu1010.optical_out = val;
		tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) |
			(emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF);
		snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
	}
	return change;
}

static const struct snd_kcontrol_new snd_emu1010_optical_out = {
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
	.name =         "Optical Output Mode",
	.count =	1,
	.info =         snd_emu1010_optical_out_info,
	.get =          snd_emu1010_optical_out_get,
	.put =          snd_emu1010_optical_out_put
};

static int snd_emu1010_optical_in_info(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_info *uinfo)
{
	static const char * const texts[2] = {
		"SPDIF", "ADAT"
	};

	return snd_ctl_enum_info(uinfo, 1, 2, texts);
}

static int snd_emu1010_optical_in_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);

	ucontrol->value.enumerated.item[0] = emu->emu1010.optical_in;
	return 0;
}

static int snd_emu1010_optical_in_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int val;
	u32 tmp;
	int change = 0;

	val = ucontrol->value.enumerated.item[0];
	/* Limit: uinfo->value.enumerated.items = 2; */
	if (val >= 2)
		return -EINVAL;
	change = (emu->emu1010.optical_in != val);
	if (change) {
		emu->emu1010.optical_in = val;
		tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) |
			(emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF);
		snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
	}
	return change;
}

static const struct snd_kcontrol_new snd_emu1010_optical_in = {
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
	.name =         "Optical Input Mode",
	.count =	1,
	.info =         snd_emu1010_optical_in_info,
	.get =          snd_emu1010_optical_in_get,
	.put =          snd_emu1010_optical_in_put
};

static int snd_audigy_i2c_capture_source_info(struct snd_kcontrol *kcontrol,
					  struct snd_ctl_elem_info *uinfo)
{
#if 0
	static const char * const texts[4] = {
		"Unknown1", "Unknown2", "Mic", "Line"
	};
#endif
	static const char * const texts[2] = {
		"Mic", "Line"
	};

	return snd_ctl_enum_info(uinfo, 1, 2, texts);
}

static int snd_audigy_i2c_capture_source_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);

	ucontrol->value.enumerated.item[0] = emu->i2c_capture_source;
	return 0;
}

static int snd_audigy_i2c_capture_source_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int source_id;
	unsigned int ngain, ogain;
	u16 gpio;
	int change = 0;
	unsigned long flags;
	u32 source;
	/* If the capture source has changed,
	 * update the capture volume from the cached value
	 * for the particular source.
	 */
	source_id = ucontrol->value.enumerated.item[0];
	/* Limit: uinfo->value.enumerated.items = 2; */
	/*        emu->i2c_capture_volume */
	if (source_id >= 2)
		return -EINVAL;
	change = (emu->i2c_capture_source != source_id);
	if (change) {
		snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */
		spin_lock_irqsave(&emu->emu_lock, flags);
		gpio = inw(emu->port + A_IOCFG);
		if (source_id==0)
			outw(gpio | 0x4, emu->port + A_IOCFG);
		else
			outw(gpio & ~0x4, emu->port + A_IOCFG);
		spin_unlock_irqrestore(&emu->emu_lock, flags);

		ngain = emu->i2c_capture_volume[source_id][0]; /* Left */
		ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */
		if (ngain != ogain)
			snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff));
		ngain = emu->i2c_capture_volume[source_id][1]; /* Right */
		ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Right */
		if (ngain != ogain)
			snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));

		source = 1 << (source_id + 2);
		snd_emu10k1_i2c_write(emu, ADC_MUX, source); /* Set source */
		emu->i2c_capture_source = source_id;
	}
        return change;
}

static const struct snd_kcontrol_new snd_audigy_i2c_capture_source =
{
		.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
		.name =		"Capture Source",
		.info =		snd_audigy_i2c_capture_source_info,
		.get =		snd_audigy_i2c_capture_source_get,
		.put =		snd_audigy_i2c_capture_source_put
};

static int snd_audigy_i2c_volume_info(struct snd_kcontrol *kcontrol,
				  struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 2;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 255;
	return 0;
}

static int snd_audigy_i2c_volume_get(struct snd_kcontrol *kcontrol,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int source_id;

	source_id = kcontrol->private_value;
	/* Limit: emu->i2c_capture_volume */
        /*        capture_source: uinfo->value.enumerated.items = 2 */
	if (source_id >= 2)
		return -EINVAL;

	ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0];
	ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1];
	return 0;
}

static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
				 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int ogain;
	unsigned int ngain0, ngain1;
	unsigned int source_id;
	int change = 0;

	source_id = kcontrol->private_value;
	/* Limit: emu->i2c_capture_volume */
        /*        capture_source: uinfo->value.enumerated.items = 2 */
	if (source_id >= 2)
		return -EINVAL;
	ngain0 = ucontrol->value.integer.value[0];
	ngain1 = ucontrol->value.integer.value[1];
	if (ngain0 > 0xff)
		return -EINVAL;
	if (ngain1 > 0xff)
		return -EINVAL;
	ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
	if (ogain != ngain0) {
		if (emu->i2c_capture_source == source_id)
			snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ngain0);
		emu->i2c_capture_volume[source_id][0] = ngain0;
		change = 1;
	}
	ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
	if (ogain != ngain1) {
		if (emu->i2c_capture_source == source_id)
			snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ngain1);
		emu->i2c_capture_volume[source_id][1] = ngain1;
		change = 1;
	}

	return change;
}

static const struct snd_kcontrol_new i2c_volume_ctl = {
	.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
	.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
	          SNDRV_CTL_ELEM_ACCESS_TLV_READ,
	.info = snd_audigy_i2c_volume_info,
	.get = snd_audigy_i2c_volume_get,
	.put = snd_audigy_i2c_volume_put,
	.tlv = { .p = snd_audigy_db_scale2 }
};

static const char * const snd_audigy_i2c_volume_ctls[] = {
	"Mic Capture Volume",
	"Line Capture Volume",
};

#if 0
static int snd_audigy_spdif_output_rate_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	static const char * const texts[] = {"44100", "48000", "96000"};

	return snd_ctl_enum_info(uinfo, 1, 3, texts);
}

static int snd_audigy_spdif_output_rate_get(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int tmp;

	tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
	switch (tmp & A_SPDIF_RATE_MASK) {
	case A_SPDIF_44100:
		ucontrol->value.enumerated.item[0] = 0;
		break;
	case A_SPDIF_48000:
		ucontrol->value.enumerated.item[0] = 1;
		break;
	case A_SPDIF_96000:
		ucontrol->value.enumerated.item[0] = 2;
		break;
	default:
		ucontrol->value.enumerated.item[0] = 1;
	}
	return 0;
}

static int snd_audigy_spdif_output_rate_put(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	int change;
	unsigned int reg, val, tmp;
	unsigned long flags;

	switch(ucontrol->value.enumerated.item[0]) {
	case 0:
		val = A_SPDIF_44100;
		break;
	case 1:
		val = A_SPDIF_48000;
		break;
	case 2:
		val = A_SPDIF_96000;
		break;
	default:
		val = A_SPDIF_48000;
		break;
	}

	
	spin_lock_irqsave(&emu->reg_lock, flags);
	reg = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
	tmp = reg & ~A_SPDIF_RATE_MASK;
	tmp |= val;
	change = (tmp != reg);
	if (change)
		snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_audigy_spdif_output_rate =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE,
	.iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
	.name =         "Audigy SPDIF Output Sample Rate",
	.count =	1,
	.info =         snd_audigy_spdif_output_rate_info,
	.get =          snd_audigy_spdif_output_rate_get,
	.put =          snd_audigy_spdif_output_rate_put
};
#endif

static int snd_emu10k1_spdif_put(struct snd_kcontrol *kcontrol,
                                 struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
	int change;
	unsigned int val;

	/* Limit: emu->spdif_bits */
	if (idx >= 3)
		return -EINVAL;
	val = (ucontrol->value.iec958.status[0] << 0) |
	      (ucontrol->value.iec958.status[1] << 8) |
	      (ucontrol->value.iec958.status[2] << 16) |
	      (ucontrol->value.iec958.status[3] << 24);
	change = val != emu->spdif_bits[idx];
	if (change) {
		snd_emu10k1_ptr_write(emu, SPCS0 + idx, 0, val);
		emu->spdif_bits[idx] = val;
	}
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_spdif_mask_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READ,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
	.count =	3,
	.info =         snd_emu10k1_spdif_info,
	.get =          snd_emu10k1_spdif_get_mask
};

static const struct snd_kcontrol_new snd_emu10k1_spdif_control =
{
	.iface =	SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
	.count =	3,
	.info =         snd_emu10k1_spdif_info,
	.get =          snd_emu10k1_spdif_get,
	.put =          snd_emu10k1_spdif_put
};


static void update_emu10k1_fxrt(struct snd_emu10k1 *emu, int voice, unsigned char *route)
{
	if (emu->audigy) {
		snd_emu10k1_ptr_write_multiple(emu, voice,
			A_FXRT1, snd_emu10k1_compose_audigy_fxrt1(route),
			A_FXRT2, snd_emu10k1_compose_audigy_fxrt2(route),
			REGLIST_END);
	} else {
		snd_emu10k1_ptr_write(emu, FXRT, voice,
				      snd_emu10k1_compose_send_routing(route));
	}
}

static void update_emu10k1_send_volume(struct snd_emu10k1 *emu, int voice, unsigned char *volume)
{
	snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, volume[0]);
	snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, volume[1]);
	snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, volume[2]);
	snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, volume[3]);
	if (emu->audigy) {
		snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice,
				      snd_emu10k1_compose_audigy_sendamounts(volume));
	}
}

/* PCM stream controls */

static int snd_emu10k1_send_routing_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = emu->audigy ? 3*8 : 3*4;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f;
	return 0;
}

static int snd_emu10k1_send_routing_get(struct snd_kcontrol *kcontrol,
                                        struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int voice, idx;
	int num_efx = emu->audigy ? 8 : 4;
	int mask = emu->audigy ? 0x3f : 0x0f;

	for (voice = 0; voice < 3; voice++)
		for (idx = 0; idx < num_efx; idx++)
			ucontrol->value.integer.value[(voice * num_efx) + idx] = 
				mix->send_routing[voice][idx] & mask;
	return 0;
}

static int snd_emu10k1_send_routing_put(struct snd_kcontrol *kcontrol,
                                        struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int change = 0, voice, idx, val;
	int num_efx = emu->audigy ? 8 : 4;
	int mask = emu->audigy ? 0x3f : 0x0f;

	spin_lock_irqsave(&emu->reg_lock, flags);
	for (voice = 0; voice < 3; voice++)
		for (idx = 0; idx < num_efx; idx++) {
			val = ucontrol->value.integer.value[(voice * num_efx) + idx] & mask;
			if (mix->send_routing[voice][idx] != val) {
				mix->send_routing[voice][idx] = val;
				change = 1;
			}
		}	
	if (change && mix->epcm && mix->epcm->voices[0]) {
		if (!mix->epcm->voices[0]->last) {
			update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number,
					    &mix->send_routing[1][0]);
			update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number + 1,
					    &mix->send_routing[2][0]);
		} else {
			update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number,
					    &mix->send_routing[0][0]);
		}
	}
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_send_routing_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         "EMU10K1 PCM Send Routing",
	.count =	32,
	.info =         snd_emu10k1_send_routing_info,
	.get =          snd_emu10k1_send_routing_get,
	.put =          snd_emu10k1_send_routing_put
};

static int snd_emu10k1_send_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = emu->audigy ? 3*8 : 3*4;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 255;
	return 0;
}

static int snd_emu10k1_send_volume_get(struct snd_kcontrol *kcontrol,
                                       struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int idx;
	int num_efx = emu->audigy ? 8 : 4;

	for (idx = 0; idx < 3*num_efx; idx++)
		ucontrol->value.integer.value[idx] = mix->send_volume[idx/num_efx][idx%num_efx];
	return 0;
}

static int snd_emu10k1_send_volume_put(struct snd_kcontrol *kcontrol,
                                       struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int change = 0, idx, val;
	int num_efx = emu->audigy ? 8 : 4;

	spin_lock_irqsave(&emu->reg_lock, flags);
	for (idx = 0; idx < 3*num_efx; idx++) {
		val = ucontrol->value.integer.value[idx] & 255;
		if (mix->send_volume[idx/num_efx][idx%num_efx] != val) {
			mix->send_volume[idx/num_efx][idx%num_efx] = val;
			change = 1;
		}
	}
	if (change && mix->epcm && mix->epcm->voices[0]) {
		if (!mix->epcm->voices[0]->last) {
			update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number,
						   &mix->send_volume[1][0]);
			update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number + 1,
						   &mix->send_volume[2][0]);
		} else {
			update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number,
						   &mix->send_volume[0][0]);
		}
	}
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_send_volume_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         "EMU10K1 PCM Send Volume",
	.count =	32,
	.info =         snd_emu10k1_send_volume_info,
	.get =          snd_emu10k1_send_volume_get,
	.put =          snd_emu10k1_send_volume_put
};

static int snd_emu10k1_attn_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 3;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 0x1fffd;
	return 0;
}

static int snd_emu10k1_attn_get(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int idx;

	for (idx = 0; idx < 3; idx++)
		ucontrol->value.integer.value[idx] = mix->attn[idx] * 0xffffU / 0x8000U;
	return 0;
}

static int snd_emu10k1_attn_put(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int change = 0, idx, val;

	spin_lock_irqsave(&emu->reg_lock, flags);
	for (idx = 0; idx < 3; idx++) {
		unsigned uval = ucontrol->value.integer.value[idx] & 0x1ffff;
		val = uval * 0x8000U / 0xffffU;
		if (mix->attn[idx] != val) {
			mix->attn[idx] = val;
			change = 1;
		}
	}
	if (change && mix->epcm && mix->epcm->voices[0]) {
		if (!mix->epcm->voices[0]->last) {
			snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[1]);
			snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number + 1, mix->attn[2]);
		} else {
			snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[0]);
		}
	}
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_attn_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         "EMU10K1 PCM Volume",
	.count =	32,
	.info =         snd_emu10k1_attn_info,
	.get =          snd_emu10k1_attn_get,
	.put =          snd_emu10k1_attn_put
};

/* Mutichannel PCM stream controls */

static int snd_emu10k1_efx_send_routing_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = emu->audigy ? 8 : 4;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f;
	return 0;
}

static int snd_emu10k1_efx_send_routing_get(struct snd_kcontrol *kcontrol,
                                        struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int idx;
	int num_efx = emu->audigy ? 8 : 4;
	int mask = emu->audigy ? 0x3f : 0x0f;

	for (idx = 0; idx < num_efx; idx++)
		ucontrol->value.integer.value[idx] = 
			mix->send_routing[0][idx] & mask;
	return 0;
}

static int snd_emu10k1_efx_send_routing_put(struct snd_kcontrol *kcontrol,
                                        struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
	struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch];
	int change = 0, idx, val;
	int num_efx = emu->audigy ? 8 : 4;
	int mask = emu->audigy ? 0x3f : 0x0f;

	spin_lock_irqsave(&emu->reg_lock, flags);
	for (idx = 0; idx < num_efx; idx++) {
		val = ucontrol->value.integer.value[idx] & mask;
		if (mix->send_routing[0][idx] != val) {
			mix->send_routing[0][idx] = val;
			change = 1;
		}
	}	

	if (change && mix->epcm) {
		if (mix->epcm->voices[ch]) {
			update_emu10k1_fxrt(emu, mix->epcm->voices[ch]->number,
					&mix->send_routing[0][0]);
		}
	}
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_efx_send_routing_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         "Multichannel PCM Send Routing",
	.count =	16,
	.info =         snd_emu10k1_efx_send_routing_info,
	.get =          snd_emu10k1_efx_send_routing_get,
	.put =          snd_emu10k1_efx_send_routing_put
};

static int snd_emu10k1_efx_send_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = emu->audigy ? 8 : 4;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 255;
	return 0;
}

static int snd_emu10k1_efx_send_volume_get(struct snd_kcontrol *kcontrol,
                                       struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
	int idx;
	int num_efx = emu->audigy ? 8 : 4;

	for (idx = 0; idx < num_efx; idx++)
		ucontrol->value.integer.value[idx] = mix->send_volume[0][idx];
	return 0;
}

static int snd_emu10k1_efx_send_volume_put(struct snd_kcontrol *kcontrol,
                                       struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
	struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch];
	int change = 0, idx, val;
	int num_efx = emu->audigy ? 8 : 4;

	spin_lock_irqsave(&emu->reg_lock, flags);
	for (idx = 0; idx < num_efx; idx++) {
		val = ucontrol->value.integer.value[idx] & 255;
		if (mix->send_volume[0][idx] != val) {
			mix->send_volume[0][idx] = val;
			change = 1;
		}
	}
	if (change && mix->epcm) {
		if (mix->epcm->voices[ch]) {
			update_emu10k1_send_volume(emu, mix->epcm->voices[ch]->number,
						   &mix->send_volume[0][0]);
		}
	}
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}


static const struct snd_kcontrol_new snd_emu10k1_efx_send_volume_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         "Multichannel PCM Send Volume",
	.count =	16,
	.info =         snd_emu10k1_efx_send_volume_info,
	.get =          snd_emu10k1_efx_send_volume_get,
	.put =          snd_emu10k1_efx_send_volume_put
};

static int snd_emu10k1_efx_attn_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
	uinfo->count = 1;
	uinfo->value.integer.min = 0;
	uinfo->value.integer.max = 0x1fffd;
	return 0;
}

static int snd_emu10k1_efx_attn_get(struct snd_kcontrol *kcontrol,
                                struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	struct snd_emu10k1_pcm_mixer *mix =
		&emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];

	ucontrol->value.integer.value[0] = mix->attn[0] * 0xffffU / 0x8000U;
	return 0;
}

static int snd_emu10k1_efx_attn_put(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
	struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch];
	int change = 0, val;
	unsigned uval;

	spin_lock_irqsave(&emu->reg_lock, flags);
	uval = ucontrol->value.integer.value[0] & 0x1ffff;
	val = uval * 0x8000U / 0xffffU;
	if (mix->attn[0] != val) {
		mix->attn[0] = val;
		change = 1;
	}
	if (change && mix->epcm) {
		if (mix->epcm->voices[ch]) {
			snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[ch]->number, mix->attn[0]);
		}
	}
	spin_unlock_irqrestore(&emu->reg_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_efx_attn_control =
{
	.access =	SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
	.iface =        SNDRV_CTL_ELEM_IFACE_PCM,
	.name =         "Multichannel PCM Volume",
	.count =	16,
	.info =         snd_emu10k1_efx_attn_info,
	.get =          snd_emu10k1_efx_attn_get,
	.put =          snd_emu10k1_efx_attn_put
};

#define snd_emu10k1_shared_spdif_info	snd_ctl_boolean_mono_info

static int snd_emu10k1_shared_spdif_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);

	if (emu->audigy)
		ucontrol->value.integer.value[0] = inw(emu->port + A_IOCFG) & A_IOCFG_GPOUT0 ? 1 : 0;
	else
		ucontrol->value.integer.value[0] = inl(emu->port + HCFG) & HCFG_GPOUT0 ? 1 : 0;
	if (emu->card_capabilities->invert_shared_spdif)
		ucontrol->value.integer.value[0] =
			!ucontrol->value.integer.value[0];
		
	return 0;
}

static int snd_emu10k1_shared_spdif_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	unsigned long flags;
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int reg, val, sw;
	int change = 0;

	sw = ucontrol->value.integer.value[0];
	if (emu->card_capabilities->invert_shared_spdif)
		sw = !sw;
	spin_lock_irqsave(&emu->emu_lock, flags);
	if ( emu->card_capabilities->i2c_adc) {
		/* Do nothing for Audigy 2 ZS Notebook */
	} else if (emu->audigy) {
		reg = inw(emu->port + A_IOCFG);
		val = sw ? A_IOCFG_GPOUT0 : 0;
		change = (reg & A_IOCFG_GPOUT0) != val;
		if (change) {
			reg &= ~A_IOCFG_GPOUT0;
			reg |= val;
			outw(reg | val, emu->port + A_IOCFG);
		}
	}
	reg = inl(emu->port + HCFG);
	val = sw ? HCFG_GPOUT0 : 0;
	change |= (reg & HCFG_GPOUT0) != val;
	if (change) {
		reg &= ~HCFG_GPOUT0;
		reg |= val;
		outl(reg | val, emu->port + HCFG);
	}
	spin_unlock_irqrestore(&emu->emu_lock, flags);
	return change;
}

static const struct snd_kcontrol_new snd_emu10k1_shared_spdif =
{
	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
	.name =		"SB Live Analog/Digital Output Jack",
	.info =		snd_emu10k1_shared_spdif_info,
	.get =		snd_emu10k1_shared_spdif_get,
	.put =		snd_emu10k1_shared_spdif_put
};

static const struct snd_kcontrol_new snd_audigy_shared_spdif =
{
	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
	.name =		"Audigy Analog/Digital Output Jack",
	.info =		snd_emu10k1_shared_spdif_info,
	.get =		snd_emu10k1_shared_spdif_get,
	.put =		snd_emu10k1_shared_spdif_put
};

/* workaround for too low volume on Audigy due to 16bit/24bit conversion */

#define snd_audigy_capture_boost_info	snd_ctl_boolean_mono_info

static int snd_audigy_capture_boost_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int val;

	/* FIXME: better to use a cached version */
	val = snd_ac97_read(emu->ac97, AC97_REC_GAIN);
	ucontrol->value.integer.value[0] = !!val;
	return 0;
}

static int snd_audigy_capture_boost_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{
	struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
	unsigned int val;

	if (ucontrol->value.integer.value[0])
		val = 0x0f0f;
	else
		val = 0;
	return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val);
}

static const struct snd_kcontrol_new snd_audigy_capture_boost =
{
	.iface =	SNDRV_CTL_ELEM_IFACE_MIXER,
	.name =		"Mic Extra Boost",
	.info =		snd_audigy_capture_boost_info,
	.get =		snd_audigy_capture_boost_get,
	.put =		snd_audigy_capture_boost_put
};


/*
 */
static void snd_emu10k1_mixer_free_ac97(struct snd_ac97 *ac97)
{
	struct snd_emu10k1 *emu = ac97->private_data;
	emu->ac97 = NULL;
}

/*
 */
static int remove_ctl(struct snd_card *card, const char *name)
{
	struct snd_ctl_elem_id id;
	memset(&id, 0, sizeof(id));
	strcpy(id.name, name);
	id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
	return snd_ctl_remove_id(card, &id);
}

static struct snd_kcontrol *ctl_find(struct snd_card *card, const char *name)
{
	struct snd_ctl_elem_id sid;
	memset(&sid, 0, sizeof(sid));
	strcpy(sid.name, name);
	sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
	return snd_ctl_find_id(card, &sid);
}

static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
{
	struct snd_kcontrol *kctl = ctl_find(card, src);
	if (kctl) {
		snd_ctl_rename(card, kctl, dst);
		return 0;
	}
	return -ENOENT;
}

int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
		      int pcm_device, int multi_device)
{
	int err;
	struct snd_kcontrol *kctl;
	struct snd_card *card = emu->card;
	const char * const *c;
	static const char * const emu10k1_remove_ctls[] = {
		/* no AC97 mono, surround, center/lfe */
		"Master Mono Playback Switch",
		"Master Mono Playback Volume",
		"PCM Out Path & Mute",
		"Mono Output Select",
		"Surround Playback Switch",
		"Surround Playback Volume",
		"Center Playback Switch",
		"Center Playback Volume",
		"LFE Playback Switch",
		"LFE Playback Volume",
		NULL
	};
	static const char * const emu10k1_rename_ctls[] = {
		"Surround Digital Playback Volume", "Surround Playback Volume",
		"Center Digital Playback Volume", "Center Playback Volume",
		"LFE Digital Playback Volume", "LFE Playback Volume",
		NULL
	};
	static const char * const audigy_remove_ctls[] = {
		/* Master/PCM controls on ac97 of Audigy has no effect */
		/* On the Audigy2 the AC97 playback is piped into
		 * the Philips ADC for 24bit capture */
		"PCM Playback Switch",
		"PCM Playback Volume",
		"Master Playback Switch",
		"Master Playback Volume",
		"PCM Out Path & Mute",
		"Mono Output Select",
		/* remove unused AC97 capture controls */
		"Capture Source",
		"Capture Switch",
		"Capture Volume",
		"Mic Select",
		"Headphone Playback Switch",
		"Headphone Playback Volume",
		"3D Control - Center",
		"3D Control - Depth",
		"3D Control - Switch",
		"Video Playback Switch",
		"Video Playback Volume",
		"Mic Playback Switch",
		"Mic Playback Volume",
		"External Amplifier",
		NULL
	};
	static const char * const audigy_rename_ctls[] = {
		/* use conventional names */
		"Wave Playback Volume", "PCM Playback Volume",
		/* "Wave Capture Volume", "PCM Capture Volume", */
		"Wave Master Playback Volume", "Master Playback Volume",
		"AMic Playback Volume", "Mic Playback Volume",
		"Master Mono Playback Switch", "Phone Output Playback Switch",
		"Master Mono Playback Volume", "Phone Output Playback Volume",
		NULL
	};
	static const char * const audigy_rename_ctls_i2c_adc[] = {
		//"Analog Mix Capture Volume","OLD Analog Mix Capture Volume",
		"Line Capture Volume", "Analog Mix Capture Volume",
		"Wave Playback Volume", "OLD PCM Playback Volume",
		"Wave Master Playback Volume", "Master Playback Volume",
		"AMic Playback Volume", "Old Mic Playback Volume",
		"CD Capture Volume", "IEC958 Optical Capture Volume",
		NULL
	};
	static const char * const audigy_remove_ctls_i2c_adc[] = {
		/* On the Audigy2 ZS Notebook
		 * Capture via WM8775  */
		"Mic Capture Volume",
		"Analog Mix Capture Volume",
		"Aux Capture Volume",
		"IEC958 Optical Capture Volume",
		NULL
	};
	static const char * const audigy_remove_ctls_1361t_adc[] = {
		/* On the Audigy2 the AC97 playback is piped into
		 * the Philips ADC for 24bit capture */
		"PCM Playback Switch",
		"PCM Playback Volume",
		"Capture Source",
		"Capture Switch",
		"Capture Volume",
		"Mic Capture Volume",
		"Headphone Playback Switch",
		"Headphone Playback Volume",
		"3D Control - Center",
		"3D Control - Depth",
		"3D Control - Switch",
		"Line2 Playback Volume",
		"Line2 Capture Volume",
		NULL
	};
	static const char * const audigy_rename_ctls_1361t_adc[] = {
		"Master Playback Switch", "Master Capture Switch",
		"Master Playback Volume", "Master Capture Volume",
		"Wave Master Playback Volume", "Master Playback Volume",
		"Beep Playback Switch", "Beep Capture Switch",
		"Beep Playback Volume", "Beep Capture Volume",
		"Phone Playback Switch", "Phone Capture Switch",
		"Phone Playback Volume", "Phone Capture Volume",
		"Mic Playback Switch", "Mic Capture Switch",
		"Mic Playback Volume", "Mic Capture Volume",
		"Line Playback Switch", "Line Capture Switch",
		"Line Playback Volume", "Line Capture Volume",
		"CD Playback Switch", "CD Capture Switch",
		"CD Playback Volume", "CD Capture Volume",
		"Aux Playback Switch", "Aux Capture Switch",
		"Aux Playback Volume", "Aux Capture Volume",
		"Video Playback Switch", "Video Capture Switch",
		"Video Playback Volume", "Video Capture Volume",
		"Master Mono Playback Switch", "Phone Output Playback Switch",
		"Master Mono Playback Volume", "Phone Output Playback Volume",
		NULL
	};

	if (emu->card_capabilities->ac97_chip) {
		struct snd_ac97_bus *pbus;
		struct snd_ac97_template ac97;
		static const struct snd_ac97_bus_ops ops = {
			.write = snd_emu10k1_ac97_write,
			.read = snd_emu10k1_ac97_read,
		};

		err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus);
		if (err < 0)
			return err;
		pbus->no_vra = 1; /* we don't need VRA */
		
		memset(&ac97, 0, sizeof(ac97));
		ac97.private_data = emu;
		ac97.private_free = snd_emu10k1_mixer_free_ac97;
		ac97.scaps = AC97_SCAP_NO_SPDIF;
		err = snd_ac97_mixer(pbus, &ac97, &emu->ac97);
		if (err < 0) {
			if (emu->card_capabilities->ac97_chip == 1)
				return err;
			dev_info(emu->card->dev,
				 "AC97 is optional on this board\n");
			dev_info(emu->card->dev,
				 "Proceeding without ac97 mixers...\n");
			snd_device_free(emu->card, pbus);
			goto no_ac97; /* FIXME: get rid of ugly gotos.. */
		}
		if (emu->audigy) {
			/* set master volume to 0 dB */
			snd_ac97_write_cache(emu->ac97, AC97_MASTER, 0x0000);
			/* set capture source to mic */
			snd_ac97_write_cache(emu->ac97, AC97_REC_SEL, 0x0000);
			/* set mono output (TAD) to mic */
			snd_ac97_update_bits(emu->ac97, AC97_GENERAL_PURPOSE,
				0x0200, 0x0200);
			if (emu->card_capabilities->adc_1361t)
				c = audigy_remove_ctls_1361t_adc;
			else 
				c = audigy_remove_ctls;
		} else {
			/*
			 * Credits for cards based on STAC9758:
			 *   James Courtier-Dutton <James@superbug.demon.co.uk>
			 *   Voluspa <voluspa@comhem.se>
			 */
			if (emu->ac97->id == AC97_ID_STAC9758) {
				emu->rear_ac97 = 1;
				snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT);
				snd_ac97_write_cache(emu->ac97, AC97_HEADPHONE, 0x0202);
				remove_ctl(card,"Front Playback Volume");
				remove_ctl(card,"Front Playback Switch");
			}
			/* remove unused AC97 controls */
			snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202);
			snd_ac97_write_cache(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202);
			c = emu10k1_remove_ctls;
		}
		for (; *c; c++)
			remove_ctl(card, *c);
	} else if (emu->card_capabilities->i2c_adc) {
		c = audigy_remove_ctls_i2c_adc;
		for (; *c; c++)
			remove_ctl(card, *c);
	} else {
	no_ac97:
		if (emu->card_capabilities->ecard)
			strcpy(emu->card->mixername, "EMU APS");
		else if (emu->audigy)
			strcpy(emu->card->mixername, "SB Audigy");
		else
			strcpy(emu->card->mixername, "Emu10k1");
	}

	if (emu->audigy)
		if (emu->card_capabilities->adc_1361t)
			c = audigy_rename_ctls_1361t_adc;
		else if (emu->card_capabilities->i2c_adc)
			c = audigy_rename_ctls_i2c_adc;
		else
			c = audigy_rename_ctls;
	else
		c = emu10k1_rename_ctls;
	for (; *c; c += 2)
		rename_ctl(card, c[0], c[1]);

	if (emu->card_capabilities->subsystem == 0x80401102) { /* SB Live! Platinum CT4760P */
		remove_ctl(card, "Center Playback Volume");
		remove_ctl(card, "LFE Playback Volume");
		remove_ctl(card, "Wave Center Playback Volume");
		remove_ctl(card, "Wave LFE Playback Volume");
	}
	if (emu->card_capabilities->subsystem == 0x20071102) {  /* Audigy 4 Pro */
		rename_ctl(card, "Line2 Capture Volume", "Line1/Mic Capture Volume");
		rename_ctl(card, "Analog Mix Capture Volume", "Line2 Capture Volume");
		rename_ctl(card, "Aux2 Capture Volume", "Line3 Capture Volume");
		rename_ctl(card, "Mic Capture Volume", "Unknown1 Capture Volume");
	}
	kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu);
	if (!kctl)
		return -ENOMEM;
	kctl->id.device = pcm_device;
	err = snd_ctl_add(card, kctl);
	if (err)
		return err;
	kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu);
	if (!kctl)
		return -ENOMEM;
	kctl->id.device = pcm_device;
	err = snd_ctl_add(card, kctl);
	if (err)
		return err;
	kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu);
	if (!kctl)
		return -ENOMEM;
	kctl->id.device = pcm_device;
	err = snd_ctl_add(card, kctl);
	if (err)
		return err;

	kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu);
	if (!kctl)
		return -ENOMEM;
	kctl->id.device = multi_device;
	err = snd_ctl_add(card, kctl);
	if (err)
		return err;
	
	kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu);
	if (!kctl)
		return -ENOMEM;
	kctl->id.device = multi_device;
	err = snd_ctl_add(card, kctl);
	if (err)
		return err;
	
	kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu);
	if (!kctl)
		return -ENOMEM;
	kctl->id.device = multi_device;
	err = snd_ctl_add(card, kctl);
	if (err)
		return err;

	if (!emu->card_capabilities->ecard && !emu->card_capabilities->emu_model) {
		/* sb live! and audigy */
		kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu);
		if (!kctl)
			return -ENOMEM;
		if (!emu->audigy)
			kctl->id.device = emu->pcm_efx->device;
		err = snd_ctl_add(card, kctl);
		if (err)
			return err;
		kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu);
		if (!kctl)
			return -ENOMEM;
		if (!emu->audigy)
			kctl->id.device = emu->pcm_efx->device;
		err = snd_ctl_add(card, kctl);
		if (err)
			return err;
	}

	if (emu->card_capabilities->emu_model) {
		;  /* Disable the snd_audigy_spdif_shared_spdif */
	} else if (emu->audigy) {
		kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu);
		if (!kctl)
			return -ENOMEM;
		err = snd_ctl_add(card, kctl);
		if (err)
			return err;
#if 0
		kctl = snd_ctl_new1(&snd_audigy_spdif_output_rate, emu);
		if (!kctl)
			return -ENOMEM;
		err = snd_ctl_add(card, kctl);
		if (err)
			return err;
#endif
	} else if (! emu->card_capabilities->ecard) {
		/* sb live! */
		kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu);
		if (!kctl)
			return -ENOMEM;
		err = snd_ctl_add(card, kctl);
		if (err)
			return err;
	}
	if (emu->card_capabilities->ca0151_chip) { /* P16V */
		err = snd_p16v_mixer(emu);
		if (err)
			return err;
	}

	if (emu->card_capabilities->emu_model) {
		unsigned i, emu_idx = emu1010_idx(emu);
		const struct snd_emu1010_routing_info *emu_ri =
			&emu1010_routing_info[emu_idx];
		const struct snd_emu1010_pads_info *emu_pi = &emu1010_pads_info[emu_idx];

		for (i = 0; i < emu_ri->n_ins; i++)
			emu->emu1010.input_source[i] =
				emu1010_map_source(emu_ri, emu_ri->in_dflts[i]);
		for (i = 0; i < emu_ri->n_outs; i++)
			emu->emu1010.output_source[i] =
				emu1010_map_source(emu_ri, emu_ri->out_dflts[i]);
		snd_emu1010_apply_sources(emu);

		err = snd_ctl_add(card,
			snd_ctl_new1(&snd_emu1010_clock_source, emu));
		if (err < 0)
			return err;
		err = snd_ctl_add(card,
			snd_ctl_new1(&snd_emu1010_clock_fallback, emu));
		if (err < 0)
			return err;

		err = add_ctls(emu, &emu1010_adc_pads_ctl,
			       emu_pi->adc_ctls, emu_pi->n_adc_ctls);
		if (err < 0)
			return err;
		err = add_ctls(emu, &emu1010_dac_pads_ctl,
			       emu_pi->dac_ctls, emu_pi->n_dac_ctls);
		if (err < 0)
			return err;

		if (!emu->card_capabilities->no_adat) {
			err = snd_ctl_add(card,
				snd_ctl_new1(&snd_emu1010_optical_out, emu));
			if (err < 0)
				return err;
			err = snd_ctl_add(card,
				snd_ctl_new1(&snd_emu1010_optical_in, emu));
			if (err < 0)
				return err;
		}

		err = add_emu1010_source_mixers(emu);
		if (err < 0)
			return err;
	}

	if ( emu->card_capabilities->i2c_adc) {
		err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_i2c_capture_source, emu));
		if (err < 0)
			return err;

		err = add_ctls(emu, &i2c_volume_ctl,
			       snd_audigy_i2c_volume_ctls,
			       ARRAY_SIZE(snd_audigy_i2c_volume_ctls));
		if (err < 0)
			return err;
	}
		
	if (emu->card_capabilities->ac97_chip && emu->audigy) {
		err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_capture_boost,
						     emu));
		if (err < 0)
			return err;
	}

	return 0;
}
