All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wayne Lin <Wayne.Lin@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: <lyude@redhat.com>, <Nicholas.Kazlauskas@amd.com>,
	<harry.wentland@amd.com>, <jerry.zuo@amd.com>,
	<hersenxs.wu@amd.com>, "Wayne Lin" <Wayne.Lin@amd.com>,
	<stable@vger.kernel.org>
Subject: [PATCH 4/4] drm/dp_mst: Release disconnected connectors when resume
Date: Wed, 21 Jul 2021 00:03:42 +0800	[thread overview]
Message-ID: <20210720160342.11415-5-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com>

[why]
When resume, we will reprobe the topology to detect any changes during
suspend. If we unplug a branch device during suspend and then resume, we
can eventually unregister child connectors of this branch device because
we call drm_dp_mst_topology_put_mstb() in drm_dp_port_set_pdt().
However, we don't unregister connectors for end devices which is
disconnected during suspend. e.g. Unplug a SST monitor during
suspend then resume. We won't unregister this connector which is no
longer exist in the topology.

[How]
Unregister connectors for disconnected end devices when resume.

Cc: stable@vger.kernel.org
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 85a959427247..0b04ea65cb8e 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2478,6 +2478,12 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
 		 drm_dp_mst_is_end_device(port->pdt, port->mcs))
 		drm_dp_mst_port_add_connector(mstb, port);
 
+	if (port->connector && port->pdt == DP_PEER_DEVICE_NONE) {
+		drm_connector_unregister(port->connector);
+		drm_connector_put(port->connector);
+		port->connector = NULL;
+	}
+
 	if (send_link_addr && port->mstb) {
 		ret = drm_dp_send_link_address(mgr, port->mstb);
 		if (ret == 1) /* MSTB below us changed */
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Wayne Lin <Wayne.Lin@amd.com>
To: <dri-devel@lists.freedesktop.org>
Cc: stable@vger.kernel.org, jerry.zuo@amd.com, hersenxs.wu@amd.com,
	Wayne Lin <Wayne.Lin@amd.com>,
	Nicholas.Kazlauskas@amd.com
Subject: [PATCH 4/4] drm/dp_mst: Release disconnected connectors when resume
Date: Wed, 21 Jul 2021 00:03:42 +0800	[thread overview]
Message-ID: <20210720160342.11415-5-Wayne.Lin@amd.com> (raw)
In-Reply-To: <20210720160342.11415-1-Wayne.Lin@amd.com>

[why]
When resume, we will reprobe the topology to detect any changes during
suspend. If we unplug a branch device during suspend and then resume, we
can eventually unregister child connectors of this branch device because
we call drm_dp_mst_topology_put_mstb() in drm_dp_port_set_pdt().
However, we don't unregister connectors for end devices which is
disconnected during suspend. e.g. Unplug a SST monitor during
suspend then resume. We won't unregister this connector which is no
longer exist in the topology.

[How]
Unregister connectors for disconnected end devices when resume.

Cc: stable@vger.kernel.org
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 85a959427247..0b04ea65cb8e 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -2478,6 +2478,12 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
 		 drm_dp_mst_is_end_device(port->pdt, port->mcs))
 		drm_dp_mst_port_add_connector(mstb, port);
 
+	if (port->connector && port->pdt == DP_PEER_DEVICE_NONE) {
+		drm_connector_unregister(port->connector);
+		drm_connector_put(port->connector);
+		port->connector = NULL;
+	}
+
 	if (send_link_addr && port->mstb) {
 		ret = drm_dp_send_link_address(mgr, port->mstb);
 		if (ret == 1) /* MSTB below us changed */
-- 
2.17.1


  parent reply	other threads:[~2021-07-20 16:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-20 16:03 [PATCH 0/4] Unregister mst connectors when hotplug Wayne Lin
2021-07-20 16:03 ` [PATCH 1/4] drm/dp_mst: Put malloc_kref of vcpi pointing port when disable MST Wayne Lin
2021-07-20 16:03   ` Wayne Lin
2021-07-20 16:03 ` [PATCH 2/4] drm/dp_mst: Only create connector for connected end device Wayne Lin
2021-07-20 16:03   ` Wayne Lin
2021-08-03 23:58   ` Lyude Paul
2021-08-04  0:08     ` Lyude Paul
2021-08-04  7:13       ` Lin, Wayne
2021-08-10 20:45         ` Lyude Paul
2021-08-11  9:49           ` Lin, Wayne
2021-08-18 18:58             ` Lyude Paul
2021-08-20 11:20               ` Lin, Wayne
2021-08-20 20:47                 ` Lyude Paul
2021-08-23  6:33                   ` Lin, Wayne
2021-08-23 21:18                     ` Lyude Paul
2021-08-25  3:35                       ` Lin, Wayne
2021-08-31 22:47                         ` Lyude Paul
2021-09-01 21:59                           ` Lyude Paul
2021-09-14  8:46                             ` Lin, Wayne
2021-09-17 17:48                               ` Lyude Paul
2021-10-26  3:50                                 ` Lin, Wayne
2021-10-26 19:34                                   ` Lyude Paul
2021-10-29 12:11                                     ` Lin, Wayne
2021-11-02 22:31                                       ` Lyude Paul
2021-11-02 22:31                                         ` Lyude Paul
2021-10-12 21:17                               ` Lyude Paul
2021-10-15 10:16                                 ` Lin, Wayne
2021-07-20 16:03 ` [PATCH 3/4] drm/dp_mst: Put connector of disconnected end device when handling CSN Wayne Lin
2021-07-20 16:03   ` Wayne Lin
2021-07-20 16:03 ` Wayne Lin [this message]
2021-07-20 16:03   ` [PATCH 4/4] drm/dp_mst: Release disconnected connectors when resume Wayne Lin

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=20210720160342.11415-5-Wayne.Lin@amd.com \
    --to=wayne.lin@amd.com \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harry.wentland@amd.com \
    --cc=hersenxs.wu@amd.com \
    --cc=jerry.zuo@amd.com \
    --cc=lyude@redhat.com \
    --cc=stable@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.