blob: a6be3e7138e0586cfac6c6ee2b9e67906894f4aa [file] [log] [blame]
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +09001/*
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
9#include "./bebob.h"
10
11/*
12 * NOTE:
13 * Yamaha GO44 is not designed to be used as stand-alone mixer. So any streams
14 * must be accompanied. If changing the state, a LED on the device starts to
15 * blink and its sync status is false. In this state, the device sounds nothing
16 * even if streaming. To start streaming at the current sampling rate is only
Takashi Sakamotodf6a8862016-08-24 21:42:42 +090017 * way to recover this state. GO46 is better for stand-alone mixer.
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090018 *
19 * Both of them have a capability to change its sampling rate up to 192.0kHz.
20 * At 192.0kHz, the device reports 4 PCM-in, 1 MIDI-in, 6 PCM-out, 1 MIDI-out.
21 * But Yamaha's driver reduce 2 PCM-in, 1 MIDI-in, 2 PCM-out, 1 MIDI-out to use
22 * 'Extended Stream Format Information Command - Single Request' in 'Additional
23 * AVC commands' defined by BridgeCo.
24 * This ALSA driver don't do this because a bit tiresome. Then isochronous
25 * streaming with many asynchronous transactions brings sounds with noises.
26 * Unfortunately current 'ffado-mixer' generated many asynchronous transaction
27 * to observe device's state, mainly check cmp connection and signal format. I
Takashi Sakamotodf6a8862016-08-24 21:42:42 +090028 * recommend users to close ffado-mixer at 192.0kHz if mixer is needless.
Takashi Sakamotoe15c2822016-08-24 21:42:43 +090029 *
30 * Terratec PHASE 24 FW and PHASE X24 FW are internally the same as
31 * Yamaha GO 44 and GO 46. Yamaha and Terratec had cooperated for these models.
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090032 */
33
Takashi Sakamotoba517712015-06-14 12:49:29 +090034static enum snd_bebob_clock_type clk_src_types[] = {
35 SND_BEBOB_CLOCK_TYPE_INTERNAL,
36 SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
37};
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090038static int
39clk_src_get(struct snd_bebob *bebob, unsigned int *id)
40{
Takashi Sakamotoba517712015-06-14 12:49:29 +090041 int err;
42
43 err = avc_audio_get_selector(bebob->unit, 0, 4, id);
44 if (err < 0)
45 return err;
46
47 if (*id >= ARRAY_SIZE(clk_src_types))
48 return -EIO;
49
50 return 0;
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090051}
Julia Lawall6b9866c2015-10-11 08:10:55 +020052static const struct snd_bebob_clock_spec clock_spec = {
Takashi Sakamotoba517712015-06-14 12:49:29 +090053 .num = ARRAY_SIZE(clk_src_types),
54 .types = clk_src_types,
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090055 .get = &clk_src_get,
56};
Julia Lawall6b9866c2015-10-11 08:10:55 +020057static const struct snd_bebob_rate_spec rate_spec = {
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090058 .get = &snd_bebob_stream_get_rate,
59 .set = &snd_bebob_stream_set_rate,
60};
Takashi Sakamotoe15c2822016-08-24 21:42:43 +090061const struct snd_bebob_spec yamaha_terratec_spec = {
Takashi Sakamoto8ac98a32014-04-25 22:45:23 +090062 .clock = &clock_spec,
63 .rate = &rate_spec,
64 .meter = NULL
65};