blob: 2fdaf93e7a8d3d69d8fa28e91a611c8776b52e76 [file] [log] [blame]
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +09001/*
2 * bebob_terratec.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
Takashi Sakamotoba517712015-06-14 12:49:29 +090011static enum snd_bebob_clock_type phase88_rack_clk_src_types[] = {
12 SND_BEBOB_CLOCK_TYPE_INTERNAL,
13 SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
14 SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */
15};
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090016static int
17phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
18{
19 unsigned int enable_ext, enable_word;
20 int err;
21
Takashi Sakamoto3f403282014-10-10 23:32:49 +090022 err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext);
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090023 if (err < 0)
24 goto end;
Takashi Sakamoto3f403282014-10-10 23:32:49 +090025 err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word);
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090026 if (err < 0)
27 goto end;
28
Takashi Sakamoto7ce5c922014-10-26 22:49:45 +090029 if (enable_ext == 0)
30 *id = 0;
31 else if (enable_word == 0)
32 *id = 1;
33 else
34 *id = 2;
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090035end:
36 return err;
37}
38
Julia Lawall6b9866c2015-10-11 08:10:55 +020039static const struct snd_bebob_rate_spec phase_series_rate_spec = {
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090040 .get = &snd_bebob_stream_get_rate,
41 .set = &snd_bebob_stream_set_rate,
42};
43
44/* PHASE 88 Rack FW */
Julia Lawall6b9866c2015-10-11 08:10:55 +020045static const struct snd_bebob_clock_spec phase88_rack_clk = {
Takashi Sakamotoba517712015-06-14 12:49:29 +090046 .num = ARRAY_SIZE(phase88_rack_clk_src_types),
Takashi Sakamotoba517712015-06-14 12:49:29 +090047 .types = phase88_rack_clk_src_types,
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090048 .get = &phase88_rack_clk_src_get,
49};
Julia Lawall6b9866c2015-10-11 08:10:55 +020050const struct snd_bebob_spec phase88_rack_spec = {
Takashi Sakamoto326b9ca2014-04-25 22:45:22 +090051 .clock = &phase88_rack_clk,
52 .rate = &phase_series_rate_spec,
53 .meter = NULL
54};