[PATCH 7/7] drm/mgag200: Track physical connector status in struct drm_connector

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Set bmc_attached for the VGA connector on servers and let DRM's
probe helpers track the physical and logical connector state. Remove
similar logic from mgag200.

Also resolve a design issue, where mgag200 uses the connector's
edid_blob_ptr. It is an internal value that drivers should not access
directly.

Reported-by: Jani Nikula <jani.nikula@xxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/dri-devel/87msjtxk8f.fsf@xxxxxxxxx/raw
Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
---
 drivers/gpu/drm/mgag200/mgag200_vga_bmc.c | 32 +++++------------------
 1 file changed, 6 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
index a5a3ac108bd5..cff333572b29 100644
--- a/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
+++ b/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
@@ -54,9 +54,11 @@ static int mgag200_vga_bmc_connector_helper_get_modes(struct drm_connector *conn
 	const struct mgag200_device_info *minfo = mdev->info;
 	int count;
 
-	count = drm_connector_helper_get_modes(connector);
+	if (connector->physical_status == connector_status_connected) {
+		count = drm_connector_helper_get_modes(connector);
+	} else {
+		drm_edid_connector_update(connector, NULL);
 
-	if (!count) {
 		/*
 		 * There's no EDID data without a connected monitor. Set BMC-
 		 * compatible modes in this case. The XGA default resolution
@@ -70,32 +72,9 @@ static int mgag200_vga_bmc_connector_helper_get_modes(struct drm_connector *conn
 	return count;
 }
 
-/*
- * There's no monitor connected if the DDC did not return an EDID. Still
- * return 'connected' as there's always a BMC. Incrementing the connector's
- * epoch counter triggers an update of the related properties.
- */
-static int mgag200_vga_bmc_connector_helper_detect_ctx(struct drm_connector *connector,
-						       struct drm_modeset_acquire_ctx *ctx,
-						       bool force)
-{
-	enum drm_connector_status old_status, status;
-
-	if (connector->edid_blob_ptr)
-		old_status = connector_status_connected;
-	else
-		old_status = connector_status_disconnected;
-
-	status = drm_connector_helper_detect_from_ddc(connector, ctx, force);
-
-	if (status != old_status)
-		++connector->epoch_counter;
-	return connector_status_connected;
-}
-
 static const struct drm_connector_helper_funcs mgag200_vga_connector_helper_funcs = {
 	.get_modes = mgag200_vga_bmc_connector_helper_get_modes,
-	.detect_ctx = mgag200_vga_bmc_connector_helper_detect_ctx,
+	.detect_ctx = drm_connector_helper_detect_from_ddc,
 };
 
 static const struct drm_connector_funcs mgag200_vga_connector_funcs = {
@@ -143,6 +122,7 @@ int mgag200_vga_bmc_output_init(struct mga_device *mdev)
 	}
 	drm_connector_helper_add(connector, &mgag200_vga_connector_helper_funcs);
 
+	connector->bmc_attached = true;
 	connector->polled = DRM_CONNECTOR_POLL_CONNECT |
 			    DRM_CONNECTOR_POLL_DISCONNECT;
 
-- 
2.46.0




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux