From 6efb998e25056ca2c8e9941db342e316514cc2a2 Mon Sep 17 00:00:00 2001 From: Dom Cobley Date: Wed, 4 Sep 2024 18:18:26 +0100 Subject: [PATCH] vc4/hdmi: Hack: Add option to toggle hotplug periodically vc4.force_hotplug=4 will toggle hotplug for HDMI0 every 10 seconds. This is for a test kernel build - do not merge! --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index d2ce9481ccda2b..2dfb5eb4b758e3 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -476,6 +476,7 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi, } } +static uint32_t toggle[2]; static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, struct drm_modeset_acquire_ctx *ctx, bool force) @@ -498,6 +499,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, if (force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0)) status = connector_status_connected; + else if (force_hotplug & BIT(2 + vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0)) { + status = (toggle[vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0] & 2) ? connector_status_disconnected : connector_status_connected; + toggle[vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0]++; + } else if (vc4_hdmi->hpd_gpio) { if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) status = connector_status_connected; @@ -507,6 +512,7 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, status = connector_status_connected; } + printk("%s:%d: %d (%d)\n", __func__, vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0, status, toggle[vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0]); vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status); pm_runtime_put(&vc4_hdmi->pdev->dev); @@ -3005,7 +3011,7 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi) if (ret) return ret; - connector->polled = DRM_CONNECTOR_POLL_HPD; + connector->polled = connector->polled; } return 0;