au88x0_mixer.c 1.1 KB

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