bebob_terratec.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * bebob_terratec.c - a part of driver for BeBoB based devices
  3. *
  4. * Copyright (c) 2013-2014 Takashi Sakamoto
  5. *
  6. * Licensed under the terms of the GNU General Public License, version 2.
  7. */
  8. #include "./bebob.h"
  9. static const enum snd_bebob_clock_type phase88_rack_clk_src_types[] = {
  10. SND_BEBOB_CLOCK_TYPE_INTERNAL,
  11. SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
  12. SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */
  13. };
  14. static int
  15. phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
  16. {
  17. unsigned int enable_ext, enable_word;
  18. int err;
  19. err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext);
  20. if (err < 0)
  21. goto end;
  22. err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word);
  23. if (err < 0)
  24. goto end;
  25. if (enable_ext == 0)
  26. *id = 0;
  27. else if (enable_word == 0)
  28. *id = 1;
  29. else
  30. *id = 2;
  31. end:
  32. return err;
  33. }
  34. static const struct snd_bebob_rate_spec phase_series_rate_spec = {
  35. .get = &snd_bebob_stream_get_rate,
  36. .set = &snd_bebob_stream_set_rate,
  37. };
  38. /* PHASE 88 Rack FW */
  39. static const struct snd_bebob_clock_spec phase88_rack_clk = {
  40. .num = ARRAY_SIZE(phase88_rack_clk_src_types),
  41. .types = phase88_rack_clk_src_types,
  42. .get = &phase88_rack_clk_src_get,
  43. };
  44. const struct snd_bebob_spec phase88_rack_spec = {
  45. .clock = &phase88_rack_clk,
  46. .rate = &phase_series_rate_spec,
  47. .meter = NULL
  48. };