linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: do not call detect for connectors which are forced on
@ 2022-08-26  9:11 Michael Rodin
  2022-09-29 23:33 ` Laurent Pinchart
  2022-11-07 12:36 ` Maxime Ripard
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Rodin @ 2022-08-26  9:11 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann,
	David Airlie, Daniel Vetter, Alex Deucher, Philipp Zabel,
	Sean Paul, Vincent Abriou, dri-devel, linux-kernel
  Cc: Michael Rodin, michael, erosca

"detect" should not be called and its return value shall not be used when a
connector is forced as hinted in the commit d50ba256b5f1 ("drm/kms: start
adding command line interface using fb.") and the commit 6fe14acd496e
("drm: Document drm_connector_funcs"). One negative side effect of doing
this is observed on the RCar3 SoCs which use the dw-hdmi driver. It
continues executing drm_helper_hpd_irq_event even if its connector is
forced to ON. As consequence drm_helper_hpd_irq_event calls "detect" so the
connector status is updated to "disconnected":

[  420.201527] [drm:drm_helper_hpd_irq_event] [CONNECTOR:76:HDMI-A-1] status updated from connected to disconnected

This status is corrected by drm_helper_probe_single_connector_modes shortly
after this because this function checks if a connector is forced:

[  420.218703] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:76:HDMI-A-1] status updated from disconnected to connected

To avoid similar issues this commit adapts functions which call "detect"
so they check if a connector is forced and return the correct status.

Fixes: 949f08862d66 ("drm: Make the connector .detect() callback optional")
Signed-off-by: Michael Rodin <mrodin@de.adit-jv.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index bb427c5a4f1f..1691047d0472 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -289,7 +289,12 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force)
 retry:
 	ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx);
 	if (!ret) {
-		if (funcs->detect_ctx)
+		if (connector->force == DRM_FORCE_ON ||
+		    connector->force == DRM_FORCE_ON_DIGITAL)
+			ret = connector_status_connected;
+		else if (connector->force == DRM_FORCE_OFF)
+			ret = connector_status_disconnected;
+		else if (funcs->detect_ctx)
 			ret = funcs->detect_ctx(connector, &ctx, force);
 		else if (connector->funcs->detect)
 			ret = connector->funcs->detect(connector, force);
@@ -340,7 +345,14 @@ drm_helper_probe_detect(struct drm_connector *connector,
 	if (ret)
 		return ret;
 
-	if (funcs->detect_ctx)
+	if (connector->force == DRM_FORCE_ON ||
+	    connector->force == DRM_FORCE_ON_DIGITAL)
+		ret = connector_status_connected;
+	else if (connector->force == DRM_FORCE_OFF)
+		ret = connector_status_disconnected;
+	else if (funcs->detect_ctx)
+		ret = funcs->detect_ctx(connector, ctx, force);
+	else if (funcs->detect_ctx)
 		ret = funcs->detect_ctx(connector, ctx, force);
 	else if (connector->funcs->detect)
 		ret = connector->funcs->detect(connector, force);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-27 13:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  9:11 [PATCH] drm: do not call detect for connectors which are forced on Michael Rodin
2022-09-29 23:33 ` Laurent Pinchart
2022-11-07 12:25   ` Maxime Ripard
2022-11-07 12:36 ` Maxime Ripard
2022-12-15 17:03   ` [PATCH] drm: override detected status " Michael Rodin
2022-12-22 17:40     ` Maxime Ripard
2023-01-20  9:03       ` Michael Rodin
2023-01-27 13:57         ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).