Intel-GFX Archive on 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 6/9] drm/i915: Extract intel_panel_vbt_sdvo_fixed_mode()
Date: Wed, 23 Mar 2022 20:29:32 +0200	[thread overview]
Message-ID: <20220323182935.4701-7-ville.syrjala@linux.intel.com> (raw)
In-Reply-To: <20220323182935.4701-1-ville.syrjala@linux.intel.com>

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

We have a function for duplicating the VBT LFP mode. Add the same
for the VBT SDVO mode.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_panel.c | 20 ++++++++++++++++++++
 drivers/gpu/drm/i915/display/intel_panel.h |  2 ++
 drivers/gpu/drm/i915/display/intel_sdvo.c  | 14 ++++----------
 3 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index bd606d0b1c24..7f59db8b9ede 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -272,6 +272,26 @@ intel_panel_vbt_lfp_fixed_mode(struct intel_connector *connector)
 	return fixed_mode;
 }
 
+struct drm_display_mode *
+intel_panel_vbt_sdvo_fixed_mode(struct intel_connector *connector)
+{
+	struct drm_i915_private *i915 = to_i915(connector->base.dev);
+	struct drm_display_mode *fixed_mode;
+
+	if (!i915->vbt.sdvo_lvds_vbt_mode)
+		return NULL;
+
+	fixed_mode = drm_mode_duplicate(&i915->drm,
+					i915->vbt.sdvo_lvds_vbt_mode);
+	if (!fixed_mode)
+		return NULL;
+
+	/* Guarantee the mode is preferred */
+	fixed_mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
+
+	return fixed_mode;
+}
+
 /* adjusted_mode has been preset to be the panel's fixed mode */
 static int pch_panel_fitting(struct intel_crtc_state *crtc_state,
 			     const struct drm_connector_state *conn_state)
diff --git a/drivers/gpu/drm/i915/display/intel_panel.h b/drivers/gpu/drm/i915/display/intel_panel.h
index 9704ac81fe3e..7e32c903a1e6 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.h
+++ b/drivers/gpu/drm/i915/display/intel_panel.h
@@ -48,5 +48,7 @@ struct drm_display_mode *
 intel_panel_edid_fixed_mode(struct intel_connector *connector);
 struct drm_display_mode *
 intel_panel_vbt_lfp_fixed_mode(struct intel_connector *connector);
+struct drm_display_mode *
+intel_panel_vbt_sdvo_fixed_mode(struct intel_connector *connector);
 
 #endif /* __INTEL_PANEL_H__ */
diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
index a2061b132107..27b3d3a79989 100644
--- a/drivers/gpu/drm/i915/display/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
@@ -2301,16 +2301,10 @@ static int intel_sdvo_get_lvds_modes(struct drm_connector *connector)
 	 * Fetch modes from VBT. For SDVO prefer the VBT mode since some
 	 * SDVO->LVDS transcoders can't cope with the EDID mode.
 	 */
-	if (dev_priv->vbt.sdvo_lvds_vbt_mode != NULL) {
-		newmode = drm_mode_duplicate(connector->dev,
-					     dev_priv->vbt.sdvo_lvds_vbt_mode);
-		if (newmode != NULL) {
-			/* Guarantee the mode is preferred */
-			newmode->type = (DRM_MODE_TYPE_PREFERRED |
-					 DRM_MODE_TYPE_DRIVER);
-			drm_mode_probed_add(connector, newmode);
-			num_modes++;
-		}
+	newmode = intel_panel_vbt_sdvo_fixed_mode(to_intel_connector(connector));
+	if (newmode) {
+		drm_mode_probed_add(connector, newmode);
+		num_modes++;
 	}
 
 	/*
-- 
2.34.1


  parent reply	other threads:[~2022-03-23 18:29 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-23 18:29 [Intel-gfx] [PATCH 0/9] drm/i915: More fixed_mode refactoring Ville Syrjala
2022-03-23 18:29 ` [Intel-gfx] [PATCH 1/9] drm/i915: Pass intel_connector to intel_panel_{init, fini}() Ville Syrjala
2022-03-28 11:24   ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 2/9] drm/i915: Use DRM_MODE_FMT+DRM_MODE_ARG() Ville Syrjala
2022-03-28 11:26   ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 3/9] drm/i915: Extract intel_edp_add_properties() Ville Syrjala
2022-03-28 11:27   ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 4/9] drm/i915: Use intel_panel_preferred_fixed_mode() more Ville Syrjala
2022-03-28 11:28   ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 5/9] drm/i915: Rename intel_panel_vbt_fixed_mode() Ville Syrjala
2022-03-28 11:30   ` Jani Nikula
2022-03-23 18:29 ` Ville Syrjala [this message]
2022-03-28 11:31   ` [Intel-gfx] [PATCH 6/9] drm/i915: Extract intel_panel_vbt_sdvo_fixed_mode() Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 7/9] drm/i915: Extract intel_panel_encoder_fixed_mode() Ville Syrjala
2022-03-28 11:32   ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 8/9] drm/i915: Use intel_panel_edid_fixed_mode() for sdvo Ville Syrjala
2022-03-28 11:34   ` Jani Nikula
2022-03-23 18:29 ` [Intel-gfx] [PATCH 9/9] drm/i915: Change SDVO fixed mode handling Ville Syrjala
2022-03-28 11:35   ` Jani Nikula
2022-03-23 18:57 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for drm/i915: More fixed_mode refactoring Patchwork
2022-03-23 19:07   ` Ville Syrjälä
2022-03-23 19:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-23 20:30 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=20220323182935.4701-7-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox