summaryrefslogtreecommitdiffstats
path: root/sound/pci/rme9652
diff options
context:
space:
mode:
authorAdrian Knoth <adi@drcomp.erfurt.thur.de>2013-03-10 00:37:25 +0100
committerTakashi Iwai <tiwai@suse.de>2013-03-11 10:11:19 +0100
commit345422133ae07147aa695a469bfec8f97d77a81c (patch)
tree5cc3ac26eb268faaf4d3ec5fa7955864ddc5cc2b /sound/pci/rme9652
parente5b7b1fe3b263441a1fc89bc6a4cca5e80f348b0 (diff)
ALSA: hdspm - Also check for TCO sync states
This patch prepares snd_hdspm_get_sync_check() to also check the TCO sync state. The added feature will be exposed to the user in a later commit. Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r--sound/pci/rme9652/hdspm.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 82f209f283a..8b7c9fb901c 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -3447,6 +3447,16 @@ static int snd_hdspm_put_playback_mixer(struct snd_kcontrol *kcontrol,
.get = snd_hdspm_get_sync_check \
}
+#define HDSPM_TCO_LOCK_CHECK(xname, xindex) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
+ .name = xname, \
+ .private_value = xindex, \
+ .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
+ .info = snd_hdspm_tco_info_lock_check, \
+ .get = snd_hdspm_get_sync_check \
+}
+
+
static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
@@ -3456,6 +3466,14 @@ static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol,
return 0;
}
+static int snd_hdspm_tco_info_lock_check(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+{
+ static char *texts[] = { "No Lock", "Lock" };
+ ENUMERATED_CTL_INFO(uinfo, texts);
+ return 0;
+}
+
static int hdspm_wc_sync_check(struct hdspm *hdspm)
{
int status, status2;
@@ -3585,6 +3603,14 @@ static int hdspm_aes_sync_check(struct hdspm *hdspm, int idx)
return 0;
}
+static int hdspm_tco_input_check(struct hdspm *hdspm, u32 mask)
+{
+ u32 status;
+ status = hdspm_read(hdspm, HDSPM_RD_TCO + 4);
+
+ return (status & mask) ? 1 : 0;
+}
+
static int hdspm_tco_sync_check(struct hdspm *hdspm)
{
@@ -3692,6 +3718,22 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol,
}
+ if (hdspm->tco) {
+ switch (kcontrol->private_value) {
+ case 11:
+ /* Check TCO for lock state of its current input */
+ val = hdspm_tco_input_check(hdspm, HDSPM_TCO1_TCO_lock);
+ break;
+ case 12:
+ /* Check TCO for valid time code on LTC input. */
+ val = hdspm_tco_input_check(hdspm,
+ HDSPM_TCO1_LTC_Input_valid);
+ break;
+ default:
+ break;
+ }
+ }
+
if (-1 == val)
val = 3;