From nobody Fri Oct 2 09:22:05 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 046D73195FD for ; Mon, 3 Aug 2026 08:43:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785746604; cv=none; b=DZg8bC9VXbIXTWZeKehrCJd0/v9STHW/W1kNQdqxBxwuU9xXKeybCeFy/rTMUBWVlfI/0ZoLNpVIJck1zD37M2Tl7l6KJxnLhjLJaC6u8pQMR+WSJYx497hcZ3X6W3vXQ9BY5A/7NPctBYI+jsugMIAB52uwsyw75udSrzZ5wu8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785746604; c=relaxed/simple; bh=dsumcoBHZClhzi888ELmTyHy0xGhE51qhd67sQ/Owp8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=HdlJfj0jrHLYUsoSFRN60WdXY4uvokXqvRwkAEYArFIKNspyMaC1iYjMnW200qp5PJO6sSRXvfIswE29wrBe7YR7i0ICsYGuHULtgKdpgF/dtgHTOlHyYWaazG2mN8DT91wbohsEa/HHOa4Ln1WMlXAPdEYzda5fCKkXJT+lUhQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=LuLgtJ3M; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=ODcm68RM; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="LuLgtJ3M"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="ODcm68RM" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6736ShaJ3758902 for ; Mon, 3 Aug 2026 08:43:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=acyMrvZmnRxXhaZW1QJHZD gWwsjcmAOZiK0i712DwhI=; b=LuLgtJ3MH7FpwEdCzbaHrsBr23rvvqFsHkGx6I RrOGqnlAVQ2yKn1/2mGXBf8w7Sd4MWDaj8JWYKeGvpdeG0EEi4TKv1fphBzPkrky PfZsslM2V/S3WqmuEFUmpaNAIUBKGG0XE/vxH+oF48WSq+ApTnOxlHueao2ir1RJ XXNlZeuTc7hJpJduVlTQ3tOGMooQSlvjH3ycmClqMHRpttPoqTzNhIvldgURqHcI B3ripayZ/oU7g9FW5XFes8JQziBaigQjw4HJ/RSur9mAlmj6C77u8dJ4MCca5nt9 RybdA3j1vDns2H7xjdujMJtJl3BZonZjHqNl2698FLHLks/g== Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ftnrnrhbu-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 03 Aug 2026 08:43:22 +0000 (GMT) Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-51c1a9764f0so32139201cf.1 for ; Mon, 03 Aug 2026 01:43:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1785746601; x=1786351401; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=acyMrvZmnRxXhaZW1QJHZDgWwsjcmAOZiK0i712DwhI=; b=ODcm68RMpYJMajYHs36AkEwM0fAkAM9REBx06gb52Rgz+SBzZkAIRiGxTYSQLNsR4m pdqG1IL+aT0TFezzoVNSmk5xR/JRs03ZMScYVw7utKHsjDViPT0qMMBsb9goIc9/PglA Tu/V4p7meArHPD4IraY6ymj4g2E9vN7TUnk0m7T9a+/LdITspqmeyOqQn4ft3uEG7mLa KV5scf6t3MOVWd9j9fW6t1EKj3TeXw00OKHFFxindEzb9iTu1qGpu7zsLLv6PHXL7otb doq8qweo5NllE8Xt4Mtf+D/4YRz9g84nyJWaGXW+FqrU6HLl0z/Vn4t3Z45iuYqOvlG9 i7ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785746601; x=1786351401; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=acyMrvZmnRxXhaZW1QJHZDgWwsjcmAOZiK0i712DwhI=; b=Tx6+xTddEyDEQjL0PoUvRdClSaYMuwxfMayWjUpk6g3ZpKGhdU+FkV3jPvaTM/XVhl JTZkl3U3+MEh8DPInxVjREIaafvLfJGR6fr70pY2n//vgd/PqGixVCTu+ym26v5HE3k7 aQ+oziRtRjxhdH8BOlF4S0QHjgSw9EzeiAn9k2NSgCkcxmlIF1oRTLmUhnfsmRzqXWtu 57OglHHECubwnT109kRHPLEXkJ7iZnRHIjw4bKvRPoaZkHGue7wiqXgFnVSeIMeXe8cS 9xChil+lstRsmji8PfcAS0/Ln4WXCN3+p5PVFIm65Fg09WnEhacfdFDnMe9eApNOVF0N XAKQ== X-Forwarded-Encrypted: i=1; AHgh+RrBIrlNkPQZ3Q9oGlgKJO3DEUT+VoTS+pPGSUihPm5LMWziFvR4vU89igj+E7lke/n67K8HHVk4OOiYHNY=@vger.kernel.org X-Gm-Message-State: AOJu0YzRUMtZkb0m7Y1YI9VQ7VvSva4H0NyuxLueKjfOHwrNQN28WLxa udgSLNigPSCJ4+BWp91nawcXI0skZzrUOf8euBsyyKuVOQkicMTaPmJKEWJ5xBFMKnlvTj3x56I m1IL9uljmWeZni+WbwILFRbWdAFDmQzFM2CiPtM2Skxk2ax1FPheSAajxlCzvZ0xf5oc= X-Gm-Gg: AR+sD139p0nxTTqejaToF4Z5ur8lKowCza7vf7kE9ngQqJyEV5PlwZqOt1KfAgLy91H HVAeTI0Bu7S/60rWFArIgNPjEJduT96G9SDXMyutHYsw1b+RJnawGtA99fSg+ZO8qAQ7nJGGlmw ZRSyE51UVOJ+LO0sOUAvERZyG7EYImWixHhU1J6jau1KVp6MLDQJ1PB42gQM+Fqc5D/htneVr1D dEdLhqG53r5etX4+IDwge+bfn3wBOx9PpII/roQU21EDs150w7ltttvV6oCsjbqatHv8PHRaikz f48oFi5vxdDdti1OhzWFrqUa7kEoGRmha+797tvxFCqP2tIBpVbK+UnmkhgzwtxMciaCsJ/llYN 4KfIL4ZSX9Coa6Xr7S/g6LYHqXkFY0ffdigz/QAQv/PAtMbtXjrE+gPwQpaCQScc= X-Received: by 2002:a05:622a:1f91:b0:517:7b6c:4465 with SMTP id d75a77b69052e-52b56752f3dmr202398591cf.22.1785746600877; Mon, 03 Aug 2026 01:43:20 -0700 (PDT) X-Received: by 2002:a05:622a:1f91:b0:517:7b6c:4465 with SMTP id d75a77b69052e-52b56752f3dmr202398261cf.22.1785746600381; Mon, 03 Aug 2026 01:43:20 -0700 (PDT) Received: from yongmou2.ap.qualcomm.com (Global_NAT1_IAD_FW.qualcomm.com. [129.46.232.65]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-908432a0deasm70013806d6.8.2026.08.03.01.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2026 01:43:20 -0700 (PDT) From: Yongxing Mou Date: Mon, 03 Aug 2026 16:43:08 +0800 Subject: [PATCH] drm/bridge: aux-hpd-bridge: replay last HPD status on hpd_enable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260803-drm-usbdp-preboot-v1-1-2539b362be00@oss.qualcomm.com> X-B4-Tracking: v=1; b=H4sIAJtUcGoC/yWMyw6DIBAAf8XsuSQgsoK/0nhgYdty8FHQponx3 0vqcSaZOaBwTlxgaA7I/EklLXMFdWsgvPz8ZJFiZWhli9JKLWKexF4ormLNTMuyieCVI+N0q1S A2lX/SN//8z5enPm91/V2SSBfWIRlmtI2NJ0yKNH3xE47q00kRzIi9UpZ2xuL2KHuMMJ4nj9q0 uHVrwAAAA== X-Change-ID: 20260803-drm-usbdp-preboot-ca19b593211c To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Dmitry Baryshkov Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Yongxing Mou X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1785746595; l=5065; i=yongxing.mou@oss.qualcomm.com; s=20250910; h=from:subject:message-id; bh=dsumcoBHZClhzi888ELmTyHy0xGhE51qhd67sQ/Owp8=; b=QC8eH7/m8/CjOtyvQoatb6Tja2rL8GTB2znSnKifrPT/klVL4SRPZ28YUSJ707dC7OA/b7EYE m4pT66zVJrDC5RVigzoKiIA0bPVBMb8TOO8zb5Tf5q+2ajjlTz5GEOH X-Developer-Key: i=yongxing.mou@oss.qualcomm.com; a=ed25519; pk=rAy5J1eP+V7OXqH5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22 X-Proofpoint-GUID: HB4viTgXFVQQmZR0f3k3B6Rr_IOAIpnG X-Proofpoint-ORIG-GUID: HB4viTgXFVQQmZR0f3k3B6Rr_IOAIpnG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-02_06,2026-07-30_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 phishscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 priorityscore=1501 bulkscore=0 suspectscore=0 malwarescore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608030076 If a downstream consumer (e.g. drm_bridge_connector attached by the msm/dp driver) registers its HPD callback after an upstream driver has already reported a HPD event through drm_aux_hpd_bridge_notify(), the notification is dropped because bridge->hpd_cb is still NULL. This can affect any user of drm_aux_hpd_bridge_notify() whose downstream consumer arms HPD only after upstream events have started. The race has been observed on Qualcomm X1E-based laptops during boot, when pmic_glink_altmode reports the initial USB-C DP connection state before the DP driver has finished probing and enabled HPD handling on the bridge. The consumer then never observes the initial connected state and the external display remains dark. Cache the last HPD status reported through drm_aux_hpd_bridge_notify() and replay it when HPD is enabled by the downstream consumer. The replay is deferred to a work item so that the replayed HPD notification is delivered outside drm_bridge_hpd_enable()'s call context. This follows the same pattern as display-connector, which also defers an initial HPD notification from .hpd_enable(), but reuses the cached status since aux-hpd-bridge cannot re-detect sink presence on its own. Fixes: e560518a6c2e ("drm/bridge: implement generic DP HPD bridge") Signed-off-by: Yongxing Mou --- drivers/gpu/drm/bridge/aux-hpd-bridge.c | 53 +++++++++++++++++++++++++++++= +++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.c b/drivers/gpu/drm/brid= ge/aux-hpd-bridge.c index a2e525aa5788..bb81aabf58d4 100644 --- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c +++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c @@ -8,6 +8,7 @@ #include #include #include +#include =20 #include #include @@ -18,6 +19,17 @@ static DEFINE_IDA(drm_aux_hpd_bridge_ida); struct drm_aux_hpd_bridge_data { struct drm_bridge bridge; struct device *dev; + + /* + * Last HPD status pushed through drm_aux_hpd_bridge_notify(). + * Replayed from .hpd_enable so that consumers registering their + * callback after the initial notification are caught up. + * + * Accessed lockless from the notify path (writer) and hpd_work + * (reader) - use WRITE_ONCE()/READ_ONCE(). + */ + enum drm_connector_status last_status; + struct work_struct hpd_work; }; =20 static void drm_aux_hpd_bridge_release(struct device *dev) @@ -154,6 +166,8 @@ void drm_aux_hpd_bridge_notify(struct device *dev, enum= drm_connector_status sta if (!data) return; =20 + WRITE_ONCE(data->last_status, status); + drm_bridge_hpd_notify(&data->bridge, status); } EXPORT_SYMBOL_GPL(drm_aux_hpd_bridge_notify); @@ -165,11 +179,45 @@ static int drm_aux_hpd_bridge_attach(struct drm_bridg= e *bridge, return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL; } =20 +static void drm_aux_hpd_bridge_hpd_work(struct work_struct *work) +{ + struct drm_aux_hpd_bridge_data *data =3D + container_of(work, struct drm_aux_hpd_bridge_data, hpd_work); + enum drm_connector_status status =3D READ_ONCE(data->last_status); + + if (status =3D=3D connector_status_unknown) + return; + + drm_bridge_hpd_notify(&data->bridge, status); +} + +/* + * Deferred to a work item so that the replayed HPD notification is + * delivered outside drm_bridge_hpd_enable()'s call context. + */ +static void drm_aux_hpd_bridge_hpd_enable(struct drm_bridge *bridge) +{ + struct drm_aux_hpd_bridge_data *data =3D + container_of(bridge, struct drm_aux_hpd_bridge_data, bridge); + + schedule_work(&data->hpd_work); +} + +static void drm_aux_hpd_bridge_hpd_disable(struct drm_bridge *bridge) +{ + struct drm_aux_hpd_bridge_data *data =3D + container_of(bridge, struct drm_aux_hpd_bridge_data, bridge); + + cancel_work_sync(&data->hpd_work); +} + static const struct drm_bridge_funcs drm_aux_hpd_bridge_funcs =3D { .atomic_create_state =3D drm_atomic_helper_bridge_create_state, .atomic_destroy_state =3D drm_atomic_helper_bridge_destroy_state, .atomic_duplicate_state =3D drm_atomic_helper_bridge_duplicate_state, - .attach =3D drm_aux_hpd_bridge_attach, + .attach =3D drm_aux_hpd_bridge_attach, + .hpd_enable =3D drm_aux_hpd_bridge_hpd_enable, + .hpd_disable =3D drm_aux_hpd_bridge_hpd_disable, }; =20 static int drm_aux_hpd_bridge_probe(struct auxiliary_device *auxdev, @@ -192,6 +240,9 @@ static int drm_aux_hpd_bridge_probe(struct auxiliary_de= vice *auxdev, data->bridge.interlace_allowed =3D true; data->bridge.ycbcr_420_allowed =3D true; =20 + data->last_status =3D connector_status_unknown; + INIT_WORK(&data->hpd_work, drm_aux_hpd_bridge_hpd_work); + auxiliary_set_drvdata(auxdev, data); =20 return devm_drm_bridge_add(data->dev, &data->bridge); --- base-commit: 415606a7be939835db9b0d6b711887586646346d change-id: 20260803-drm-usbdp-preboot-ca19b593211c Best regards, --=20 Yongxing Mou