Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Vortex Mixer support. |
| 3 | * |
| 4 | * There is much more than just the AC97 mixer... |
| 5 | * |
| 6 | */ |
| 7 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/time.h> |
| 9 | #include <linux/init.h> |
| 10 | #include <sound/core.h> |
| 11 | #include "au88x0.h" |
| 12 | |
Raymond Yau | 223f18e | 2012-06-04 14:59:55 +0800 | [diff] [blame] | 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 | |
Bill Pemberton | e23e7a1 | 2012-12-06 12:35:10 -0500 | [diff] [blame] | 22 | static int snd_vortex_mixer(vortex_t *vortex) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { |
Takashi Iwai | 2fd1687 | 2005-11-17 14:55:19 +0100 | [diff] [blame] | 24 | struct snd_ac97_bus *pbus; |
| 25 | struct snd_ac97_template ac97; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | int err; |
Takashi Iwai | 2fd1687 | 2005-11-17 14:55:19 +0100 | [diff] [blame] | 27 | static struct snd_ac97_bus_ops ops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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)); |
Andrea Gelmini | fa2eb00 | 2010-10-16 15:19:20 +0200 | [diff] [blame] | 35 | // Initialize AC97 codec stuff. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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)); |
Raymond Yau | 223f18e | 2012-06-04 14:59:55 +0800 | [diff] [blame] | 40 | remove_ctl(vortex->card, "Master Mono Playback Volume"); |
| 41 | remove_ctl(vortex->card, "Master Mono Playback Switch"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | return err; |
| 43 | } |