Skip to content

Commit

Permalink
vc4/hdmi: Hack: Add option to toggle hotplug periodically
Browse files Browse the repository at this point in the history
vc4.force_hotplug=4 will toggle hotplug for HDMI0 every 10 seconds.

This is for a test kernel build - do not merge!
  • Loading branch information
popcornmix committed Sep 5, 2024
1 parent 31be188 commit 6efb998
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/gpu/drm/vc4/vc4_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;

Check failure on line 503 in drivers/gpu/drm/vc4/vc4_hdmi.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 148 exceeds 100 columns
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;
Expand All @@ -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]);

Check failure on line 515 in drivers/gpu/drm/vc4/vc4_hdmi.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: line length of 159 exceeds 100 columns

Check failure on line 515 in drivers/gpu/drm/vc4/vc4_hdmi.c

View workflow job for this annotation

GitHub Actions / checkpatch review

WARNING: printk() should include KERN_<LEVEL> facility level
vc4_hdmi_handle_hotplug(vc4_hdmi, ctx, status);
pm_runtime_put(&vc4_hdmi->pdev->dev);

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6efb998

Please sign in to comment.