bebob_terratec.c 1.3 KB

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