Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / sound / firewire / bebob / bebob_terratec.c
blobeef8ea7d9b978bf36bfde09bb8e98c47cc13c9cc
1 /*
2 * bebob_terratec.c - a part of driver for BeBoB based devices
4 * Copyright (c) 2013-2014 Takashi Sakamoto
6 * Licensed under the terms of the GNU General Public License, version 2.
7 */
9 #include "./bebob.h"
11 static char *const phase88_rack_clk_src_labels[] = {
12 SND_BEBOB_CLOCK_INTERNAL, "Digital In", "Word Clock"
14 static int
15 phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
17 unsigned int enable_ext, enable_word;
18 int err;
20 err = avc_audio_get_selector(bebob->unit, 0, 0, &enable_ext);
21 if (err < 0)
22 goto end;
23 err = avc_audio_get_selector(bebob->unit, 0, 0, &enable_word);
24 if (err < 0)
25 goto end;
27 *id = (enable_ext & 0x01) | ((enable_word & 0x01) << 1);
28 end:
29 return err;
32 static char *const phase24_series_clk_src_labels[] = {
33 SND_BEBOB_CLOCK_INTERNAL, "Digital In"
35 static int
36 phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
38 return avc_audio_get_selector(bebob->unit, 0, 4, id);
41 static struct snd_bebob_rate_spec phase_series_rate_spec = {
42 .get = &snd_bebob_stream_get_rate,
43 .set = &snd_bebob_stream_set_rate,
46 /* PHASE 88 Rack FW */
47 static struct snd_bebob_clock_spec phase88_rack_clk = {
48 .num = ARRAY_SIZE(phase88_rack_clk_src_labels),
49 .labels = phase88_rack_clk_src_labels,
50 .get = &phase88_rack_clk_src_get,
52 struct snd_bebob_spec phase88_rack_spec = {
53 .clock = &phase88_rack_clk,
54 .rate = &phase_series_rate_spec,
55 .meter = NULL
58 /* 'PHASE 24 FW' and 'PHASE X24 FW' */
59 static struct snd_bebob_clock_spec phase24_series_clk = {
60 .num = ARRAY_SIZE(phase24_series_clk_src_labels),
61 .labels = phase24_series_clk_src_labels,
62 .get = &phase24_series_clk_src_get,
64 struct snd_bebob_spec phase24_series_spec = {
65 .clock = &phase24_series_clk,
66 .rate = &phase_series_rate_spec,
67 .meter = NULL