[alsa-devel] [PATCH 0/3] HDSPM: Fix LTC ioctl
Hi!
This series fixes the broken LTC ioctl to query the TCO. Apparently, nobody ever attempted to use the code, otherwise, this rather obvious problem would have been spotted way earlier. This is maybe because not too many people happen to have a TV studio around to make use of this feature. ;)
I'll also send a patch to fix alsa-lib.
Cheers
Adrian Knoth (3): ALSA: hdspm - Fix default value in SNDRV_HDSPM_IOCTL_GET_LTC ALSA: hdspm - Use enums in hdspm_tco_ltc_frames() ALSA: hdspm - Fix SNDRV_HDSPM_IOCTL_GET_LTC
include/uapi/sound/hdspm.h | 2 +- sound/pci/rme9652/hdspm.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
Use enum hdspm_ltc_format's fps_30 (corresponds to 4) instead of 30, Other case branches return 1, 2 or 3 respectively, so 30 obviously is wrong.
Since SNDRV_HDSPM_IOCTL_GET_LTC had never been working due to a copy&paste error in hdspm.h, this change doesn't break userspace.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index ec6335e..e4d76a6 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -6311,7 +6311,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, ltc.format = fps_2997; break; default: - ltc.format = 30; + ltc.format = fps_30; break; } if (i & HDSPM_TCO1_set_drop_frame_flag) {
This patch doesn't change functionality, it only improves readability and fixes a copy&paste error in a comment.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index e4d76a6..3cde55b 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -3173,19 +3173,19 @@ static int hdspm_tco_ltc_frames(struct hdspm *hdspm) HDSPM_TCO1_LTC_Format_MSB)) { case 0: /* 24 fps */ - ret = 1; + ret = fps_24; break; case HDSPM_TCO1_LTC_Format_LSB: /* 25 fps */ - ret = 2; + ret = fps_25; break; case HDSPM_TCO1_LTC_Format_MSB: - /* 25 fps */ - ret = 3; + /* 29.97 fps */ + ret = fps_2997; break; default: /* 30 fps */ - ret = 4; + ret = fps_30; break; } }
Use struct hdspm_ltc to query the LTC, using a mixer struct is just plain wrong.
Due to the wrong struct, this ioctl was never working, so we're free to fix it without breaking userspace compatibility.
Signed-off-by: Adrian Knoth adi@drcomp.erfurt.thur.de
diff --git a/include/uapi/sound/hdspm.h b/include/uapi/sound/hdspm.h index 1f59ea2..d956c35 100644 --- a/include/uapi/sound/hdspm.h +++ b/include/uapi/sound/hdspm.h @@ -111,7 +111,7 @@ struct hdspm_ltc { enum hdspm_ltc_input_format input_format; };
-#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_mixer_ioctl) +#define SNDRV_HDSPM_IOCTL_GET_LTC _IOR('H', 0x46, struct hdspm_ltc)
/** * The status data reflects the device's current state
At Mon, 19 Aug 2013 17:20:29 +0200, Adrian Knoth wrote:
Hi!
This series fixes the broken LTC ioctl to query the TCO. Apparently, nobody ever attempted to use the code, otherwise, this rather obvious problem would have been spotted way earlier. This is maybe because not too many people happen to have a TV studio around to make use of this feature. ;)
Thanks, applied all three patches.
I'll also send a patch to fix alsa-lib.
Will apply them, too.
Takashi
Cheers
Adrian Knoth (3): ALSA: hdspm - Fix default value in SNDRV_HDSPM_IOCTL_GET_LTC ALSA: hdspm - Use enums in hdspm_tco_ltc_frames() ALSA: hdspm - Fix SNDRV_HDSPM_IOCTL_GET_LTC
include/uapi/sound/hdspm.h | 2 +- sound/pci/rme9652/hdspm.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
-- 1.8.3.2
participants (2)
-
Adrian Knoth
-
Takashi Iwai