Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

drm/vc4: hdmi: vc4_hdmi_hpd_irq_thread() checks !force_hotplug globally instead of per-connector bitmask

未关闭 适合新手
#7,724 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@popcornmix 已经在做这个了。

开始于 2026年10月28日。

  • #7727 来自 @popcornmix —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c, linux

调研方向

阅读 drivers/gpu/drm/vc4/vc4_hdmi.c,重点关注 vc4_hdmi_hpd_irq_thread()以及vc4_hdmi_connector_detect_ctx()中的逐连接器检查。更新 IRQ 处理程序以应用匹配的连接器位,然后验证强制启用一个 HDMI 连接器时,另一个连接器仍能接收热插拔事件。

由索引模型根据 Issue 内容生成。

描述

Describe the bug

In drivers/gpu/drm/vc4/vc4_hdmi.c, vc4.force_hotplug is defined as a per-connector bitfield (bit0 = HDMI0 / HDMI-A-1, bit1 = HDMI1 / HDMI-A-2), and vc4_hdmi_connector_detect_ctx() (added in c96c9d87f8bd / #5052) checks the per-connector bit:

/* bit field to force hotplug detection. bit0 = HDMI0 */
static int force_hotplug;
module_param(force_hotplug, int, 0644);
...
	if (force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0))
		status = connector_status_connected;

However, vc4_hdmi_hpd_irq_thread() (modified in cb7db28b9e17 / #6123) checks !force_hotplug globally instead of checking only the connector's corresponding bit:

static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
{
	struct vc4_hdmi *vc4_hdmi = priv;
	struct drm_connector *connector = &vc4_hdmi->connector;
	struct drm_device *dev = connector->dev;

	if (dev && dev->registered && !force_hotplug)
		drm_connector_helper_hpd_irq_event(connector);

	return IRQ_HANDLED;
}

Because vc4_hdmi_bind() sets connector->polled = DRM_CONNECTOR_POLL_HPD whenever HPD IRQs are registered, drm_kms_helper's periodic polling (output_poll_execute) also skips both HDMI connectors.

As a result, setting vc4.force_hotplug=1 (to force only HDMI-A-1) inadvertently disables HPD interrupts on HDMI-A-2, and setting vc4.force_hotplug=2 (to force only HDMI-A-2, e.g. for an internal laptop panel on CM5 / Argon ONE UP where HDMI-A-2 is internal and HDMI-A-1 is the external HDMI port) completely disables hotplug/unplug interrupt detection on HDMI-A-1.

Steps to reproduce the behaviour
  1. Boot a Raspberry Pi 5 / CM5 with vc4.force_hotplug=2 (forcing only HDMI-A-2, leaving HDMI-A-1 unforced).
  2. Connect an external monitor to HDMI-A-1 (or boot with it connected) and then unplug HDMI-A-1 while the system is running.
  3. Observe /sys/class/drm/card*-HDMI-A-1/status: it remains stuck at connected (or disconnected if plugged in later) until echo detect > /sys/class/drm/card*-HDMI-A-1/status is manually triggered, because vc4_hdmi_hpd_irq_thread() ignores the HPD interrupt whenever force_hotplug != 0.
Device (s)

Raspberry Pi 5, Raspberry Pi CM5, Raspberry Pi 4 Mod. B, Raspberry Pi CM4

System
  • OS: Raspberry Pi OS Trixie (64-bit)
  • Kernel: Linux 6.18.59+rpt-rpi-2712 (also affects rpi-6.12.y and rpi-6.18.y)
Proposed Fix / Patch

Check the per-connector bit in vc4_hdmi_hpd_irq_thread() matching vc4_hdmi_connector_detect_ctx():

--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -2480,7 +2480,8 @@ static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv)
 	struct drm_connector *connector = &vc4_hdmi->connector;
 	struct drm_device *dev = connector->dev;
 
-	if (dev && dev->registered && !force_hotplug)
+	if (dev && dev->registered &&
+	    !(force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0)))
 		drm_connector_helper_hpd_irq_event(connector);
 
 	return IRQ_HANDLED;
主要语言
C
星标
13.3k
派生
5.5k
平均合并
1 天 9 小时
30 天内合并 PR
17

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

raspberrypi/linux 的其他 Issue

查看 raspberrypi/linux 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。