• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Vortex Mixer support.
3  *
4  * There is much more than just the AC97 mixer...
5  *
6  */
7 
8 #include <linux/time.h>
9 #include <linux/init.h>
10 #include <sound/core.h>
11 #include "au88x0.h"
12 
remove_ctl(struct snd_card * card,const char * name)13 static int remove_ctl(struct snd_card *card, const char *name)
14 {
15 	struct snd_ctl_elem_id id;
16 	memset(&id, 0, sizeof(id));
17 	strcpy(id.name, name);
18 	id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
19 	return snd_ctl_remove_id(card, &id);
20 }
21 
snd_vortex_mixer(vortex_t * vortex)22 static int snd_vortex_mixer(vortex_t *vortex)
23 {
24 	struct snd_ac97_bus *pbus;
25 	struct snd_ac97_template ac97;
26 	int err;
27 	static struct snd_ac97_bus_ops ops = {
28 		.write = vortex_codec_write,
29 		.read = vortex_codec_read,
30 	};
31 
32 	if ((err = snd_ac97_bus(vortex->card, 0, &ops, NULL, &pbus)) < 0)
33 		return err;
34 	memset(&ac97, 0, sizeof(ac97));
35 	// Initialize AC97 codec stuff.
36 	ac97.private_data = vortex;
37 	ac97.scaps = AC97_SCAP_NO_SPDIF;
38 	err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
39 	vortex->isquad = ((vortex->codec == NULL) ?  0 : (vortex->codec->ext_id&0x80));
40 	remove_ctl(vortex->card, "Master Mono Playback Volume");
41 	remove_ctl(vortex->card, "Master Mono Playback Switch");
42 	return err;
43 }
44