thermal: fix Mediatek thermal controller build
[linux/fpc-iii.git] / sound / firewire / bebob / bebob_terratec.c
blobc38358b82ada0ac909ff9e999ee3f57761b5a632
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 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 */
16 static int
17 phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
19 unsigned int enable_ext, enable_word;
20 int err;
22 err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext);
23 if (err < 0)
24 goto end;
25 err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word);
26 if (err < 0)
27 goto end;
29 if (enable_ext == 0)
30 *id = 0;
31 else if (enable_word == 0)
32 *id = 1;
33 else
34 *id = 2;
35 end:
36 return err;
39 static enum snd_bebob_clock_type phase24_series_clk_src_types[] = {
40 SND_BEBOB_CLOCK_TYPE_INTERNAL,
41 SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
43 static int
44 phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
46 int err;
48 err = avc_audio_get_selector(bebob->unit, 0, 4, id);
49 if (err < 0)
50 return err;
52 if (*id >= ARRAY_SIZE(phase24_series_clk_src_types))
53 return -EIO;
55 return 0;
58 static const struct snd_bebob_rate_spec phase_series_rate_spec = {
59 .get = &snd_bebob_stream_get_rate,
60 .set = &snd_bebob_stream_set_rate,
63 /* PHASE 88 Rack FW */
64 static const struct snd_bebob_clock_spec phase88_rack_clk = {
65 .num = ARRAY_SIZE(phase88_rack_clk_src_types),
66 .types = phase88_rack_clk_src_types,
67 .get = &phase88_rack_clk_src_get,
69 const struct snd_bebob_spec phase88_rack_spec = {
70 .clock = &phase88_rack_clk,
71 .rate = &phase_series_rate_spec,
72 .meter = NULL
75 /* 'PHASE 24 FW' and 'PHASE X24 FW' */
76 static const struct snd_bebob_clock_spec phase24_series_clk = {
77 .num = ARRAY_SIZE(phase24_series_clk_src_types),
78 .types = phase24_series_clk_src_types,
79 .get = &phase24_series_clk_src_get,
81 const struct snd_bebob_spec phase24_series_spec = {
82 .clock = &phase24_series_clk,
83 .rate = &phase_series_rate_spec,
84 .meter = NULL