diff options
author | Adrian Knoth <adi@drcomp.erfurt.thur.de> | 2013-03-09 18:37:25 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-03-11 05:11:19 -0400 |
commit | 345422133ae07147aa695a469bfec8f97d77a81c (patch) | |
tree | 5cc3ac26eb268faaf4d3ec5fa7955864ddc5cc2b | |
parent | e5b7b1fe3b263441a1fc89bc6a4cca5e80f348b0 (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>
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 82f209f283aa..8b7c9fb901c7 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, | |||
3447 | .get = snd_hdspm_get_sync_check \ | 3447 | .get = snd_hdspm_get_sync_check \ |
3448 | } | 3448 | } |
3449 | 3449 | ||
3450 | #define HDSPM_TCO_LOCK_CHECK(xname, xindex) \ | ||
3451 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
3452 | .name = xname, \ | ||
3453 | .private_value = xindex, \ | ||
3454 | .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ | ||
3455 | .info = snd_hdspm_tco_info_lock_check, \ | ||
3456 | .get = snd_hdspm_get_sync_check \ | ||
3457 | } | ||
3458 | |||
3459 | |||
3450 | 3460 | ||
3451 | static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol, | 3461 | static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol, |
3452 | struct snd_ctl_elem_info *uinfo) | 3462 | struct snd_ctl_elem_info *uinfo) |
@@ -3456,6 +3466,14 @@ static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol, | |||
3456 | return 0; | 3466 | return 0; |
3457 | } | 3467 | } |
3458 | 3468 | ||
3469 | static int snd_hdspm_tco_info_lock_check(struct snd_kcontrol *kcontrol, | ||
3470 | struct snd_ctl_elem_info *uinfo) | ||
3471 | { | ||
3472 | static char *texts[] = { "No Lock", "Lock" }; | ||
3473 | ENUMERATED_CTL_INFO(uinfo, texts); | ||
3474 | return 0; | ||
3475 | } | ||
3476 | |||
3459 | static int hdspm_wc_sync_check(struct hdspm *hdspm) | 3477 | static int hdspm_wc_sync_check(struct hdspm *hdspm) |
3460 | { | 3478 | { |
3461 | int status, status2; | 3479 | int status, status2; |
@@ -3585,6 +3603,14 @@ static int hdspm_aes_sync_check(struct hdspm *hdspm, int idx) | |||
3585 | return 0; | 3603 | return 0; |
3586 | } | 3604 | } |
3587 | 3605 | ||
3606 | static int hdspm_tco_input_check(struct hdspm *hdspm, u32 mask) | ||
3607 | { | ||
3608 | u32 status; | ||
3609 | status = hdspm_read(hdspm, HDSPM_RD_TCO + 4); | ||
3610 | |||
3611 | return (status & mask) ? 1 : 0; | ||
3612 | } | ||
3613 | |||
3588 | 3614 | ||
3589 | static int hdspm_tco_sync_check(struct hdspm *hdspm) | 3615 | static int hdspm_tco_sync_check(struct hdspm *hdspm) |
3590 | { | 3616 | { |
@@ -3692,6 +3718,22 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol, | |||
3692 | 3718 | ||
3693 | } | 3719 | } |
3694 | 3720 | ||
3721 | if (hdspm->tco) { | ||
3722 | switch (kcontrol->private_value) { | ||
3723 | case 11: | ||
3724 | /* Check TCO for lock state of its current input */ | ||
3725 | val = hdspm_tco_input_check(hdspm, HDSPM_TCO1_TCO_lock); | ||
3726 | break; | ||
3727 | case 12: | ||
3728 | /* Check TCO for valid time code on LTC input. */ | ||
3729 | val = hdspm_tco_input_check(hdspm, | ||
3730 | HDSPM_TCO1_LTC_Input_valid); | ||
3731 | break; | ||
3732 | default: | ||
3733 | break; | ||
3734 | } | ||
3735 | } | ||
3736 | |||
3695 | if (-1 == val) | 3737 | if (-1 == val) |
3696 | val = 3; | 3738 | val = 3; |
3697 | 3739 | ||