From patchwork Thu Jul 22 05:43:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Souza, Jose" X-Patchwork-Id: 12393065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A3ACC63798 for ; Thu, 22 Jul 2021 05:39:28 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0587C60FED for ; Thu, 22 Jul 2021 05:39:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0587C60FED Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB7466E9E5; Thu, 22 Jul 2021 05:39:26 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BDE56E85E for ; Thu, 22 Jul 2021 05:39:25 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10052"; a="208456070" X-IronPort-AV: E=Sophos;i="5.84,260,1620716400"; d="scan'208";a="208456070" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2021 22:39:24 -0700 X-IronPort-AV: E=Sophos;i="5.84,260,1620716400"; d="scan'208";a="470415075" Received: from jkandi-mobl.amr.corp.intel.com (HELO josouza-mobl2.intel.com) ([10.209.170.189]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2021 22:39:24 -0700 From: =?utf-8?q?Jos=C3=A9_Roberto_de_Souza?= To: intel-gfx@lists.freedesktop.org Date: Wed, 21 Jul 2021 22:43:31 -0700 Message-Id: <20210722054338.12891-3-jose.souza@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210722054338.12891-1-jose.souza@intel.com> References: <20210722054338.12891-1-jose.souza@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 03/10] drm/i915/bios: Enable parse of two integrated panels timing data X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jani Nikula Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Continuing the conversion from single integrated VBT data to two. Cc: Ville Syrjälä Cc: Jani Nikula Signed-off-by: José Roberto de Souza --- 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 */