All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ville Syrjala <ville.syrjala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH 07/15] drm/i915: Extract intel_tv_add_properties()
Date: Mon, 12 Sep 2022 14:18:06 +0300	[thread overview]
Message-ID: <20220912111814.17466-8-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20220912111814.17466-1-ville.syrjala@linux.intel.com>

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Pull all the TV connector property setup into its own neat function.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_tv.c | 80 +++++++++++++------------
 1 file changed, 43 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c
index 9379f3463344..306d08482855 100644
--- a/drivers/gpu/drm/i915/display/intel_tv.c
+++ b/drivers/gpu/drm/i915/display/intel_tv.c
@@ -1869,6 +1869,48 @@ static const struct drm_encoder_funcs intel_tv_enc_funcs = {
 	.destroy = intel_encoder_destroy,
 };
 
+static void intel_tv_add_properties(struct drm_connector *connector)
+{
+	struct drm_i915_private *i915 = to_i915(connector->dev);
+	struct drm_connector_state *conn_state = connector->state;
+	const char *tv_format_names[ARRAY_SIZE(tv_modes)];
+	int i;
+
+	/* BIOS margin values */
+	conn_state->tv.margins.left = 54;
+	conn_state->tv.margins.top = 36;
+	conn_state->tv.margins.right = 46;
+	conn_state->tv.margins.bottom = 37;
+
+	conn_state->tv.mode = 0;
+
+	/* Create TV properties then attach current values */
+	for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
+		/* 1080p50/1080p60 not supported on gen3 */
+		if (DISPLAY_VER(i915) == 3 && tv_modes[i].oversample == 1)
+			break;
+
+		tv_format_names[i] = tv_modes[i].name;
+	}
+	drm_mode_create_tv_properties(&i915->drm, i, tv_format_names);
+
+	drm_object_attach_property(&connector->base,
+				   i915->drm.mode_config.tv_mode_property,
+				   conn_state->tv.mode);
+	drm_object_attach_property(&connector->base,
+				   i915->drm.mode_config.tv_left_margin_property,
+				   conn_state->tv.margins.left);
+	drm_object_attach_property(&connector->base,
+				   i915->drm.mode_config.tv_top_margin_property,
+				   conn_state->tv.margins.top);
+	drm_object_attach_property(&connector->base,
+				   i915->drm.mode_config.tv_right_margin_property,
+				   conn_state->tv.margins.right);
+	drm_object_attach_property(&connector->base,
+				   i915->drm.mode_config.tv_bottom_margin_property,
+				   conn_state->tv.margins.bottom);
+}
+
 void
 intel_tv_init(struct drm_i915_private *dev_priv)
 {
@@ -1878,9 +1920,6 @@ intel_tv_init(struct drm_i915_private *dev_priv)
 	struct intel_encoder *intel_encoder;
 	struct intel_connector *intel_connector;
 	u32 tv_dac_on, tv_dac_off, save_tv_dac;
-	const char *tv_format_names[ARRAY_SIZE(tv_modes)];
-	int i, initial_mode = 0;
-	struct drm_connector_state *state;
 
 	if ((intel_de_read(dev_priv, TV_CTL) & TV_FUSE_STATE_MASK) == TV_FUSE_STATE_DISABLED)
 		return;
@@ -1926,7 +1965,6 @@ intel_tv_init(struct drm_i915_private *dev_priv)
 
 	intel_encoder = &intel_tv->base;
 	connector = &intel_connector->base;
-	state = connector->state;
 
 	/*
 	 * The documentation, for the older chipsets at least, recommend
@@ -1963,41 +2001,9 @@ intel_tv_init(struct drm_i915_private *dev_priv)
 	intel_encoder->cloneable = 0;
 	intel_tv->type = DRM_MODE_CONNECTOR_Unknown;
 
-	/* BIOS margin values */
-	state->tv.margins.left = 54;
-	state->tv.margins.top = 36;
-	state->tv.margins.right = 46;
-	state->tv.margins.bottom = 37;
-
-	state->tv.mode = initial_mode;
-
 	drm_connector_helper_add(connector, &intel_tv_connector_helper_funcs);
 	connector->interlace_allowed = false;
 	connector->doublescan_allowed = false;
 
-	/* Create TV properties then attach current values */
-	for (i = 0; i < ARRAY_SIZE(tv_modes); i++) {
-		/* 1080p50/1080p60 not supported on gen3 */
-		if (DISPLAY_VER(dev_priv) == 3 &&
-		    tv_modes[i].oversample == 1)
-			break;
-
-		tv_format_names[i] = tv_modes[i].name;
-	}
-	drm_mode_create_tv_properties(dev, i, tv_format_names);
-
-	drm_object_attach_property(&connector->base, dev->mode_config.tv_mode_property,
-				   state->tv.mode);
-	drm_object_attach_property(&connector->base,
-				   dev->mode_config.tv_left_margin_property,
-				   state->tv.margins.left);
-	drm_object_attach_property(&connector->base,
-				   dev->mode_config.tv_top_margin_property,
-				   state->tv.margins.top);
-	drm_object_attach_property(&connector->base,
-				   dev->mode_config.tv_right_margin_property,
-				   state->tv.margins.right);
-	drm_object_attach_property(&connector->base,
-				   dev->mode_config.tv_bottom_margin_property,
-				   state->tv.margins.bottom);
+	intel_tv_add_properties(connector);
 }
-- 
2.35.1


  parent reply	other threads:[~2022-09-12 11:19 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 11:17 [Intel-gfx] [PATCH 00/15] drm/i915: Some house cleaning Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 01/15] drm/i915: Drop pointless middle man variable Ville Syrjala
2022-09-26 10:33   ` Luca Coelho
2022-09-26 10:43     ` Jani Nikula
2022-09-26 11:05       ` Luca Coelho
2022-09-12 11:18 ` [Intel-gfx] [PATCH 02/15] drm/i915: Clean up transcoder_to_stream_enc_status() Ville Syrjala
2022-09-26 10:34   ` Luca Coelho
2022-09-12 11:18 ` [Intel-gfx] [PATCH 03/15] drm/i915: Drop pointless 'budget' variable Ville Syrjala
2022-09-26 10:37   ` Luca Coelho
2022-09-12 11:18 ` [Intel-gfx] [PATCH 04/15] drm/i915: Use BIT() when dealing with output types Ville Syrjala
2022-09-26 10:40   ` Luca Coelho
2022-09-12 11:18 ` [Intel-gfx] [PATCH 05/15] drm/i915: Pass intel_encoder to to_lvds_encoder() Ville Syrjala
2022-09-26 10:46   ` Luca Coelho
2022-09-12 11:18 ` [Intel-gfx] [PATCH 06/15] drm/i915: Extract intel_edp_backlight_setup() Ville Syrjala
2022-09-12 11:57   ` Jani Nikula
2022-09-26 10:58   ` Luca Coelho
2022-09-26 11:16     ` Ville Syrjälä
2022-09-26 11:33       ` Luca Coelho
2022-09-26 11:38         ` Luca Coelho
2022-09-12 11:18 ` Ville Syrjala [this message]
2022-09-12 11:18 ` [Intel-gfx] [PATCH 08/15] drm/i915: Extract intel_dp_mst_add_properties() Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 09/15] drm/i915: Extract intel_lvds_add_properties() Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 10/15] drm/i915: Move eDP scaling_mode prop setup to the proper place Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 11/15] drm/i915: Extract intel_attach_scaling_mode_property() Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 12/15] drm/i915: Clean up connector->*_allowed setup Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 13/15] drm/i915: Don't init eDP if we can't find a fixed mode Ville Syrjala
2022-09-12 12:02   ` Jani Nikula
2022-09-12 17:36     ` Ville Syrjälä
2022-09-12 11:18 ` [Intel-gfx] [PATCH 14/15] drm/i915: Finish s/intel_encoder/encoder/ rename Ville Syrjala
2022-09-12 11:18 ` [Intel-gfx] [PATCH 15/15] drm/i915: s/intel_connector/connector/ in init code Ville Syrjala
2022-09-12 17:56 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Some house cleaning Patchwork
2022-09-12 18:17 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-09-12 23:20 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220912111814.17466-8-ville.syrjala@linux.intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.