diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2015-06-14 12:49:29 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-06-15 13:34:47 +0200 |
commit | ba5177131d8cb4b778a43ce995155928be851117 (patch) | |
tree | 75f16bb07caade26f0bd97daa3d4075f15bd0ebc /sound/firewire/bebob/bebob_terratec.c | |
parent | 13a4f42016fecbf971c3f6e249027a009a83839f (diff) | |
download | talos-obmc-linux-ba5177131d8cb4b778a43ce995155928be851117.tar.gz talos-obmc-linux-ba5177131d8cb4b778a43ce995155928be851117.zip |
ALSA: bebob: preparation for replacing string literals by normalized representation for model-dependent structures
Previous commit adds a enumerator as a normalized representation of
clock source, while model-dependent structures still use string literals
for this purpose.
This commit is a preparation for replacement.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob/bebob_terratec.c')
-rw-r--r-- | sound/firewire/bebob/bebob_terratec.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/sound/firewire/bebob/bebob_terratec.c b/sound/firewire/bebob/bebob_terratec.c index ad635004d699..3b64d8db8e14 100644 --- a/sound/firewire/bebob/bebob_terratec.c +++ b/sound/firewire/bebob/bebob_terratec.c @@ -11,6 +11,11 @@ static const char *const phase88_rack_clk_src_labels[] = { SND_BEBOB_CLOCK_INTERNAL, "Digital In", "Word Clock" }; +static enum snd_bebob_clock_type phase88_rack_clk_src_types[] = { + SND_BEBOB_CLOCK_TYPE_INTERNAL, + SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */ + SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* Word Clock */ +}; static int phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id) { @@ -37,10 +42,23 @@ end: static const char *const phase24_series_clk_src_labels[] = { SND_BEBOB_CLOCK_INTERNAL, "Digital In" }; +static enum snd_bebob_clock_type phase24_series_clk_src_types[] = { + SND_BEBOB_CLOCK_TYPE_INTERNAL, + SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */ +}; static int phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id) { - return avc_audio_get_selector(bebob->unit, 0, 4, id); + int err; + + err = avc_audio_get_selector(bebob->unit, 0, 4, id); + if (err < 0) + return err; + + if (*id >= ARRAY_SIZE(phase24_series_clk_src_types)) + return -EIO; + + return 0; } static struct snd_bebob_rate_spec phase_series_rate_spec = { @@ -50,8 +68,9 @@ static struct snd_bebob_rate_spec phase_series_rate_spec = { /* PHASE 88 Rack FW */ static struct snd_bebob_clock_spec phase88_rack_clk = { - .num = ARRAY_SIZE(phase88_rack_clk_src_labels), + .num = ARRAY_SIZE(phase88_rack_clk_src_types), .labels = phase88_rack_clk_src_labels, + .types = phase88_rack_clk_src_types, .get = &phase88_rack_clk_src_get, }; struct snd_bebob_spec phase88_rack_spec = { @@ -62,8 +81,9 @@ struct snd_bebob_spec phase88_rack_spec = { /* 'PHASE 24 FW' and 'PHASE X24 FW' */ static struct snd_bebob_clock_spec phase24_series_clk = { - .num = ARRAY_SIZE(phase24_series_clk_src_labels), + .num = ARRAY_SIZE(phase24_series_clk_src_types), .labels = phase24_series_clk_src_labels, + .types = phase24_series_clk_src_types, .get = &phase24_series_clk_src_get, }; struct snd_bebob_spec phase24_series_spec = { |