blob: a58298cfe7e04f03ce681b4d73540ef688929b9d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Vortex Mixer support.
3 *
4 * There is much more than just the AC97 mixer...
5 *
6 */
7
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#include <linux/time.h>
9#include <linux/init.h>
10#include <sound/core.h>
11#include "au88x0.h"
12
Raymond Yau223f18e2012-06-04 14:59:55 +080013static 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
Bill Pembertone23e7a12012-12-06 12:35:10 -050022static int snd_vortex_mixer(vortex_t *vortex)
Linus Torvalds1da177e2005-04-16 15:20:36 -070023{
Takashi Iwai2fd16872005-11-17 14:55:19 +010024 struct snd_ac97_bus *pbus;
25 struct snd_ac97_template ac97;
Linus Torvalds1da177e2005-04-16 15:20:36 -070026 int err;
Takashi Iwai2fd16872005-11-17 14:55:19 +010027 static struct snd_ac97_bus_ops ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070028 .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));
Andrea Gelminifa2eb002010-10-16 15:19:20 +020035 // Initialize AC97 codec stuff.
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 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));
Raymond Yau223f18e2012-06-04 14:59:55 +080040 remove_ctl(vortex->card, "Master Mono Playback Volume");
41 remove_ctl(vortex->card, "Master Mono Playback Switch");
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 return err;
43}