Linux Audio

Check our new training course

Loading...
v4.10.11
 
 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
11static 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};
16static 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
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;
28
29	if (enable_ext == 0)
30		*id = 0;
31	else if (enable_word == 0)
32		*id = 1;
33	else
34		*id = 2;
35end:
36	return err;
37}
38
39static const struct snd_bebob_rate_spec phase_series_rate_spec = {
40	.get	= &snd_bebob_stream_get_rate,
41	.set	= &snd_bebob_stream_set_rate,
42};
43
44/* PHASE 88 Rack FW */
45static const struct snd_bebob_clock_spec phase88_rack_clk = {
46	.num	= ARRAY_SIZE(phase88_rack_clk_src_types),
47	.types	= phase88_rack_clk_src_types,
48	.get	= &phase88_rack_clk_src_get,
49};
50const struct snd_bebob_spec phase88_rack_spec = {
51	.clock	= &phase88_rack_clk,
52	.rate	= &phase_series_rate_spec,
53	.meter	= NULL
54};
v6.8
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * bebob_terratec.c - a part of driver for BeBoB based devices
 4 *
 5 * Copyright (c) 2013-2014 Takashi Sakamoto
 
 
 6 */
 7
 8#include "./bebob.h"
 9
10static const enum snd_bebob_clock_type phase88_rack_clk_src_types[] = {
11	SND_BEBOB_CLOCK_TYPE_INTERNAL,
12	SND_BEBOB_CLOCK_TYPE_EXTERNAL,	/* S/PDIF */
13	SND_BEBOB_CLOCK_TYPE_EXTERNAL,	/* Word Clock */
14};
15static int
16phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
17{
18	unsigned int enable_ext, enable_word;
19	int err;
20
21	err = avc_audio_get_selector(bebob->unit, 0, 9, &enable_ext);
22	if (err < 0)
23		goto end;
24	err = avc_audio_get_selector(bebob->unit, 0, 8, &enable_word);
25	if (err < 0)
26		goto end;
27
28	if (enable_ext == 0)
29		*id = 0;
30	else if (enable_word == 0)
31		*id = 1;
32	else
33		*id = 2;
34end:
35	return err;
36}
37
38static const struct snd_bebob_rate_spec phase_series_rate_spec = {
39	.get	= &snd_bebob_stream_get_rate,
40	.set	= &snd_bebob_stream_set_rate,
41};
42
43/* PHASE 88 Rack FW */
44static const struct snd_bebob_clock_spec phase88_rack_clk = {
45	.num	= ARRAY_SIZE(phase88_rack_clk_src_types),
46	.types	= phase88_rack_clk_src_types,
47	.get	= &phase88_rack_clk_src_get,
48};
49const struct snd_bebob_spec phase88_rack_spec = {
50	.clock	= &phase88_rack_clk,
51	.rate	= &phase_series_rate_spec,
52	.meter	= NULL
53};