1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds * Vortex Mixer support.
41da177e4SLinus Torvalds *
51da177e4SLinus Torvalds * There is much more than just the AC97 mixer...
61da177e4SLinus Torvalds *
71da177e4SLinus Torvalds */
81da177e4SLinus Torvalds
91da177e4SLinus Torvalds #include <linux/time.h>
101da177e4SLinus Torvalds #include <linux/init.h>
111da177e4SLinus Torvalds #include <sound/core.h>
121da177e4SLinus Torvalds #include "au88x0.h"
131da177e4SLinus Torvalds
remove_ctl(struct snd_card * card,const char * name)14223f18e4SRaymond Yau static int remove_ctl(struct snd_card *card, const char *name)
15223f18e4SRaymond Yau {
16223f18e4SRaymond Yau struct snd_ctl_elem_id id;
17223f18e4SRaymond Yau memset(&id, 0, sizeof(id));
18223f18e4SRaymond Yau strcpy(id.name, name);
19223f18e4SRaymond Yau id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
20223f18e4SRaymond Yau return snd_ctl_remove_id(card, &id);
21223f18e4SRaymond Yau }
22223f18e4SRaymond Yau
snd_vortex_mixer(vortex_t * vortex)23e23e7a14SBill Pemberton static int snd_vortex_mixer(vortex_t *vortex)
241da177e4SLinus Torvalds {
252fd16874STakashi Iwai struct snd_ac97_bus *pbus;
262fd16874STakashi Iwai struct snd_ac97_template ac97;
271da177e4SLinus Torvalds int err;
2851055da5STakashi Iwai static const struct snd_ac97_bus_ops ops = {
291da177e4SLinus Torvalds .write = vortex_codec_write,
301da177e4SLinus Torvalds .read = vortex_codec_read,
311da177e4SLinus Torvalds };
321da177e4SLinus Torvalds
33*c2b0718fSTakashi Iwai err = snd_ac97_bus(vortex->card, 0, &ops, NULL, &pbus);
34*c2b0718fSTakashi Iwai if (err < 0)
351da177e4SLinus Torvalds return err;
361da177e4SLinus Torvalds memset(&ac97, 0, sizeof(ac97));
37fa2eb005SAndrea Gelmini // Initialize AC97 codec stuff.
381da177e4SLinus Torvalds ac97.private_data = vortex;
391da177e4SLinus Torvalds ac97.scaps = AC97_SCAP_NO_SPDIF;
401da177e4SLinus Torvalds err = snd_ac97_mixer(pbus, &ac97, &vortex->codec);
411da177e4SLinus Torvalds vortex->isquad = ((vortex->codec == NULL) ? 0 : (vortex->codec->ext_id&0x80));
42223f18e4SRaymond Yau remove_ctl(vortex->card, "Master Mono Playback Volume");
43223f18e4SRaymond Yau remove_ctl(vortex->card, "Master Mono Playback Switch");
441da177e4SLinus Torvalds return err;
451da177e4SLinus Torvalds }
46