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