bebob_yamaha.c 2.0 KB

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