summaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob/bebob_yamaha.c
diff options
context:
space:
mode:
authorTakashi Sakamoto2015-06-14 05:49:29 +0200
committerTakashi Iwai2015-06-15 13:34:47 +0200
commitba5177131d8cb4b778a43ce995155928be851117 (patch)
tree75f16bb07caade26f0bd97daa3d4075f15bd0ebc /sound/firewire/bebob/bebob_yamaha.c
parentALSA: bebob: apply new enumerator to normalize the type of clock source (diff)
downloadkernel-qcow2-linux-ba5177131d8cb4b778a43ce995155928be851117.tar.gz
kernel-qcow2-linux-ba5177131d8cb4b778a43ce995155928be851117.tar.xz
kernel-qcow2-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_yamaha.c')
-rw-r--r--sound/firewire/bebob/bebob_yamaha.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sound/firewire/bebob/bebob_yamaha.c b/sound/firewire/bebob/bebob_yamaha.c
index ef1fe3823a9c..2f59512ad91e 100644
--- a/sound/firewire/bebob/bebob_yamaha.c
+++ b/sound/firewire/bebob/bebob_yamaha.c
@@ -29,13 +29,27 @@
*/
static const char *const clk_src_labels[] = {SND_BEBOB_CLOCK_INTERNAL, "SPDIF"};
+static enum snd_bebob_clock_type clk_src_types[] = {
+ SND_BEBOB_CLOCK_TYPE_INTERNAL,
+ SND_BEBOB_CLOCK_TYPE_EXTERNAL, /* S/PDIF */
+};
static int
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(clk_src_types))
+ return -EIO;
+
+ return 0;
}
static struct snd_bebob_clock_spec clock_spec = {
- .num = ARRAY_SIZE(clk_src_labels),
+ .num = ARRAY_SIZE(clk_src_types),
+ .types = clk_src_types,
.labels = clk_src_labels,
.get = &clk_src_get,
};