Skip to content

Commit 6efb998

Browse files
committed
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!
1 parent 31be188 commit 6efb998

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
476476
}
477477
}
478478

479+
static uint32_t toggle[2];
479480
static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
480481
struct drm_modeset_acquire_ctx *ctx,
481482
bool force)
@@ -498,6 +499,10 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
498499

499500
if (force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0))
500501
status = connector_status_connected;
502+
else if (force_hotplug & BIT(2 + vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0)) {
503+
status = (toggle[vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0] & 2) ? connector_status_disconnected : connector_status_connected;
504+
toggle[vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0]++;
505+
}
501506
else if (vc4_hdmi->hpd_gpio) {
502507
if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))
503508
status = connector_status_connected;
@@ -507,6 +512,7 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,
507512
status = connector_status_connected;
508513
}
509514

515+
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]);
510516
vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status);
511517
pm_runtime_put(&vc4_hdmi->pdev->dev);
512518

@@ -3005,7 +3011,7 @@ static int vc4_hdmi_hotplug_init(struct vc4_hdmi *vc4_hdmi)
30053011
if (ret)
30063012
return ret;
30073013

3008-
connector->polled = DRM_CONNECTOR_POLL_HPD;
3014+
connector->polled = connector->polled;
30093015
}
30103016

30113017
return 0;

0 commit comments

Comments
 (0)