From patchwork Wed Mar 17 16:36:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 12146411 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,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 CEBE1C433DB for ; Wed, 17 Mar 2021 16:37:18 +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 53E0A64F18 for ; Wed, 17 Mar 2021 16:37:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 53E0A64F18 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 E32EB6E839; Wed, 17 Mar 2021 16:37:17 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C51D6E839 for ; Wed, 17 Mar 2021 16:37:16 +0000 (UTC) IronPort-SDR: 6VEnYlLruUP6nUEbHeY0epgQomM9q99x/IgEqFPFE/Yqc0+YuXzNn6zcnmo0fsb295GU7wb+f/ QnWIu7bSXfCw== X-IronPort-AV: E=McAfee;i="6000,8403,9926"; a="176632606" X-IronPort-AV: E=Sophos;i="5.81,256,1610438400"; d="scan'208";a="176632606" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 09:37:14 -0700 IronPort-SDR: h6jLBjsRZeAbPI3fS8U5bMfr0Viplvc/D+MMRFXrOzBVVQEVzy5GeF/zi7UP1bVb0Jvt75Lxj7 fNhVXJQh7W5A== X-IronPort-AV: E=Sophos;i="5.81,256,1610438400"; d="scan'208";a="412717208" Received: from jpferrer-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.46.99]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 09:37:12 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Date: Wed, 17 Mar 2021 18:36:41 +0200 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v2 02/14] drm/i915/bios: store bdb version in i915 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@intel.com, lucas.demarchi@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We'll be needing the version in more places in the future, so avoid the need to pass it around. No functional changes. v2: Rebased Cc: Lucas De Marchi Cc: Ville Syrjälä Reviewed-by: Ville Syrjälä # v1 Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_bios.c | 30 +++++++++++------------ drivers/gpu/drm/i915/i915_drv.h | 3 +++ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index 6e4650a7c604..824148063451 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -597,7 +597,7 @@ child_device_ptr(const struct bdb_general_definitions *defs, int i) } static void -parse_sdvo_device_mapping(struct drm_i915_private *i915, u8 bdb_version) +parse_sdvo_device_mapping(struct drm_i915_private *i915) { struct sdvo_device_mapping *mapping; const struct display_device_data *devdata; @@ -1798,8 +1798,7 @@ static int parse_bdb_216_dp_max_link_rate(const int vbt_max_link_rate) } static void parse_ddi_port(struct drm_i915_private *i915, - struct display_device_data *devdata, - u8 bdb_version) + struct display_device_data *devdata) { const struct child_device_config *child = &devdata->child; struct ddi_vbt_port_info *info; @@ -1838,10 +1837,10 @@ static void parse_ddi_port(struct drm_i915_private *i915, info->supports_dp = is_dp; info->supports_edp = is_edp; - if (bdb_version >= 195) + if (i915->vbt.version >= 195) info->supports_typec_usb = child->dp_usb_type_c; - if (bdb_version >= 209) + if (i915->vbt.version >= 209) info->supports_tbt = child->tbt; drm_dbg_kms(&i915->drm, @@ -1872,7 +1871,7 @@ static void parse_ddi_port(struct drm_i915_private *i915, sanitize_aux_ch(i915, port); } - if (bdb_version >= 158) { + if (i915->vbt.version >= 158) { /* The VBT HDMI level shift values match the table we have. */ u8 hdmi_level_shift = child->hdmi_level_shifter_value; drm_dbg_kms(&i915->drm, @@ -1883,7 +1882,7 @@ static void parse_ddi_port(struct drm_i915_private *i915, info->hdmi_level_shift_set = true; } - if (bdb_version >= 204) { + if (i915->vbt.version >= 204) { int max_tmds_clock; switch (child->hdmi_max_data_rate) { @@ -1909,7 +1908,7 @@ static void parse_ddi_port(struct drm_i915_private *i915, } /* Parse the I_boost config for SKL and above */ - if (bdb_version >= 196 && child->iboost) { + if (i915->vbt.version >= 196 && child->iboost) { info->dp_boost_level = translate_iboost(child->dp_iboost_level); drm_dbg_kms(&i915->drm, "Port %c VBT (e)DP boost level: %d\n", @@ -1921,8 +1920,8 @@ static void parse_ddi_port(struct drm_i915_private *i915, } /* DP max link rate for CNL+ */ - if (bdb_version >= 216) { - if (bdb_version >= 230) + if (i915->vbt.version >= 216) { + if (i915->vbt.version >= 230) info->dp_max_link_rate = parse_bdb_230_dp_max_link_rate(child->dp_max_link_rate); else info->dp_max_link_rate = parse_bdb_216_dp_max_link_rate(child->dp_max_link_rate); @@ -1935,18 +1934,18 @@ static void parse_ddi_port(struct drm_i915_private *i915, info->child = child; } -static void parse_ddi_ports(struct drm_i915_private *i915, u8 bdb_version) +static void parse_ddi_ports(struct drm_i915_private *i915) { struct display_device_data *devdata; if (!HAS_DDI(i915) && !IS_CHERRYVIEW(i915)) return; - if (bdb_version < 155) + if (i915->vbt.version < 155) return; list_for_each_entry(devdata, &i915->vbt.display_devices, node) - parse_ddi_port(i915, devdata, bdb_version); + parse_ddi_port(i915, devdata); } static void @@ -2257,6 +2256,7 @@ void intel_bios_init(struct drm_i915_private *i915) } bdb = get_bdb_header(vbt); + i915->vbt.version = bdb->version; drm_dbg_kms(&i915->drm, "VBT signature \"%.*s\", BDB version %d\n", @@ -2280,8 +2280,8 @@ void intel_bios_init(struct drm_i915_private *i915) parse_compression_parameters(i915, bdb); /* Further processing on pre-parsed data */ - parse_sdvo_device_mapping(i915, bdb->version); - parse_ddi_ports(i915, bdb->version); + parse_sdvo_device_mapping(i915); + parse_ddi_ports(i915); out: if (!vbt) { diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 1d45d7492d10..26f7dc71abfd 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -615,6 +615,9 @@ enum psr_lines_to_wait { }; 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 */