Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371703
b: refs/heads/master
c: f99c788
h: refs/heads/master
i:
  371701: 62897c1
  371699: 689f721
  371695: c56620e
v: v3
  • Loading branch information
Adrian Knoth authored and Takashi Iwai committed Mar 11, 2013
1 parent da4682d commit 61a1ca6
Show file tree
Hide file tree
Showing 2 changed files with 107 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 345422133ae07147aa695a469bfec8f97d77a81c
refs/heads/master: f99c78812fcc38a32f9f1694cf75dd7f7e329ae7
106 changes: 106 additions & 0 deletions trunk/sound/pci/rme9652/hdspm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2930,6 +2930,112 @@ static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol,
return 0;
}



#define HDSPM_TCO_VIDEO_INPUT_FORMAT(xname, xindex) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
.name = xname, \
.access = SNDRV_CTL_ELEM_ACCESS_READ |\
SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
.info = snd_hdspm_info_tco_video_input_format, \
.get = snd_hdspm_get_tco_video_input_format, \
}

static int snd_hdspm_info_tco_video_input_format(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
static char *texts[] = {"No video", "NTSC", "PAL"};
ENUMERATED_CTL_INFO(uinfo, texts);
return 0;
}

static int snd_hdspm_get_tco_video_input_format(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
u32 status;
int ret = 0;

struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
status = hdspm_read(hdspm, HDSPM_RD_TCO + 4);
switch (status & (HDSPM_TCO1_Video_Input_Format_NTSC |
HDSPM_TCO1_Video_Input_Format_PAL)) {
case HDSPM_TCO1_Video_Input_Format_NTSC:
/* ntsc */
ret = 1;
break;
case HDSPM_TCO1_Video_Input_Format_PAL:
/* pal */
ret = 2;
break;
default:
/* no video */
ret = 0;
break;
}
ucontrol->value.enumerated.item[0] = ret;
return 0;
}



#define HDSPM_TCO_LTC_FRAMES(xname, xindex) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
.name = xname, \
.access = SNDRV_CTL_ELEM_ACCESS_READ |\
SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
.info = snd_hdspm_info_tco_ltc_frames, \
.get = snd_hdspm_get_tco_ltc_frames, \
}

static int snd_hdspm_info_tco_ltc_frames(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
static char *texts[] = {"No lock", "24 fps", "25 fps", "29.97 fps",
"30 fps"};
ENUMERATED_CTL_INFO(uinfo, texts);
return 0;
}

static int hdspm_tco_ltc_frames(struct hdspm *hdspm)
{
u32 status;
int ret = 0;

status = hdspm_read(hdspm, HDSPM_RD_TCO + 4);
if (status & HDSPM_TCO1_LTC_Input_valid) {
switch (status & (HDSPM_TCO1_LTC_Format_LSB |
HDSPM_TCO1_LTC_Format_MSB)) {
case 0:
/* 24 fps */
ret = 1;
break;
case HDSPM_TCO1_LTC_Format_LSB:
/* 25 fps */
ret = 2;
break;
case HDSPM_TCO1_LTC_Format_MSB:
/* 25 fps */
ret = 3;
break;
default:
/* 30 fps */
ret = 4;
break;
}
}

return ret;
}

static int snd_hdspm_get_tco_ltc_frames(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);

ucontrol->value.enumerated.item[0] = hdspm_tco_ltc_frames(hdspm);
return 0;
}

#define HDSPM_TOGGLE_SETTING(xname, xindex) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
.name = xname, \
Expand Down

0 comments on commit 61a1ca6

Please sign in to comment.