Skip to contentSkip to conversation

HDSPM: Fix LTC ioctl

PATCH Applied Adrian Knoth 2 participants 5 messages Aug 19, 2013 Sound

lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/3 ALSA: hdspm - Fix default value in SNDRV_HDSPM_IOCTL_GET_LTC

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.

sound/pci/rme9652/hdspm.c +1 -1
index ec6335e..e4d76a6 100644
@@ -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) {
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH 2/3 ALSA: hdspm - Use enums in hdspm_tco_ltc_frames()

This patch doesn't change functionality, it only improves readability and fixes a copy&paste error in a comment.

sound/pci/rme9652/hdspm.c +5 -5
index e4d76a6..3cde55b 100644
@@ -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;
 		}
 	}
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH 3/3 ALSA: hdspm - Fix SNDRV_HDSPM_IOCTL_GET_LTC

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.

include/uapi/sound/hdspm.h +1 -1
index 1f59ea2..d956c35 100644
@@ -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
Signature · 1 line
1.8.3.2
Applied
#4 lore raw
In reply to Adrian Knoth

At Mon, 19 Aug 2013 17:20:29 +0200,

Quoted 8 lines · Adrian Knoth

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.

Quoted 1 line

I'll also send a patch to fix alsa-lib.

Will apply them, too.

Takashi

Quoted 16 lines

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(-)
Signature · 1 line
1.8.3.2