+/*
+ * clock mode selection
+ */
+static int vx_clock_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
+{
+ static char *texts[3] = {
+ "Auto", "Internal", "External"
+ };
+
+ uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+ uinfo->count = 1;
+ uinfo->value.enumerated.items = 3;
+ if (uinfo->value.enumerated.item > 2)
+ uinfo->value.enumerated.item = 2;
+ strcpy(uinfo->value.enumerated.name,
+ texts[uinfo->value.enumerated.item]);
+ return 0;
+}
+
+static int vx_clock_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+ struct vx_core *chip = snd_kcontrol_chip(kcontrol);
+ ucontrol->value.enumerated.item[0] = chip->clock_mode;
+ return 0;
+}
+
+static int vx_clock_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+ struct vx_core *chip = snd_kcontrol_chip(kcontrol);
+ mutex_lock(&chip->mixer_mutex);
+ if (chip->clock_mode != ucontrol->value.enumerated.item[0]) {
+ chip->clock_mode = ucontrol->value.enumerated.item[0];
+ vx_set_clock(chip, chip->freq);
+ mutex_unlock(&chip->mixer_mutex);
+ return 1;
+ }
+ mutex_unlock(&chip->mixer_mutex);
+ return 0;
+}
+
+static struct snd_kcontrol_new vx_control_clock_mode = {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Clock Mode",
+ .info = vx_clock_mode_info,
+ .get = vx_clock_mode_get,
+ .put = vx_clock_mode_put,
+};
+