[PATCH 05/15] drm/i915/tv: Store the TV oversampling factor in the TV mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Store the oversampling factor as a number in the TV modes. We
shall want to arithmetic with this which is easier if it's
a number we can use directly.

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_tv.c | 42 ++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index dea24ef88763..96257b29d07c 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -307,7 +307,7 @@ struct tv_mode {
 
 	u32 clock;
 	u16 refresh; /* in millihertz (for precision) */
-	u32 oversample;
+	u8 oversample;
 	u8 hsync_end;
 	u16 hblank_start, hblank_end, htotal;
 	bool progressive : 1, trilevel_sync : 1, component_only : 1;
@@ -379,7 +379,7 @@ static const struct tv_mode tv_modes[] = {
 		.name		= "NTSC-M",
 		.clock		= 108000,
 		.refresh	= 59940,
-		.oversample	= TV_OVERSAMPLE_8X,
+		.oversample	= 8,
 		.component_only = 0,
 		/* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */
 
@@ -422,7 +422,7 @@ static const struct tv_mode tv_modes[] = {
 		.name		= "NTSC-443",
 		.clock		= 108000,
 		.refresh	= 59940,
-		.oversample	= TV_OVERSAMPLE_8X,
+		.oversample	= 8,
 		.component_only = 0,
 		/* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 4.43MHz */
 		.hsync_end	= 64,		    .hblank_end		= 124,
@@ -464,7 +464,7 @@ static const struct tv_mode tv_modes[] = {
 		.name		= "NTSC-J",
 		.clock		= 108000,
 		.refresh	= 59940,
-		.oversample	= TV_OVERSAMPLE_8X,
+		.oversample	= 8,
 		.component_only = 0,
 
 		/* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */
@@ -507,7 +507,7 @@ static const struct tv_mode tv_modes[] = {
 		.name		= "PAL-M",
 		.clock		= 108000,
 		.refresh	= 59940,
-		.oversample	= TV_OVERSAMPLE_8X,
+		.oversample	= 8,
 		.component_only = 0,
 
 		/* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */
@@ -551,7 +551,7 @@ static const struct tv_mode tv_modes[] = {
 		.name	    = "PAL-N",
 		.clock		= 108000,
 		.refresh	= 50000,
-		.oversample	= TV_OVERSAMPLE_8X,
+		.oversample	= 8,
 		.component_only = 0,
 
 		.hsync_end	= 64,		    .hblank_end		= 128,
@@ -596,7 +596,7 @@ static const struct tv_mode tv_modes[] = {
 		.name	    = "PAL",
 		.clock		= 108000,
 		.refresh	= 50000,
-		.oversample	= TV_OVERSAMPLE_8X,
+		.oversample	= 8,
 		.component_only = 0,
 
 		.hsync_end	= 64,		    .hblank_end		= 142,
@@ -638,7 +638,7 @@ static const struct tv_mode tv_modes[] = {
 		.name       = "480p",
 		.clock		= 108000,
 		.refresh	= 59940,
-		.oversample     = TV_OVERSAMPLE_4X,
+		.oversample     = 4,
 		.component_only = 1,
 
 		.hsync_end      = 64,               .hblank_end         = 122,
@@ -662,7 +662,7 @@ static const struct tv_mode tv_modes[] = {
 		.name       = "576p",
 		.clock		= 108000,
 		.refresh	= 50000,
-		.oversample     = TV_OVERSAMPLE_4X,
+		.oversample     = 4,
 		.component_only = 1,
 
 		.hsync_end      = 64,               .hblank_end         = 139,
@@ -686,7 +686,7 @@ static const struct tv_mode tv_modes[] = {
 		.name       = "720p@60Hz",
 		.clock		= 148500,
 		.refresh	= 60000,
-		.oversample     = TV_OVERSAMPLE_2X,
+		.oversample     = 2,
 		.component_only = 1,
 
 		.hsync_end      = 80,               .hblank_end         = 300,
@@ -710,7 +710,7 @@ static const struct tv_mode tv_modes[] = {
 		.name       = "720p@50Hz",
 		.clock		= 148500,
 		.refresh	= 50000,
-		.oversample     = TV_OVERSAMPLE_2X,
+		.oversample     = 2,
 		.component_only = 1,
 
 		.hsync_end      = 80,               .hblank_end         = 300,
@@ -735,7 +735,7 @@ static const struct tv_mode tv_modes[] = {
 		.name       = "1080i@50Hz",
 		.clock		= 148500,
 		.refresh	= 50000,
-		.oversample     = TV_OVERSAMPLE_2X,
+		.oversample     = 2,
 		.component_only = 1,
 
 		.hsync_end      = 88,               .hblank_end         = 235,
@@ -761,7 +761,7 @@ static const struct tv_mode tv_modes[] = {
 		.name       = "1080i@60Hz",
 		.clock		= 148500,
 		.refresh	= 60000,
-		.oversample     = TV_OVERSAMPLE_2X,
+		.oversample     = 2,
 		.component_only = 1,
 
 		.hsync_end      = 88,               .hblank_end         = 235,
@@ -1030,7 +1030,21 @@ static void intel_tv_pre_enable(struct intel_encoder *encoder,
 	}
 
 	tv_ctl |= TV_ENC_PIPE_SEL(intel_crtc->pipe);
-	tv_ctl |= tv_mode->oversample;
+
+	switch (tv_mode->oversample) {
+	case 8:
+		tv_ctl |= TV_OVERSAMPLE_8X;
+		break;
+	case 4:
+		tv_ctl |= TV_OVERSAMPLE_4X;
+		break;
+	case 2:
+		tv_ctl |= TV_OVERSAMPLE_2X;
+		break;
+	default:
+		tv_ctl |= TV_OVERSAMPLE_NONE;
+		break;
+	}
 
 	if (tv_mode->progressive)
 		tv_ctl |= TV_PROGRESSIVE;
-- 
2.18.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux