Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * bebob_yamaha.c - a part of driver for BeBoB based devices
0004  *
0005  * Copyright (c) 2013-2014 Takashi Sakamoto
0006  */
0007 
0008 #include "./bebob.h"
0009 
0010 /*
0011  * NOTE:
0012  * Yamaha GO44 is not designed to be used as stand-alone mixer. So any streams
0013  * must be accompanied. If changing the state, a LED on the device starts to
0014  * blink and its sync status is false. In this state, the device sounds nothing
0015  * even if streaming. To start streaming at the current sampling rate is only
0016  * way to recover this state. GO46 is better for stand-alone mixer.
0017  *
0018  * Both of them have a capability to change its sampling rate up to 192.0kHz.
0019  * At 192.0kHz, the device reports 4 PCM-in, 1 MIDI-in, 6 PCM-out, 1 MIDI-out.
0020  * But Yamaha's driver reduce 2 PCM-in, 1 MIDI-in, 2 PCM-out, 1 MIDI-out to use
0021  * 'Extended Stream Format Information Command - Single Request' in 'Additional
0022  * AVC commands' defined by BridgeCo.
0023  * This ALSA driver don't do this because a bit tiresome. Then isochronous
0024  * streaming with many asynchronous transactions brings sounds with noises.
0025  * Unfortunately current 'ffado-mixer' generated many asynchronous transaction
0026  * to observe device's state, mainly check cmp connection and signal format. I
0027  * recommend users to close ffado-mixer at 192.0kHz if mixer is needless.
0028  *
0029  * Terratec PHASE 24 FW and PHASE X24 FW are internally the same as
0030  * Yamaha GO 44 and GO 46. Yamaha and Terratec had cooperated for these models.
0031  */
0032 
0033 static const enum snd_bebob_clock_type clk_src_types[] = {
0034     SND_BEBOB_CLOCK_TYPE_INTERNAL,
0035     SND_BEBOB_CLOCK_TYPE_EXTERNAL,  /* S/PDIF */
0036 };
0037 static int
0038 clk_src_get(struct snd_bebob *bebob, unsigned int *id)
0039 {
0040     int err;
0041 
0042     err = avc_audio_get_selector(bebob->unit, 0, 4, id);
0043     if (err < 0)
0044         return err;
0045 
0046     if (*id >= ARRAY_SIZE(clk_src_types))
0047         return -EIO;
0048 
0049     return 0;
0050 }
0051 static const struct snd_bebob_clock_spec clock_spec = {
0052     .num    = ARRAY_SIZE(clk_src_types),
0053     .types  = clk_src_types,
0054     .get    = &clk_src_get,
0055 };
0056 static const struct snd_bebob_rate_spec rate_spec = {
0057     .get    = &snd_bebob_stream_get_rate,
0058     .set    = &snd_bebob_stream_set_rate,
0059 };
0060 const struct snd_bebob_spec yamaha_terratec_spec = {
0061     .clock  = &clock_spec,
0062     .rate   = &rate_spec,
0063     .meter  = NULL
0064 };