From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 3A9E83DBD41 for ; Mon, 15 Jun 2026 10:05:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781517916; cv=none; b=G5uZIv3Zb/9HnpQfWxxR4aLo6bHLQ6bKP+GHeLQ8oBM2igBGABRoCIS/2ar1NU1jTNfzoPVlvuKDLpnwRthrAu28ERKf0kWLtA2WnJ0wiZrPMCKncUCOLOZ7AIxjMlUOLiKYUmR7wvnAARBcUW6+5QCgTyJZQOKrB3nYJokBb6A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781517916; c=relaxed/simple; bh=IoK+K0FKi8f9J60s+84h7lsbpI9MYDaWp8bElnoGJBI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ch4MMhhx3ZMBuh/fLKZJEBvAmTU4w2R1YgPjkWR9VizL0VO/WzY4SO8sVYjPS9/x2gOFB5u1iVoqVvZefheQSAT23DuK2OGrNHLTxIRbSC6PP9cMThomA/94NZNMPV0xgMCUGNo0qHcrbsRYTO2cPitP82Q+nRZGpEJ4jw+aQaA= 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=aHHdewTV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=AXjn6af1; arc=none smtp.client-ip=205.220.180.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="aHHdewTV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="AXjn6af1" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65F9Ynbt4157192 for ; Mon, 15 Jun 2026 10:05:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= t4X6WGiq4FPEq0dd0u+pxDxc4ERsQrYiJnopRFePXIs=; b=aHHdewTVMpBZivXU fn/VX6pRmultlnOvxG63Ju6yQO1ca285YR1TNQSMLzRdAkdhWLTmR+R/lljr3D19 5qr6ByBCKfsyGikQO/1tXJy6FgMpyL5hBlEZEaSVztLPq03Z8q+QR9mCxfjMYfFr uz66vpwbbTV4QI2fegMlxW7+k1RAVHHvj1VHDBdi7J9JWSRQ/OpxZ7kHMqpo3JZC +wOfOA2OinRMXP+ubmfA5v/Myn7oMYABH65KcH9HAwcYWnQbFVuZdTR77sct1+T9 nQy2lsl/pQf6Ib5AaEY/i51RRW8br3+PwBvt6GmRRa2HKQ1gagKpBhfwpHW5X0Y4 3r9vAg== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4etevx049w-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 15 Jun 2026 10:05:14 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2c0d0516ad7so33185635ad.0 for ; Mon, 15 Jun 2026 03:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1781517913; x=1782122713; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=t4X6WGiq4FPEq0dd0u+pxDxc4ERsQrYiJnopRFePXIs=; b=AXjn6af1dwE2u5qqdzb4WoPPS4BkialjTnxJyIX+1bnS/1K/DDBllmZs+YOhNlBU9j KGaYso2EtpaetKrpRawT1vTPleTK32MbiDMmGxKIJiKEh2GrZV4Aqy6fivdOlOCCAgMn bnpPD7uMxIX+cDsUQ1TT7kof8vrBmhbMuRGEr3cFD5+5vds8aoZ58DkQfq5AXlUfrPJQ WRiTrXHquWxR5ZT/Mz3vHHVeT0p+ASvztzRuJSwBBlPjGTCWOMzEjDaQaRGnAr9QBE40 4ubyIRmb9OiC1BjGMk+2x/y6noni9jeP//JXMxF8CfmRGOixLCb9UpheheWieumQjnd6 zikQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781517913; x=1782122713; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=t4X6WGiq4FPEq0dd0u+pxDxc4ERsQrYiJnopRFePXIs=; b=KQiHuC4TvIKGcdEyXCH9CyXGdY6HQkUbTY31lGRlt1/G6tSfPXgDbmPHRr6qx/YklM 3XLxm1JZ8xLzrdPiXCjvUNbysedz/J1ai5NrdBDMuFqEMILUJl7O6VMkWC0lbvNfIXJg i1Aalzm41ZDDN0CYOrLP9nJrO00Ps3SlC3tcQg++GB5NjtUr5SjEgBg6se5Fi2thW5wl 1bqP9YhevVVSPi4vd/lExhrTbh8XCwry5mHaRd/mkTTOrYcMDtccw+i0VWq0xDeQXrR7 nnj9R2vEuA/A17g6cYfxdsEu/8tFnCusGeDDBozU7etdF/LbAk2JIDkbkOhXUFeAhjHp RwCQ== X-Forwarded-Encrypted: i=1; AFNElJ8z2Xzd7bkS8Su3OKitPZAWC1PLVRcY7KNq5m1VBbN1+dc/0ZYCxn+Zuh+FdNRZ5WAWBC1Tu/86TfFKRXg=@vger.kernel.org X-Gm-Message-State: AOJu0YyV5y9Es67PLwnTY0N/9oqVtoj1KwSUDpnZ7ADauq0jCXqT0yIR vH6lD+UBDJQWj2Tg9Zek3uZWaHm6LLnVdF/ZA3z+nZEpXz8S2pN9AJZN5yHy+BG2u8iiHqMTtO7 elbj/otclFI34BBcGQl0wCGRHjvXpwsV5IMkUek29pIYX69nnRCqskHWHFI3y1Z35cuE= X-Gm-Gg: Acq92OHp3expff5bD7sMF7X+TyLcMK8qi/gXFmop8gJqbKf8EF5clvahs3Yh7clkCeU Fv/x5/Q3dPjtGhyGjCbUwFMnLdX0Yb68vtClPErWjtL/HbT2/Tr3x0gdPxjFOFEzzaw7zKhEYIq +9lAK1zZi0NGif6TfdcJ32YAomTXH73wvuI+zGRVwdLIKuBuClq3+LTdVfqXsflbRy3xadugHsj HbiAoqdN0kl8/iL+JK7VljrZbs6Tq25cUpvQDhkz3XuzfG5JHysHYpImHCXr5A7ZS8MsATuzIS2 wyGckscgqxMkQg5TuoQutmR3rr0hJgo/pTeohvkNmHC3jDy1ZDbeY1Czpw4uFBGeQnWxapJ+fwp m1Gd0nV3jQaMSvIGm1kkhdkc7R0mu1HnWVM4/H0aVF6zMBwjGjkh7Mx51drJPeAZh0VDrrrM6n0 pn/BvHMzhsr6JM3FjeUg== X-Received: by 2002:a17:903:2f04:b0:2c0:bcb3:86f with SMTP id d9443c01a7336-2c6641488d3mr116824495ad.6.1781517913008; Mon, 15 Jun 2026 03:05:13 -0700 (PDT) X-Received: by 2002:a17:903:2f04:b0:2c0:bcb3:86f with SMTP id d9443c01a7336-2c6641488d3mr116823835ad.6.1781517912493; Mon, 15 Jun 2026 03:05:12 -0700 (PDT) Received: from [10.133.33.122] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c42fbb50bfsm96866885ad.33.2026.06.15.03.05.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jun 2026 03:05:12 -0700 (PDT) Message-ID: <42c2bbab-dd86-4ba8-94f6-a6f377425be9@oss.qualcomm.com> Date: Mon, 15 Jun 2026 18:05:07 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 37/39] drm/msm/dp: add HPD callback for dp MST To: Dmitry Baryshkov Cc: Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter , Jessica Zhang , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Abhinav Kumar References: <20260410-msm-dp-mst-v4-0-b20518dea8de@oss.qualcomm.com> <20260410-msm-dp-mst-v4-37-b20518dea8de@oss.qualcomm.com> Content-Language: en-US From: Yongxing Mou In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-ORIG-GUID: 6N852WNZG6IVAQlo89xEVEvQkxmeo7Wu X-Proofpoint-GUID: 6N852WNZG6IVAQlo89xEVEvQkxmeo7Wu X-Authority-Analysis: v=2.4 cv=f8t4wuyM c=1 sm=1 tr=0 ts=6a2fce5a cx=c_pps a=IZJwPbhc+fLeJZngyXXI0A==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=e5mUnYsNAAAA:8 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=99inU4qtSHyG9fJ7QXwA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=uG9DUKGECoFWVXl0Dc02:22 a=Vxmtnl_E_bksehYqCbjh:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE1MDEwNiBTYWx0ZWRfX/LSFg06SRd/J pIwdciPxex/7vnJe2Q8naOpVybXd65YLNTj4Fdz7Dp/q5PwTJabc1cmgoqGapawGKdMJlD2YMJC /+XUUXL0ng36y9dEn/ACzrtMIr55K/A= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE1MDEwNiBTYWx0ZWRfX9SezPwKmddXk pDHVGj8xn+rZ927EuoVbkqHNM3LsAXTOJvh/4fyME+ahyEBHKjETdShx/Ea8yTV02GmMNW2oRYz Yck4Of6TXr+IwsvSFnGi+VyWP2ttHoIVbytEe1A9lgtogfmGRG5LLVUs9FPzvtxoIfWi67kaMSp 6kmrwBiJDe45pwb+XLsxqFDXI+CDWWt8rL4Dp4beIMg6i87NK0jdtjxf1GHLzJ5X6EIa7qwoFyf QmyWuHpdSypKB4YxT69NKRdPwI4icqoVRsH2kJoSS4OmVllP5WdfYj0uewzC+hQMgzfG7LwEOqY XLLavo3Y1EOnwYkgW3xAj/V+AqbY094u5VI/aB7IkiFNVwdzkpf/v2DhVEspeISF56/ZXLRqmnz rgosJMb7aGgadfucWutsfiU98XJfW2/EKmHSMPRt1YPCHXzQkXFmMZpVbG7L7FxlMp/cKD+GOdz dNm/dpeB6G7DunOOdvg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-15_02,2026-06-12_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606040000 definitions=main-2606150106 On 4/12/2026 6:00 AM, Dmitry Baryshkov wrote: > On Fri, Apr 10, 2026 at 05:34:12PM +0800, Yongxing Mou wrote: >> From: Abhinav Kumar >> >> Add HPD callback for the MST module which shall be invoked from the >> dp_display's HPD handler to perform MST specific operations in case >> of HPD. In MST case, route the HPD messages to MST module. >> >> Signed-off-by: Abhinav Kumar >> Signed-off-by: Yongxing Mou >> --- >> drivers/gpu/drm/msm/dp/dp_display.c | 23 +++++++++++++++++++---- >> drivers/gpu/drm/msm/dp/dp_mst_drm.c | 34 ++++++++++++++++++++++++++++++++++ >> drivers/gpu/drm/msm/dp/dp_mst_drm.h | 1 + >> 3 files changed, 54 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c >> index 919767945ba5..ca89e20b7563 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_display.c >> +++ b/drivers/gpu/drm/msm/dp/dp_display.c >> @@ -454,6 +454,9 @@ static int msm_dp_hpd_plug_handle(struct msm_dp_display_private *dp) >> dp->msm_dp_display.connector_type, >> dp->link->sink_count); >> >> + if (dp->plugged) >> + return 0; >> + >> mutex_lock(&dp->plugged_lock); >> >> ret = pm_runtime_resume_and_get(&pdev->dev); >> @@ -556,12 +559,19 @@ static int msm_dp_irq_hpd_handle(struct msm_dp_display_private *dp) >> { >> u32 sink_request; >> int rc = 0; >> + struct msm_dp *msm_dp_display = &dp->msm_dp_display; >> >> /* irq_hpd can happen at either connected or disconnected state */ >> drm_dbg_dp(dp->drm_dev, "Before, type=%d, sink_count=%d\n", >> dp->msm_dp_display.connector_type, >> dp->link->sink_count); >> >> + if (msm_dp_display->mst_active) { >> + if (msm_dp_aux_is_link_connected(dp->aux) != ISR_DISCONNECTED) > > Will this work for USB-C? > Hmm not work for USB-C. We can remove this check here, as the IRQ thread can handle the disconnect case itself. >> + msm_dp_mst_display_hpd_irq(&dp->msm_dp_display); >> + return 0; >> + } >> + >> /* check for any test request issued by sink */ >> rc = msm_dp_link_process_request(dp->link); >> if (!rc) { >> @@ -1125,9 +1135,13 @@ static irqreturn_t msm_dp_display_irq_thread(int irq, void *dev_id) >> connector_status_connected); >> >> /* Send HPD as connected and distinguish it in the notifier */ >> - if (hpd_isr_status & DP_DP_IRQ_HPD_INT_MASK) >> - drm_bridge_hpd_notify(dp->msm_dp_display.bridge, >> - connector_status_connected); >> + if (hpd_isr_status & DP_DP_IRQ_HPD_INT_MASK) { >> + if (dp->msm_dp_display.mst_active) >> + msm_dp_irq_hpd_handle(dp); > > No, don't touch this code. HPD notifications might be coming from the > other entities. This IRQ thread can only send the HPD notification. > There rest should be handled in the notifier. > Ok. From my understanding, after this series (https://patchwork.freedesktop.org/series/164954/#rev5) is rebased, we should use drm_aux_hpd_bridge_notify_extra() here to notify the IRQ? >> + else >> + drm_bridge_hpd_notify(dp->msm_dp_display.bridge, >> + connector_status_connected); >> + } >> >> ret = IRQ_HANDLED; >> >> @@ -1793,7 +1807,8 @@ void msm_dp_bridge_hpd_notify(struct drm_bridge *bridge, >> msm_dp_hpd_plug_handle(dp); >> } >> } else { >> - msm_dp_hpd_unplug_handle(dp); >> + if (hpd_link_status == ISR_DISCONNECTED) > > Why? > Let me explain this in more detail here. Currently, MST hotplug and IRQ events are handled through the SST bridge. This guards against spurious unplug handling caused by msm_dp_bridge_hpd_notify() being invoked from non-HPD contexts where status == connector_status_disconnected does not actually mean the cable is gone. In addition to the real HPD IRQ path, drm_bridge_connector_detect() also calls drm_bridge_connector_hpd_notify() to broadcast the detect result to all bridges in the chain. So a single physical plug-in produces multiple msm_dp_bridge_hpd_notify() calls — one from the real IRQ, then several more from various probe/poll paths. Stack traces from a single insertion on QCS8300: 1. msm_dp_display_irq_thread → real HPD plug, status=connected 2. fbdev probe triggered by (1) → drm_bridge_connector_detect → status=disconnected (link not ready yet) 3. output_poll_execute worker → same path → status=disconnected 4. drm_dp_mst_link_probe_work → same path → status=disconnected 5. output_poll_execute again → status=disconnected Here not work for USB-C case yet, I’d like to switch to using drm_dp_read_sink_count to detect whether the sink is actually disconnected or no sink devices. >> + msm_dp_hpd_unplug_handle(dp); >> } >> >> pm_runtime_put_sync(&msm_dp_display->pdev->dev); >> diff --git a/drivers/gpu/drm/msm/dp/dp_mst_drm.c b/drivers/gpu/drm/msm/dp/dp_mst_drm.c >> index bb3898b1f6b1..71d3f63973e6 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_mst_drm.c >> +++ b/drivers/gpu/drm/msm/dp/dp_mst_drm.c >> @@ -490,6 +490,40 @@ int msm_dp_mst_display_set_mgr_state(struct msm_dp *dp_display, bool state) >> return rc; >> } >> >> +/* DP MST HPD IRQ callback */ > > Useless comment. > Got it. >> +void msm_dp_mst_display_hpd_irq(struct msm_dp *dp_display) >> +{ >> + int rc; >> + struct msm_dp_mst *mst = dp_display->msm_dp_mst; >> + u8 ack[8] = {}; >> + u8 esi[4]; >> + unsigned int esi_res = DP_SINK_COUNT_ESI + 1; >> + bool handled; >> + >> + rc = drm_dp_dpcd_read_data(mst->dp_aux, DP_SINK_COUNT_ESI, esi, 4); >> + if (rc < 0) { >> + DRM_ERROR("DPCD sink status read failed, rlen=%d\n", rc); >> + return; >> + } >> + >> + drm_dbg_dp(dp_display->drm_dev, "MST irq: esi1[0x%x] esi2[0x%x] esi3[%x]\n", >> + esi[1], esi[2], esi[3]); >> + >> + rc = drm_dp_mst_hpd_irq_handle_event(&mst->mst_mgr, esi, ack, &handled); >> + >> + /* ack the request */ >> + if (handled) { >> + rc = drm_dp_dpcd_write_byte(mst->dp_aux, esi_res, ack[1]); >> + if (rc < 0) { >> + DRM_ERROR("DPCD esi_res failed. rc=%d\n", rc); >> + return; >> + } >> + >> + drm_dp_mst_hpd_irq_send_new_request(&mst->mst_mgr); >> + } >> + drm_dbg_dp(dp_display->drm_dev, "MST display hpd_irq handled:%d rc:%d\n", handled, rc); >> +} >> + >> /* DP MST Connector OPs */ >> static int >> msm_dp_mst_connector_detect(struct drm_connector *connector, >> diff --git a/drivers/gpu/drm/msm/dp/dp_mst_drm.h b/drivers/gpu/drm/msm/dp/dp_mst_drm.h >> index 5d411529f681..08e145399cfc 100644 >> --- a/drivers/gpu/drm/msm/dp/dp_mst_drm.h >> +++ b/drivers/gpu/drm/msm/dp/dp_mst_drm.h >> @@ -9,5 +9,6 @@ >> >> int msm_dp_mst_init(struct msm_dp *dp_display, u32 max_streams, struct drm_dp_aux *drm_aux); >> int msm_dp_mst_display_set_mgr_state(struct msm_dp *dp_display, bool state); >> +void msm_dp_mst_display_hpd_irq(struct msm_dp *dp_display); >> >> #endif /* _DP_MST_DRM_H_ */ >> >> -- >> 2.43.0 >> >