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