Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 1 | /* |
| 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 Iwai | e7ced41 | 2014-10-21 08:26:10 +0200 | [diff] [blame] | 11 | static const char *const phase88_rack_clk_src_labels[] = { |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 12 | SND_BEBOB_CLOCK_INTERNAL, "Digital In", "Word Clock" |
| 13 | }; |
| 14 | static int |
| 15 | phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id) |
| 16 | { |
| 17 | unsigned int enable_ext, enable_word; |
| 18 | int err; |
| 19 | |
Takashi Sakamoto | 3f40328 | 2014-10-10 23:32:49 +0900 | [diff] [blame] | 20 | err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext); |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 21 | if (err < 0) |
| 22 | goto end; |
Takashi Sakamoto | 3f40328 | 2014-10-10 23:32:49 +0900 | [diff] [blame] | 23 | err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word); |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 24 | if (err < 0) |
| 25 | goto end; |
| 26 | |
Takashi Sakamoto | 7ce5c92 | 2014-10-26 22:49:45 +0900 | [diff] [blame] | 27 | if (enable_ext == 0) |
| 28 | *id = 0; |
| 29 | else if (enable_word == 0) |
| 30 | *id = 1; |
| 31 | else |
| 32 | *id = 2; |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 33 | end: |
| 34 | return err; |
| 35 | } |
| 36 | |
Takashi Iwai | e7ced41 | 2014-10-21 08:26:10 +0200 | [diff] [blame] | 37 | static const char *const phase24_series_clk_src_labels[] = { |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 38 | SND_BEBOB_CLOCK_INTERNAL, "Digital In" |
| 39 | }; |
| 40 | static int |
| 41 | phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id) |
| 42 | { |
| 43 | return avc_audio_get_selector(bebob->unit, 0, 4, id); |
| 44 | } |
| 45 | |
Takashi Sakamoto | 9fb01cd | 2014-05-28 00:14:45 +0900 | [diff] [blame] | 46 | static struct snd_bebob_rate_spec phase_series_rate_spec = { |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 47 | .get = &snd_bebob_stream_get_rate, |
| 48 | .set = &snd_bebob_stream_set_rate, |
| 49 | }; |
| 50 | |
| 51 | /* PHASE 88 Rack FW */ |
Takashi Sakamoto | 9fb01cd | 2014-05-28 00:14:45 +0900 | [diff] [blame] | 52 | static struct snd_bebob_clock_spec phase88_rack_clk = { |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 53 | .num = ARRAY_SIZE(phase88_rack_clk_src_labels), |
| 54 | .labels = phase88_rack_clk_src_labels, |
| 55 | .get = &phase88_rack_clk_src_get, |
| 56 | }; |
| 57 | struct snd_bebob_spec phase88_rack_spec = { |
| 58 | .clock = &phase88_rack_clk, |
| 59 | .rate = &phase_series_rate_spec, |
| 60 | .meter = NULL |
| 61 | }; |
| 62 | |
| 63 | /* 'PHASE 24 FW' and 'PHASE X24 FW' */ |
Takashi Sakamoto | 9fb01cd | 2014-05-28 00:14:45 +0900 | [diff] [blame] | 64 | static struct snd_bebob_clock_spec phase24_series_clk = { |
Takashi Sakamoto | 326b9ca | 2014-04-25 22:45:22 +0900 | [diff] [blame] | 65 | .num = ARRAY_SIZE(phase24_series_clk_src_labels), |
| 66 | .labels = phase24_series_clk_src_labels, |
| 67 | .get = &phase24_series_clk_src_get, |
| 68 | }; |
| 69 | struct snd_bebob_spec phase24_series_spec = { |
| 70 | .clock = &phase24_series_clk, |
| 71 | .rate = &phase_series_rate_spec, |
| 72 | .meter = NULL |
| 73 | }; |