Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * bebob_terratec.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 static const enum snd_bebob_clock_type phase88_rack_clk_src_types[] = {
0011     SND_BEBOB_CLOCK_TYPE_INTERNAL,
0012     SND_BEBOB_CLOCK_TYPE_EXTERNAL,  /* S/PDIF */
0013     SND_BEBOB_CLOCK_TYPE_EXTERNAL,  /* Word Clock */
0014 };
0015 static int
0016 phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
0017 {
0018     unsigned int enable_ext, enable_word;
0019     int err;
0020 
0021     err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext);
0022     if (err < 0)
0023         goto end;
0024     err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word);
0025     if (err < 0)
0026         goto end;
0027 
0028     if (enable_ext == 0)
0029         *id = 0;
0030     else if (enable_word == 0)
0031         *id = 1;
0032     else
0033         *id = 2;
0034 end:
0035     return err;
0036 }
0037 
0038 static const struct snd_bebob_rate_spec phase_series_rate_spec = {
0039     .get    = &snd_bebob_stream_get_rate,
0040     .set    = &snd_bebob_stream_set_rate,
0041 };
0042 
0043 /* PHASE 88 Rack FW */
0044 static const struct snd_bebob_clock_spec phase88_rack_clk = {
0045     .num    = ARRAY_SIZE(phase88_rack_clk_src_types),
0046     .types  = phase88_rack_clk_src_types,
0047     .get    = &phase88_rack_clk_src_get,
0048 };
0049 const struct snd_bebob_spec phase88_rack_spec = {
0050     .clock  = &phase88_rack_clk,
0051     .rate   = &phase_series_rate_spec,
0052     .meter  = NULL
0053 };