From patchwork Tue Dec 19 21:26:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 13499122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1A84FC41535 for ; Tue, 19 Dec 2023 21:28:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 039F110E1F2; Tue, 19 Dec 2023 21:28:05 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id CF5F210E1E3 for ; Tue, 19 Dec 2023 21:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703021284; x=1734557284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=okIAl2U+8vYyLqN7PFKgNhPhpq4ebkIJZBUMAITUWtw=; b=Z/YX7NWM/MaKGIO/Eea1sBQlQfei6wNDJk7N8alHMt+srUg74+ZoapSA oGwEvSjtJXJYG6Rupsp1nO5I0rgDciriyRVkhfc+nF7F09RkxdgE8t0Bg vlB7KvSFpqivbSmO3Vfa2iquGIJs48Xi6QFUbrRphI6v9rIcT0os4MPn9 hR3Wb5eu9VrUjkeDbuzfnJrp9KmibfCXlud+VFWNhu4cj7oBLTw43LtNx h+JGhw07nCmWdTEwKHigLsfBHkbL+s63vRcNIP7b0CEZmx6TEHe1Bfx4S C88kJUi9rKZf1I8NOaNlb2k6tyw4wtCmY/4COjF8o+vMW63z+60p1I/5t A==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="14413716" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="14413716" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 13:28:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="949308579" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="949308579" Received: from invictus.jf.intel.com ([10.165.21.201]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 13:28:03 -0800 From: Radhakrishna Sripada To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/3] drm/i915: Rename intel_bios_encoder_data_lookup as a port variant Date: Tue, 19 Dec 2023 13:26:27 -0800 Message-Id: <20231219212629.136868-2-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231219212629.136868-1-radhakrishna.sripada@intel.com> References: <20231219212629.136868-1-radhakrishna.sripada@intel.com> MIME-Version: 1.0 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: lucas.demarchi@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" intel_bios_encoder_data_lookup takes enum port as an argument. A variant based out of phy based lookup is required to be used out of vbt code which will be introduced in a later patch. Hence indicate the current variant as intel_bios_encoder_port_data_lookup. Signed-off-by: Radhakrishna Sripada --- drivers/gpu/drm/i915/display/g4x_dp.c | 2 +- drivers/gpu/drm/i915/display/g4x_hdmi.c | 2 +- drivers/gpu/drm/i915/display/intel_bios.c | 2 +- drivers/gpu/drm/i915/display/intel_bios.h | 2 +- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/display/g4x_dp.c index dfe0b07a122d..ecfa55d6f9f5 100644 --- a/drivers/gpu/drm/i915/display/g4x_dp.c +++ b/drivers/gpu/drm/i915/display/g4x_dp.c @@ -1298,7 +1298,7 @@ bool g4x_dp_init(struct drm_i915_private *dev_priv, if (!assert_port_valid(dev_priv, port)) return false; - devdata = intel_bios_encoder_data_lookup(dev_priv, port); + devdata = intel_bios_encoder_port_data_lookup(dev_priv, port); /* FIXME bail? */ if (!devdata) diff --git a/drivers/gpu/drm/i915/display/g4x_hdmi.c b/drivers/gpu/drm/i915/display/g4x_hdmi.c index 8096492b3fad..3aedbb6f13c8 100644 --- a/drivers/gpu/drm/i915/display/g4x_hdmi.c +++ b/drivers/gpu/drm/i915/display/g4x_hdmi.c @@ -697,7 +697,7 @@ void g4x_hdmi_init(struct drm_i915_private *dev_priv, if (!assert_hdmi_port_valid(dev_priv, port)) return; - devdata = intel_bios_encoder_data_lookup(dev_priv, port); + devdata = intel_bios_encoder_port_data_lookup(dev_priv, port); /* FIXME bail? */ if (!devdata) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index aa169b0055e9..febc607267f0 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -3636,7 +3636,7 @@ bool intel_bios_encoder_hpd_invert(const struct intel_bios_encoder_data *devdata } const struct intel_bios_encoder_data * -intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port) +intel_bios_encoder_port_data_lookup(struct drm_i915_private *i915, enum port port) { struct intel_bios_encoder_data *devdata; diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h index 49e24b7cf675..a296aad7f545 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.h +++ b/drivers/gpu/drm/i915/display/intel_bios.h @@ -255,7 +255,7 @@ bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port); const struct intel_bios_encoder_data * -intel_bios_encoder_data_lookup(struct drm_i915_private *i915, enum port port); +intel_bios_encoder_port_data_lookup(struct drm_i915_private *i915, enum port port); bool intel_bios_encoder_supports_dvi(const struct intel_bios_encoder_data *devdata); bool intel_bios_encoder_supports_hdmi(const struct intel_bios_encoder_data *devdata); diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 3dfca8d88a6f..76f1b8828df8 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -6155,7 +6155,7 @@ static bool _intel_dp_is_port_edp(struct drm_i915_private *dev_priv, bool intel_dp_is_port_edp(struct drm_i915_private *i915, enum port port) { const struct intel_bios_encoder_data *devdata = - intel_bios_encoder_data_lookup(i915, port); + intel_bios_encoder_port_data_lookup(i915, port); return _intel_dp_is_port_edp(i915, devdata, port); } From patchwork Tue Dec 19 21:26:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 13499120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 075F5C41535 for ; Tue, 19 Dec 2023 21:28:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 956C610E1DE; Tue, 19 Dec 2023 21:28:04 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id E82AC10E1F2 for ; Tue, 19 Dec 2023 21:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703021284; x=1734557284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=juiCeDb5F2Jw9pBJlfII033bxwSl5pGUNCcxgEbi78Q=; b=ZNc3gwYRbcr2R6Og5cf+74QQRN9hSjjtW2dI7cTGT16aGof9dAqEQowa KsSVURem6OM73HBR9tslDdfm6iXVXNGCiHcWvhLS6tBuEJZcbvUuIJ47n UXPx7eYR5UYrXkHSwgBELQKgGgW7GV0xnITHyjIi4LYqWdb2+g7JmlEOj 1fP/rZjjoBAZIZywNQGF+xwO1f4nBb7uOehGOEVlN/wUa4K2UEYLBKDVI kBpiTq5GZNqFjQV6PAd+W1e2CCOUCkUyzXM0XupgWeSF40IC7F1/0719t bT3cFNc+cCNT2sZyLjIxzrKHqn9roVrEmVb0KuXlxRgwD3AdLvDVXjL2L g==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="14413717" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="14413717" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 13:28:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="949308582" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="949308582" Received: from invictus.jf.intel.com ([10.165.21.201]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 13:28:03 -0800 From: Radhakrishna Sripada To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/3] drm/i915: Introduce intel_encoder_phy_data_lookup Date: Tue, 19 Dec 2023 13:26:28 -0800 Message-Id: <20231219212629.136868-3-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231219212629.136868-1-radhakrishna.sripada@intel.com> References: <20231219212629.136868-1-radhakrishna.sripada@intel.com> MIME-Version: 1.0 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: lucas.demarchi@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" This patch introduces phy version of intel_encoder_port_data_lookup. Port based variant is dependent on vbt child data extraction and conversion to port data to be used further. Port data is not immediately available and is difficult to be determined from phy info. Signed-off-by: Radhakrishna Sripada --- drivers/gpu/drm/i915/display/intel_bios.c | 13 +++++++++++++ drivers/gpu/drm/i915/display/intel_bios.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c index febc607267f0..0b21364b2bdf 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.c +++ b/drivers/gpu/drm/i915/display/intel_bios.c @@ -3648,6 +3648,19 @@ intel_bios_encoder_port_data_lookup(struct drm_i915_private *i915, enum port por return NULL; } +const struct intel_bios_encoder_data * +intel_bios_encoder_phy_data_lookup(struct drm_i915_private *i915, enum phy phy) +{ + struct intel_bios_encoder_data *devdata; + + list_for_each_entry(devdata, &i915->display.vbt.display_devices, node) { + if (intel_port_to_phy(i915, intel_bios_encoder_port(devdata)) == phy) + return devdata; + } + + return NULL; +} + void intel_bios_for_each_encoder(struct drm_i915_private *i915, void (*func)(struct drm_i915_private *i915, const struct intel_bios_encoder_data *devdata)) diff --git a/drivers/gpu/drm/i915/display/intel_bios.h b/drivers/gpu/drm/i915/display/intel_bios.h index a296aad7f545..2861ebb13909 100644 --- a/drivers/gpu/drm/i915/display/intel_bios.h +++ b/drivers/gpu/drm/i915/display/intel_bios.h @@ -39,6 +39,7 @@ struct intel_crtc_state; struct intel_encoder; struct intel_panel; enum aux_ch; +enum phy; enum port; enum intel_backlight_type { @@ -254,6 +255,8 @@ bool intel_bios_get_dsc_params(struct intel_encoder *encoder, bool intel_bios_port_supports_typec_usb(struct drm_i915_private *i915, enum port port); bool intel_bios_port_supports_tbt(struct drm_i915_private *i915, enum port port); +const struct intel_bios_encoder_data * +intel_bios_encoder_phy_data_lookup(struct drm_i915_private *i915, enum phy phy); const struct intel_bios_encoder_data * intel_bios_encoder_port_data_lookup(struct drm_i915_private *i915, enum port port); From patchwork Tue Dec 19 21:26:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sripada, Radhakrishna" X-Patchwork-Id: 13499121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8DDFEC46CA2 for ; Tue, 19 Dec 2023 21:28:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD89E10E1E3; Tue, 19 Dec 2023 21:28:04 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 01AD410E1DE for ; Tue, 19 Dec 2023 21:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703021284; x=1734557284; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/9Ue7OXq/E1mjYeSrSvjPu6x1vXQliA2qJCOlHnyhT4=; b=nCXh4HV8Pl1B9r2nNDZs/y17B+R38lqwaNjY2fBrrE3ZUldZXhYWaigq K8hFDRehyYEa4g+Yv/ma1vw5TpOHvPA2pnyPkR5fOfJArvN1dW606S+IQ dm/Pe14qxfr8+OboXgZ4pYsNqy1xltdP6SidNPdmQ91X+9YshZhKYQ7ol 9zzdlp6KymJ62wsO+GbnEfWdTIXuoBtCRscpdO0LUFvRZPLA/0lSEKbpB v/V8Ux0hZwxXHKWLdtHt5BNKPBlGkY4e5QRAGKjQpnmruPrcdlPg0v8yh 6CEAqg7kuzThHDPwf9SE7lxvDRQ9Yq5Z+POHC8eAS23E/6Xahk5hC6qHv Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="14413718" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="14413718" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 13:28:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10929"; a="949308585" X-IronPort-AV: E=Sophos;i="6.04,289,1695711600"; d="scan'208";a="949308585" Received: from invictus.jf.intel.com ([10.165.21.201]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 13:28:03 -0800 From: Radhakrishna Sripada To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/3] drm/i915: Separate tc check for legacy and non legacy tc phys Date: Tue, 19 Dec 2023 13:26:29 -0800 Message-Id: <20231219212629.136868-4-radhakrishna.sripada@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231219212629.136868-1-radhakrishna.sripada@intel.com> References: <20231219212629.136868-1-radhakrishna.sripada@intel.com> MIME-Version: 1.0 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: lucas.demarchi@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Starting MTL and DG2 if a phy is not marked as USB-typeC or TBT capable by vbt we should not consider it as a Legacy type-c phy. The concept of Legacy-tc existed in platforms from Icelake to Alder lake where an external FIA can be routed to one of the phy's thus making the phy tc capable without being marked in the vbt. Discrete cards have native ports and client products post MTL have a 1:1 mapping with type-C subsystem which is advertised by the bios. So rely on the vbt info regarding type-c capability. Signed-off-by: Radhakrishna Sripada --- drivers/gpu/drm/i915/display/intel_ddi.c | 2 +- drivers/gpu/drm/i915/display/intel_display.c | 29 ++++++++++++------- .../drm/i915/display/intel_display_device.h | 1 + 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c index 12a29363e5df..7d5b95f97d5f 100644 --- a/drivers/gpu/drm/i915/display/intel_ddi.c +++ b/drivers/gpu/drm/i915/display/intel_ddi.c @@ -5100,7 +5100,7 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, } if (intel_phy_is_tc(dev_priv, phy)) { - bool is_legacy = + bool is_legacy = HAS_LEGACY_TC(dev_priv) && !intel_bios_encoder_supports_typec_usb(devdata) && !intel_bios_encoder_supports_tbt(devdata); diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index b10aad15a63d..03006c9af824 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -1854,17 +1854,9 @@ bool intel_phy_is_combo(struct drm_i915_private *dev_priv, enum phy phy) return false; } -bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy) +static bool intel_phy_is_legacy_tc(struct drm_i915_private *dev_priv, enum phy phy) { - /* - * DG2's "TC1", although TC-capable output, doesn't share the same flow - * as other platforms on the display engine side and rather rely on the - * SNPS PHY, that is programmed separately - */ - if (IS_DG2(dev_priv)) - return false; - - if (DISPLAY_VER(dev_priv) >= 13) + if (DISPLAY_VER(dev_priv) == 13) return phy >= PHY_F && phy <= PHY_I; else if (IS_TIGERLAKE(dev_priv)) return phy >= PHY_D && phy <= PHY_I; @@ -1874,6 +1866,23 @@ bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy) return false; } +static bool intel_phy_is_vbt_tc(struct drm_i915_private *dev_priv, enum phy phy) +{ + const struct intel_bios_encoder_data *data = + intel_bios_encoder_phy_data_lookup(dev_priv, phy); + + return intel_bios_encoder_supports_typec_usb(data) && + intel_bios_encoder_supports_tbt(data); +} + +bool intel_phy_is_tc(struct drm_i915_private *dev_priv, enum phy phy) +{ + if (!HAS_LEGACY_TC(dev_priv)) + return intel_phy_is_vbt_tc(dev_priv, phy); + else + return intel_phy_is_legacy_tc(dev_priv, phy); +} + bool intel_phy_is_snps(struct drm_i915_private *dev_priv, enum phy phy) { /* diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h index fe4268813786..9450e263c873 100644 --- a/drivers/gpu/drm/i915/display/intel_display_device.h +++ b/drivers/gpu/drm/i915/display/intel_display_device.h @@ -58,6 +58,7 @@ struct drm_printer; #define HAS_IPS(i915) (IS_HASWELL_ULT(i915) || IS_BROADWELL(i915)) #define HAS_LRR(i915) (DISPLAY_VER(i915) >= 12) #define HAS_LSPCON(i915) (IS_DISPLAY_VER(i915, 9, 10)) +#define HAS_LEGACY_TC(i915) (IS_DISPLAY_VER(i915, 11, 13) && !IS_DGFX(i915)) #define HAS_MBUS_JOINING(i915) (IS_ALDERLAKE_P(i915) || DISPLAY_VER(i915) >= 14) #define HAS_MSO(i915) (DISPLAY_VER(i915) >= 12) #define HAS_OVERLAY(i915) (DISPLAY_INFO(i915)->has_overlay)