public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Jani Nikula <jani.nikula@intel.com>
Subject: [Intel-gfx] [PATCH 03/10] drm/i915/bios: Enable parse of two integrated panels timing data
Date: Wed, 21 Jul 2021 22:43:31 -0700	[thread overview]
Message-ID: <20210722054338.12891-3-jose.souza@intel.com> (raw)
In-Reply-To: <20210722054338.12891-1-jose.souza@intel.com>

Continuing the conversion from single integrated VBT data to two.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c    | 53 +++++++++++++-------
 drivers/gpu/drm/i915/display/intel_bios.h    |  1 +
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c |  7 ++-
 drivers/gpu/drm/i915/display/intel_panel.c   |  7 +--
 drivers/gpu/drm/i915/i915_drv.h              |  3 +-
 5 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 2b90efb41ecce..5906e9fa8f976 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -289,14 +289,15 @@ parse_panel_options(struct drm_i915_private *i915,
 /* Try to find integrated panel timing data */
 static void
 parse_lfp_panel_dtd(struct drm_i915_private *i915,
-		    const struct bdb_header *bdb)
+		    const struct bdb_header *bdb,
+		    struct ddi_vbt_port_info *info,
+		    int panel_index)
 {
 	const struct bdb_lvds_lfp_data *lvds_lfp_data;
 	const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;
 	const struct lvds_dvo_timing *panel_dvo_timing;
 	const struct lvds_fp_timing *fp_timing;
 	struct drm_display_mode *panel_fixed_mode;
-	int panel_type = i915->vbt.panel_type;
 
 	lvds_lfp_data = find_section(bdb, BDB_LVDS_LFP_DATA);
 	if (!lvds_lfp_data)
@@ -308,7 +309,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
 	panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
 					       lvds_lfp_data_ptrs,
-					       panel_type);
+					       panel_index);
 
 	panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
 	if (!panel_fixed_mode)
@@ -316,7 +317,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
 	fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing);
 
-	i915->vbt.lfp_lvds_vbt_mode = panel_fixed_mode;
+	info->lfp_lvds_vbt_mode = panel_fixed_mode;
 
 	drm_dbg_kms(&i915->drm,
 		    "Found panel mode in BIOS VBT legacy lfp table:\n");
@@ -324,7 +325,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
 	fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
 				       lvds_lfp_data_ptrs,
-				       panel_type);
+				       panel_index);
 	if (fp_timing) {
 		/* check the resolution, just to be sure */
 		if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
@@ -339,7 +340,9 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
 static void
 parse_generic_dtd(struct drm_i915_private *i915,
-		  const struct bdb_header *bdb)
+		  const struct bdb_header *bdb,
+		  struct ddi_vbt_port_info *info,
+		  int panel_index)
 {
 	const struct bdb_generic_dtd *generic_dtd;
 	const struct generic_dtd_entry *dtd;
@@ -363,14 +366,14 @@ parse_generic_dtd(struct drm_i915_private *i915,
 
 	num_dtd = (get_blocksize(generic_dtd) -
 		   sizeof(struct bdb_generic_dtd)) / generic_dtd->gdtd_size;
-	if (i915->vbt.panel_type >= num_dtd) {
+	if (panel_index >= num_dtd) {
 		drm_err(&i915->drm,
-			"Panel type %d not found in table of %d DTD's\n",
-			i915->vbt.panel_type, num_dtd);
+			"Panel index %d not found in table of %d DTD's\n",
+			panel_index, num_dtd);
 		return;
 	}
 
-	dtd = &generic_dtd->dtd[i915->vbt.panel_type];
+	dtd = &generic_dtd->dtd[panel_index];
 
 	panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
 	if (!panel_fixed_mode)
@@ -413,12 +416,14 @@ parse_generic_dtd(struct drm_i915_private *i915,
 		    "Found panel mode in BIOS VBT generic dtd table:\n");
 	drm_mode_debug_printmodeline(panel_fixed_mode);
 
-	i915->vbt.lfp_lvds_vbt_mode = panel_fixed_mode;
+	info->lfp_lvds_vbt_mode = panel_fixed_mode;
 }
 
 static void
 parse_panel_dtd(struct drm_i915_private *i915,
-		const struct bdb_header *bdb)
+		const struct bdb_header *bdb,
+		struct ddi_vbt_port_info *info,
+		int panel_index)
 {
 	/*
 	 * Older VBTs provided provided DTD information for internal displays
@@ -429,9 +434,9 @@ parse_panel_dtd(struct drm_i915_private *i915,
 	 * back to trying the old LFP block if that fails.
 	 */
 	if (bdb->version >= 229)
-		parse_generic_dtd(i915, bdb);
-	if (!i915->vbt.lfp_lvds_vbt_mode)
-		parse_lfp_panel_dtd(i915, bdb);
+		parse_generic_dtd(i915, bdb, info, panel_index);
+	if (!info->lfp_lvds_vbt_mode)
+		parse_lfp_panel_dtd(i915, bdb, info, panel_index);
 }
 
 static void
@@ -1981,6 +1986,7 @@ static void parse_integrated_panel(struct drm_i915_private *i915,
 	parse_panel_options(i915, bdb, info, panel_index);
 	parse_power_conservation_features(i915, bdb, info, panel_index);
 	parse_driver_features_drrs_only(i915, bdb, info);
+	parse_panel_dtd(i915, bdb, info, panel_index);
 }
 
 static void parse_ddi_port(struct drm_i915_private *i915,
@@ -2475,7 +2481,6 @@ void intel_bios_init(struct drm_i915_private *i915)
 	parse_general_features(i915, bdb);
 	parse_general_definitions(i915, bdb);
 	parse_panel_type(i915, bdb);
-	parse_panel_dtd(i915, bdb);
 	parse_lfp_backlight(i915, bdb);
 	parse_sdvo_panel_data(i915, bdb);
 	parse_driver_features(i915, bdb);
@@ -2508,6 +2513,7 @@ void intel_bios_init(struct drm_i915_private *i915)
 void intel_bios_driver_remove(struct drm_i915_private *i915)
 {
 	struct intel_bios_encoder_data *devdata, *n;
+	int i;
 
 	list_for_each_entry_safe(devdata, n, &i915->vbt.display_devices, node) {
 		list_del(&devdata->node);
@@ -2515,10 +2521,13 @@ void intel_bios_driver_remove(struct drm_i915_private *i915)
 		kfree(devdata);
 	}
 
+	for (i = 0; i < I915_MAX_PORTS; i++) {
+		kfree(i915->vbt.ddi_port_info[i].lfp_lvds_vbt_mode);
+		i915->vbt.ddi_port_info[i].lfp_lvds_vbt_mode = NULL;
+	}
+
 	kfree(i915->vbt.sdvo_lvds_vbt_mode);
 	i915->vbt.sdvo_lvds_vbt_mode = NULL;
-	kfree(i915->vbt.lfp_lvds_vbt_mode);
-	i915->vbt.lfp_lvds_vbt_mode = NULL;
 	kfree(i915->vbt.dsi.data);
 	i915->vbt.dsi.data = NULL;
 	kfree(i915->vbt.dsi.pps);
@@ -3106,3 +3115,11 @@ intel_bios_drrs_type(struct intel_encoder *encoder)
 
 	return i915->vbt.ddi_port_info[encoder->port].drrs_type;
 }
+
+const struct drm_display_mode *
+intel_bios_lfp_lvds_info(struct intel_encoder *encoder)
+{
+	struct drm_i915_private *i915 = to_i915(encoder->base.dev);
+
+	return i915->vbt.ddi_port_info[encoder->port].lfp_lvds_vbt_mode;
+}
diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h
index bad282b64c5e6..f133c51c155cd 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.h
+++ b/drivers/gpu/drm/i915/display/intel_bios.h
@@ -267,5 +267,6 @@ int intel_bios_encoder_dp_boost_level(const struct intel_bios_encoder_data *devd
 int intel_bios_encoder_hdmi_boost_level(const struct intel_bios_encoder_data *devdata);
 
 enum drrs_support_type intel_bios_drrs_type(struct intel_encoder *encoder);
+const struct drm_display_mode *intel_bios_lfp_lvds_info(struct intel_encoder *encoder);
 
 #endif /* _INTEL_BIOS_H_ */
diff --git a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
index c2a2cd1f84dc5..2218de0773bf0 100644
--- a/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
+++ b/drivers/gpu/drm/i915/display/intel_dsi_vbt.c
@@ -729,10 +729,15 @@ bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
 	struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
-	struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
+	const struct drm_display_mode *mode = intel_bios_lfp_lvds_info(&intel_dsi->base);
 	u16 burst_mode_ratio;
 	enum port port;
 
+	if (!mode) {
+		drm_dbg_kms(&dev_priv->drm, "lfp_lvds_vbt_mode not set\n");
+		return false;
+	}
+
 	drm_dbg_kms(&dev_priv->drm, "\n");
 
 	intel_dsi->eotp_pkt = mipi_config->eot_pkt_disabled ? 0 : 1;
diff --git a/drivers/gpu/drm/i915/display/intel_panel.c b/drivers/gpu/drm/i915/display/intel_panel.c
index 7d7a60b4d2de7..a88e30c966fe7 100644
--- a/drivers/gpu/drm/i915/display/intel_panel.c
+++ b/drivers/gpu/drm/i915/display/intel_panel.c
@@ -153,12 +153,13 @@ intel_panel_vbt_fixed_mode(struct intel_connector *connector)
 	struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
 	struct drm_display_info *info = &connector->base.display_info;
 	struct drm_display_mode *fixed_mode;
+	const struct drm_display_mode *lfp_lvds_vbt_mode;
 
-	if (!dev_priv->vbt.lfp_lvds_vbt_mode)
+	lfp_lvds_vbt_mode = intel_bios_lfp_lvds_info(connector->encoder);
+	if (!lfp_lvds_vbt_mode)
 		return NULL;
 
-	fixed_mode = drm_mode_duplicate(&dev_priv->drm,
-					dev_priv->vbt.lfp_lvds_vbt_mode);
+	fixed_mode = drm_mode_duplicate(&dev_priv->drm, lfp_lvds_vbt_mode);
 	if (!fixed_mode)
 		return NULL;
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index d990ceb23c85e..62a0c1f64f870 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -658,6 +658,8 @@ struct ddi_vbt_port_info {
 	int dp_max_link_rate;		/* 0 for not limited by VBT */
 
 	enum drrs_support_type drrs_type;
+
+	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
 };
 
 enum psr_lines_to_wait {
@@ -671,7 +673,6 @@ struct intel_vbt_data {
 	/* bdb version */
 	u16 version;
 
-	struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
 	struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
 
 	/* Feature bits */
-- 
2.32.0

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

  parent reply	other threads:[~2021-07-22  5:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  5:43 [Intel-gfx] [PATCH 01/10] drm/i915/bios: Allow DSI ports to be parsed by parse_ddi_port() José Roberto de Souza
2021-07-22  5:43 ` [Intel-gfx] [PATCH 02/10] drm/i915/bios: Start to support two integrated panels José Roberto de Souza
2021-07-26 21:33   ` Matt Atwood
2021-08-16 10:09   ` Jani Nikula
2021-08-16 19:52     ` Ville Syrjälä
2021-07-22  5:43 ` José Roberto de Souza [this message]
2021-07-26 21:36   ` [Intel-gfx] [PATCH 03/10] drm/i915/bios: Enable parse of two integrated panels timing data Matt Atwood
2021-07-22  5:43 ` [Intel-gfx] [PATCH 04/10] drm/i915/bios: Enable parse of two integrated panels backlight data José Roberto de Souza
2021-07-26 22:12   ` Matt Atwood
2021-07-22  5:43 ` [Intel-gfx] [PATCH 05/10] drm/i915/bios: Enable parse of two integrated panels eDP data José Roberto de Souza
2021-07-27 21:15   ` Matt Atwood
2021-08-17  8:08   ` Jani Nikula
2021-07-22  5:43 ` [Intel-gfx] [PATCH 06/10] drm/i915/bios: Enable parse of two integrated panels PSR data José Roberto de Souza
2021-07-27 22:53   ` Matt Atwood
2021-07-22  5:43 ` [Intel-gfx] [PATCH 07/10] drm/i915/bios: Enable parse of two DSI panels data José Roberto de Souza
2021-07-28 15:19   ` Matt Atwood
2021-07-22  5:43 ` [Intel-gfx] [PATCH 08/10] drm/i915/bios: Nuke panel_type José Roberto de Souza
2021-07-28 15:21   ` Matt Atwood
2021-07-22  5:43 ` [Intel-gfx] [PATCH 09/10] drm/i915/bios: Only use opregion panel index for display ver 8 and older José Roberto de Souza
2021-07-28 15:22   ` Matt Atwood
2021-08-16 19:39   ` Ville Syrjälä
2021-07-22  5:43 ` [Intel-gfx] [PATCH 10/10] drm/i915/display/tgl+: Use PPS index from vbt José Roberto de Souza
2021-07-28 15:23   ` Matt Atwood
2021-07-22  6:06 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915/bios: Allow DSI ports to be parsed by parse_ddi_port() Patchwork
2021-07-22  6:08 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-07-22  6:37 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2021-07-22 19:46 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/10] drm/i915/bios: Allow DSI ports to be parsed by parse_ddi_port() (rev2) Patchwork
2021-07-22 19:48 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-07-22 20:16 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-07-23  0:01 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2021-07-26 21:21 ` [Intel-gfx] [PATCH 01/10] drm/i915/bios: Allow DSI ports to be parsed by parse_ddi_port() Matt Atwood
2021-07-26 22:23 ` Matt Atwood
2021-08-16  9:59 ` Jani Nikula

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=20210722054338.12891-3-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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