/*
 *  Routines for SB-LIVE! EMU10k1 chip
 *
 */
#include "driver.h"
#include "info.h"
#include "sndpci.h"
#include "control.h"
#include "emu10k1.h"
#include "dma.h"


static void
snd_emu10k1_mixer_free (ac97_t * ac97)
{
	((emu10k1_t *) ac97->private_data)->mixer= NULL;
	snd_free (ac97, sizeof (ac97_t));
}

snd_kmixer_t *
snd_emu10k1_mixer (emu10k1_t * emu)
{
	ac97_t *ac97;
	snd_kmixer_t *mixer;

	ac97= snd_calloc (sizeof (ac97_t));
	if (!ac97)
		return NULL;
	ac97->write= snd_emu10k1_ac97_write;
	ac97->read= snd_emu10k1_ac97_read;
	ac97->private_data= emu;
	ac97->private_free= snd_emu10k1_mixer_free;
	mixer= snd_ac97_mixer (emu->card, ac97);
	if (!mixer)
	{
		snd_free (ac97, sizeof (ac97));
		return NULL;
	}
	return emu->mixer= mixer;
}

