au88x0_mixer.c 1.1 KB

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