bebob_yamaha_terratec.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * bebob_yamaha.c - a part of driver for BeBoB based devices
  4. *
  5. * Copyright (c) 2013-2014 Takashi Sakamoto
  6. */
  7. #include "./bebob.h"
  8. /*
  9. * NOTE:
  10. * Yamaha GO44 is not designed to be used as stand-alone mixer. So any streams
  11. * must be accompanied. If changing the state, a LED on the device starts to
  12. * blink and its sync status is false. In this state, the device sounds nothing
  13. * even if streaming. To start streaming at the current sampling rate is only
  14. * way to recover this state. GO46 is better for stand-alone mixer.
  15. *
  16. * Both of them have a capability to change its sampling rate up to 192.0kHz.
  17. * At 192.0kHz, the device reports 4 PCM-in, 1 MIDI-in, 6 PCM-out, 1 MIDI-out.
  18. * But Yamaha's driver reduce 2 PCM-in, 1 MIDI-in, 2 PCM-out, 1 MIDI-out to use
  19. * 'Extended Stream Format Information Command - Single Request' in 'Additional
  20. * AVC commands' defined by BridgeCo.
  21. * This ALSA driver don't do this because a bit tiresome. Then isochronous
  22. * streaming with many asynchronous transactions brings sounds with noises.
  23. * Unfortunately current 'ffado-mixer' generated many asynchronous transaction
  24. * to observe device's state, mainly check cmp connection and signal format. I
  25. * recommend users to close ffado-mixer at 192.0kHz if mixer is needless.
  26. *
  27. * Terratec PHASE 24 FW and PHASE X24 FW are internally the same as
  28. * Yamaha GO 44 and GO 46. Yamaha and Terratec had cooperated for these models.
  29. */
  30. static const enum snd_bebob_clock_type clk_src_types[] = {
  31. SND_BEBOB_CLOCK_TYPE_INTERNAL,
  32. SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
  33. };
  34. static int
  35. clk_src_get(struct snd_bebob *bebob, unsigned int *id)
  36. {
  37. int err;
  38. err = avc_audio_get_selector(bebob->unit, 0, 4, id);
  39. if (err < 0)
  40. return err;
  41. if (*id >= ARRAY_SIZE(clk_src_types))
  42. return -EIO;
  43. return 0;
  44. }
  45. static const struct snd_bebob_clock_spec clock_spec = {
  46. .num = ARRAY_SIZE(clk_src_types),
  47. .types = clk_src_types,
  48. .get = &clk_src_get,
  49. };
  50. static const struct snd_bebob_rate_spec rate_spec = {
  51. .get = &snd_bebob_stream_get_rate,
  52. .set = &snd_bebob_stream_set_rate,
  53. };
  54. const struct snd_bebob_spec yamaha_terratec_spec = {
  55. .clock = &clock_spec,
  56. .rate = &rate_spec,
  57. .meter = NULL
  58. };