From patchwork Tue Sep 24 07:36:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1988796 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XCWsF3jTxz1xsw for ; Tue, 24 Sep 2024 17:37:05 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1st06S-0003gF-FV; Tue, 24 Sep 2024 07:36:56 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1st06Q-0003fU-HD for kernel-team@lists.ubuntu.com; Tue, 24 Sep 2024 07:36:54 +0000 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 132D03F129 for ; Tue, 24 Sep 2024 07:36:54 +0000 (UTC) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2053f4938c7so45621955ad.2 for ; Tue, 24 Sep 2024 00:36:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727163412; x=1727768212; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WHFtXmxe31Za3eom1WUOeSu4eRzvc31KA9vHBoVyvXc=; b=OAFsPbjoyXOttXnTkuO+Sn2gI0SoJmAxFqxhpPWXpsth64TVquepdnrR9hDU2cv2wV xzN6f94YDWuS+AQG9ygpTNuWF3Q6FN675Wp7MqjuOzPrNSpS1hyUcFvw2wNSMKqnfWM9 m/8IxD8hbex9KTggVYX1bsVBRWWeO5SDmATkiypbyan9DhmWAdDl/nRYGx4uLk2hCAnM Mwx/Cec8ob8nFbq4CNUsvZd/MBo9NA8DMnPbkAXATQbXcKbp90Uy4TS0eT/AcH1cx2XJ p4Xp2dbPLPNlJK+tb3b59dlEM67SjKQ0G2W67PnTNzHeGsNSjFCTxMa6NDpSq4RavfhU W5rQ== X-Gm-Message-State: AOJu0YxRXgN1wZ3xExPTSkr/D4fHT5KjMpm3DzGOWrRMXPDPfHA1Ktp3 bXROxq9VamiWJPwLF005eqovw3ZDS8jMtSDFrRuDQ3YJwSreho1YhLwj25xFYsRk8esmQT+Ot4o n0HgPt4Hn/1uLPHU+R5WQlH0tdB7695eFAZ/sqKgAfUhN98I5HS0cybd8Js7TdLnO8GnnRVd47b 1GcjhZ4vboSA== X-Received: by 2002:a17:902:f546:b0:205:5de3:b964 with SMTP id d9443c01a7336-208d97f3450mr211297345ad.5.1727163412280; Tue, 24 Sep 2024 00:36:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXBTzUxUNLovI9qiLu2lgrALbPNE8Zgrb7NFSxB+4PoXE/ujHlifWu0g4AvniwLRwiPncjeg== X-Received: by 2002:a17:902:f546:b0:205:5de3:b964 with SMTP id d9443c01a7336-208d97f3450mr211297195ad.5.1727163411825; Tue, 24 Sep 2024 00:36:51 -0700 (PDT) Received: from localhost.localdomain (114-36-223-64.dynamic-ip.hinet.net. [114.36.223.64]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20af1863562sm5581595ad.298.2024.09.24.00.36.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 00:36:51 -0700 (PDT) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 1/3] drm/i915/display: add generic to_intel_display() macro Date: Tue, 24 Sep 2024 15:36:44 +0800 Message-Id: <20240924073646.1036150-2-chris.chiu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924073646.1036150-1-chris.chiu@canonical.com> References: <20240924073646.1036150-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jani Nikula BugLink: https://bugs.launchpad.net/bugs/2081786 Convert various pointers to struct intel_display * using _Generic(). Add some macro magic to make adding new conversions easier, and somewhat abstract the need to cast each generic association. The cast is required because all associations needs to compile, regardless of the type and the generic selection. The use of *p in the generic selection assignment expression removes the need to add separate associations for const pointers. Note: This intentionally does *not* cover struct drm_i915_private or struct xe_device. They are not to be used in the long run, so avoid using this macro for them. Reviewed-by: Rodrigo Vivi Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/02cf407961200db4379370856c779ea62b3eaa90.1713358679.git.jani.nikula@intel.com (cherry picked from commit 8d7077f53e6051ac284d642341db84f01625904b) Signed-off-by: Chris Chiu --- .../drm/i915/display/intel_display_types.h | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h index 1b754edb4ad7..f106f5958c00 100644 --- a/drivers/gpu/drm/i915/display/intel_display_types.h +++ b/drivers/gpu/drm/i915/display/intel_display_types.h @@ -2161,4 +2161,41 @@ static inline int to_bpp_x16(int bpp) return bpp << 4; } +/* + * Conversion functions/macros from various pointer types to struct + * intel_display pointer. + */ +#define __drm_device_to_intel_display(p) \ + (&to_i915(p)->display) +#define __intel_connector_to_intel_display(p) \ + __drm_device_to_intel_display((p)->base.dev) +#define __intel_crtc_to_intel_display(p) \ + __drm_device_to_intel_display((p)->base.dev) +#define __intel_crtc_state_to_intel_display(p) \ + __drm_device_to_intel_display((p)->uapi.crtc->dev) +#define __intel_digital_port_to_intel_display(p) \ + __drm_device_to_intel_display((p)->base.base.dev) +#define __intel_dp_to_intel_display(p) \ + __drm_device_to_intel_display(dp_to_dig_port(p)->base.base.dev) +#define __intel_encoder_to_intel_display(p) \ + __drm_device_to_intel_display((p)->base.dev) +#define __intel_hdmi_to_intel_display(p) \ + __drm_device_to_intel_display(hdmi_to_dig_port(p)->base.base.dev) + +/* Helper for generic association. Map types to conversion functions/macros. */ +#define __assoc(type, p) \ + struct type: __##type##_to_intel_display((struct type *)(p)) + +/* Convert various pointer types to struct intel_display pointer. */ +#define to_intel_display(p) \ + _Generic(*p, \ + __assoc(drm_device, p), \ + __assoc(intel_connector, p), \ + __assoc(intel_crtc, p), \ + __assoc(intel_crtc_state, p), \ + __assoc(intel_digital_port, p), \ + __assoc(intel_dp, p), \ + __assoc(intel_encoder, p), \ + __assoc(intel_hdmi, p)) + #endif /* __INTEL_DISPLAY_TYPES_H__ */ From patchwork Tue Sep 24 07:36:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1988798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XCWsF505Cz1xsx for ; Tue, 24 Sep 2024 17:37:05 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1st06T-0003gq-NI; Tue, 24 Sep 2024 07:36:57 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1st06R-0003fl-4R for kernel-team@lists.ubuntu.com; Tue, 24 Sep 2024 07:36:55 +0000 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id E9A393F129 for ; Tue, 24 Sep 2024 07:36:54 +0000 (UTC) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2052d07ff07so52634045ad.2 for ; Tue, 24 Sep 2024 00:36:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727163413; x=1727768213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r1eZuJfashoJ1WFpYXdSEH85L+z4rlRzMtHdIL/1D7Y=; b=M+/dtPS7R3kM3lMSrNw/biZ+cpCZn3KAc/R+JvvArejI4x11/t4VYoWdJfj3xwMonZ G6piFhPGn6vsAf9lKAMdAkU6iMt70oZxVi5454sxGuSpC1PAErsDEtn74gJuIR3JAJzd jv4MR2cTBst1czRgZpWVNf0MUtalheYh5Tj1mMN+mnqyVlpcWVbMCKh+6GEh6grmoOBb PBenIAMm+5z/ywrw14UA/J5BYHFl4RYpLoHe+DS+vDtKPZ3kWtIZrhzauXCPu5gBaTpL lIc+XkA+gHBU9Rt6mgG3jaz9OsmbnGxMoNZ8zFBbSk4TArWoy8KoH3oX7Lg5Zz6CbcTu mDFA== X-Gm-Message-State: AOJu0YwmdWyOqUlNd0t3ODrDfR4fRShhDtBPoGh7XspCyr2vxH5HW8+p 1MDnV2TVq5Xfomq2HQg9tIfdUpcWPFNj+shZYaa9NW/4Zm6EE+RZ0Kd9D4dFpxds9fhiMilrs1L 2aomU5kQ4Rh/p5kib17qlDDv5vUgAvcHfu9Uwy8FPsRRA82hEuplyQ/xP7N+bCVl51094Pnpxt0 y3N5aAYM9Mxg== X-Received: by 2002:a17:902:ce0b:b0:206:96bf:b0cf with SMTP id d9443c01a7336-208d80e3845mr244489945ad.0.1727163413367; Tue, 24 Sep 2024 00:36:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMZ4VUNpH7b7IuKyd+Ou6kj/QilVaWtR4ck4dEqGwcMj2S2PdtLsS6crdHAiTS2IKBFILTJg== X-Received: by 2002:a17:902:ce0b:b0:206:96bf:b0cf with SMTP id d9443c01a7336-208d80e3845mr244489785ad.0.1727163412964; Tue, 24 Sep 2024 00:36:52 -0700 (PDT) Received: from localhost.localdomain (114-36-223-64.dynamic-ip.hinet.net. [114.36.223.64]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20af1863562sm5581595ad.298.2024.09.24.00.36.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 00:36:52 -0700 (PDT) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 2/3] drm/i915/display: add intel_display -> drm_device backpointer Date: Tue, 24 Sep 2024 15:36:45 +0800 Message-Id: <20240924073646.1036150-3-chris.chiu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924073646.1036150-1-chris.chiu@canonical.com> References: <20240924073646.1036150-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jani Nikula BugLink: https://bugs.launchpad.net/bugs/2081786 As a baby step towards making struct intel_display the main data structure for display, add a backpointer to struct drm_device that can be used instead of &i915->drm. Reviewed-by: Rodrigo Vivi Signed-off-by: Jani Nikula Link: https://patchwork.freedesktop.org/patch/msgid/47dd7bc4aae3c10b18097824e37617c072c66c0b.1713358679.git.jani.nikula@intel.com (cherry picked from commit f02fedd882f8e619016f9089f72483b5a6c59c7f) Signed-off-by: Chris Chiu --- drivers/gpu/drm/i915/display/intel_display_core.h | 3 +++ drivers/gpu/drm/i915/display/intel_display_device.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h index 47297ed85822..0a25f21f7922 100644 --- a/drivers/gpu/drm/i915/display/intel_display_core.h +++ b/drivers/gpu/drm/i915/display/intel_display_core.h @@ -271,6 +271,9 @@ struct intel_wm { }; struct intel_display { + /* drm device backpointer */ + struct drm_device *drm; + /* Display functions */ struct { /* Top level crtc-ish functions */ diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c index 0b522c6a8d6f..bbb6fb581003 100644 --- a/drivers/gpu/drm/i915/display/intel_display_device.c +++ b/drivers/gpu/drm/i915/display/intel_display_device.c @@ -922,6 +922,9 @@ void intel_display_device_probe(struct drm_i915_private *i915) const struct intel_display_device_info *info; u16 ver, rel, step; + /* Add drm device backpointer as early as possible. */ + i915->display.drm = &i915->drm; + if (HAS_GMD_ID(i915)) info = probe_gmdid_display(i915, &ver, &rel, &step); else From patchwork Tue Sep 24 07:36:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1988799 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XCWsL10jHz1xst for ; Tue, 24 Sep 2024 17:37:10 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1st06Y-0003k2-JF; Tue, 24 Sep 2024 07:37:02 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1st06S-0003g7-9V for kernel-team@lists.ubuntu.com; Tue, 24 Sep 2024 07:36:56 +0000 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 223673F129 for ; Tue, 24 Sep 2024 07:36:56 +0000 (UTC) Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-206f405f453so54486235ad.1 for ; Tue, 24 Sep 2024 00:36:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727163414; x=1727768214; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x/0rXFu0KBcNgdfrDPwXeTDxAr5wKn/x3L6M22BlqJE=; b=cteqruxdQjrshiDYcXwF+gCwE929NUQ/THQOGqbkmKTYXQUs/OhmCnXcqeQP9HfmXi KUjMZE4p/NryrfqAaFlMQlGUQqeRYODSzw6n0KYPMVYFdpvZK2bMV2aFmvJLHyj83G3X F9xKmgDX0llDMQ5GupYuDrSc5Olic0rVk0LvpKpls5L4tWrEAZsnTgfU/PoxT3HYfcnf +AZRiOksU7GEXE0oxu3+mkcW8M996JtbNxEO/gksgtAsuKe5ItnbCB4AzZCRiGOyakc6 kElOuSRifPUXTDB1CDj7n3StmDhQe0haoQQSsvMntb/cTk1XE/HQthAzKjjMsilW3prS nYww== X-Gm-Message-State: AOJu0Yy5Fxoq7VP9o4T/GX1PSEHjIeXYNkpWDOIP/q9iRF1iMXUvqkwb 1A49Lf9ZsRZkp4Z5r2jg3VmpPnvJCjmeVuc7WmuuhIRWKSUB9ryqlqKJDFLJR5/v+vRPI1vRdhT MUEEirfLnF8KsJIGEkMg1lQdJob28K3BGYfFl3bZwo3kpSSjBE9CJbLxNh0Gt1EoZp9enh1i3Ti P6yeDjLhAHGw== X-Received: by 2002:a17:902:6b02:b0:206:c776:4f04 with SMTP id d9443c01a7336-208d83fcc22mr155324735ad.42.1727163414480; Tue, 24 Sep 2024 00:36:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwIb4iH8vSMTZ19M4w4+y/kufn2vXkem3MFwrJ4aEQYL2E7yad2QJtrfNqgx6fZjlvbs7h2A== X-Received: by 2002:a17:902:6b02:b0:206:c776:4f04 with SMTP id d9443c01a7336-208d83fcc22mr155324605ad.42.1727163413995; Tue, 24 Sep 2024 00:36:53 -0700 (PDT) Received: from localhost.localdomain (114-36-223-64.dynamic-ip.hinet.net. [114.36.223.64]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20af1863562sm5581595ad.298.2024.09.24.00.36.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2024 00:36:53 -0700 (PDT) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [SRU][N][PATCH 3/3] drm/i915/dp_mst: Fix MST state after a sink reset Date: Tue, 24 Sep 2024 15:36:46 +0800 Message-Id: <20240924073646.1036150-4-chris.chiu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240924073646.1036150-1-chris.chiu@canonical.com> References: <20240924073646.1036150-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Imre Deak BugLink: https://bugs.launchpad.net/bugs/2081786 In some cases the sink can reset itself after it was configured into MST mode, without the driver noticing the disconnected state. For instance the reset may happen in the middle of a modeset, or the (long) HPD pulse generated may be not long enough for the encoder detect handler to observe the HPD's deasserted state. In this case the sink's DPCD register programmed to enable MST will be reset, while the driver still assumes MST is still enabled. Detect this condition, which will tear down and recreate/re-enable the MST topology. v2: - Add a code comment about adjusting the expected DP_MSTM_CTRL register value for SST + SideBand. (Suraj, Jani) - Print a debug message about detecting the link reset. (Jani) - Verify the DPCD MST state only if it wasn't already determined that the sink is disconnected. Cc: stable@vger.kernel.org Cc: Jani Nikula Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11195 Reviewed-by: Suraj Kandpal (v1) Signed-off-by: Imre Deak Link: https://patchwork.freedesktop.org/patch/msgid/20240823162918.1211875-1-imre.deak@intel.com (backported from commit 594cf78dc36f31c0c7e0de4567e644f406d46bae) [Chris Chiu: remove un-necessary intel_dp_mst_prepare_probe()] Signed-off-by: Chris Chiu --- drivers/gpu/drm/i915/display/intel_dp.c | 12 +++++++ drivers/gpu/drm/i915/display/intel_dp_mst.c | 40 +++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_dp_mst.h | 1 + 3 files changed, 53 insertions(+) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 75a5ace58b80..424b449ddd13 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5702,6 +5702,18 @@ intel_dp_detect(struct drm_connector *connector, else status = connector_status_disconnected; + if (status != connector_status_disconnected && + !intel_dp_mst_verify_dpcd_state(intel_dp)) + /* + * This requires retrying detection for instance to re-enable + * the MST mode that got reset via a long HPD pulse. The retry + * will happen either via the hotplug handler's retry logic, + * ensured by setting the connector here to SST/disconnected, + * or via a userspace connector probing in response to the + * hotplug uevent sent when removing the MST connectors. + */ + status = connector_status_disconnected; + if (status == connector_status_disconnected) { memset(&intel_dp->compliance, 0, sizeof(intel_dp->compliance)); memset(intel_connector->dp.dsc_dpcd, 0, sizeof(intel_connector->dp.dsc_dpcd)); diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index e0f171012fcb..c64f82557233 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -1872,3 +1872,43 @@ bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state, return false; } + +/* + * intel_dp_mst_verify_dpcd_state - verify the MST SW enabled state wrt. the DPCD + * @intel_dp: DP port object + * + * Verify if @intel_dp's MST enabled SW state matches the corresponding DPCD + * state. A long HPD pulse - not long enough to be detected as a disconnected + * state - could've reset the DPCD state, which requires tearing + * down/recreating the MST topology. + * + * Returns %true if the SW MST enabled and DPCD states match, %false + * otherwise. + */ +bool intel_dp_mst_verify_dpcd_state(struct intel_dp *intel_dp) +{ + struct intel_display *display = to_intel_display(intel_dp); + struct intel_connector *connector = intel_dp->attached_connector; + struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp); + struct intel_encoder *encoder = &dig_port->base; + int ret; + u8 val; + + if (!intel_dp->is_mst) + return true; + + ret = drm_dp_dpcd_readb(intel_dp->mst_mgr.aux, DP_MSTM_CTRL, &val); + + /* Adjust the expected register value for SST + SideBand. */ + if (ret < 0 || val != (DP_MST_EN | DP_UP_REQ_EN | DP_UPSTREAM_IS_SRC)) { + drm_dbg_kms(display->drm, + "[CONNECTOR:%d:%s][ENCODER:%d:%s] MST mode got reset, removing topology (ret=%d, ctrl=0x%02x)\n", + connector->base.base.id, connector->base.name, + encoder->base.base.id, encoder->base.name, + ret, val); + + return false; + } + + return true; +} diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.h b/drivers/gpu/drm/i915/display/intel_dp_mst.h index 8ca1d599091c..9e4c7679f1c3 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.h +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.h @@ -27,5 +27,6 @@ int intel_dp_mst_atomic_check_link(struct intel_atomic_state *state, struct intel_link_bw_limits *limits); bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state, struct intel_crtc *crtc); +bool intel_dp_mst_verify_dpcd_state(struct intel_dp *intel_dp); #endif /* __INTEL_DP_MST_H__ */