From nobody Fri Oct 3 21:02:28 2025 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 3767C22B586 for ; Tue, 26 Aug 2025 02:28:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756175323; cv=none; b=XphxGcR0b23FpnCD7DHxaBOA+Oa1n9+o9XMWNiAo71QSAHm9sgp7P0h6AcrGgF5oCgyiVIBV76qYcn/PzWJBjKjpf9cBfjlFIekfPzcbaJDxsVR5QogMOlvR7ZBtJMy5dUEQhWT3NAx2RnJLSjLWP0lofV4HYXYbp1SNUX+eBwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756175323; c=relaxed/simple; bh=VjTnvR1qt8VNw7nktqcrsUlKqEQLmvaYHKeIZ/noFic=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KBl+kKKzjwMYxTRjVcJ1yl3gFhx4hM35xNI0MhohD13hxJq+UOsj8AuxNIihlDDJCB22O5noTDd0W5Zt4xfPZ0fYeLi5Kl0TRO0BAYRUP4mSfOQ+QX7aoTZT8TyPg0IWShcRrTgxC99OnOp3AWotaotgGmODMYYHZIHYCY0Lylg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4c9s5t2jGWz14MjR; Tue, 26 Aug 2025 10:28:18 +0800 (CST) Received: from dggemv705-chm.china.huawei.com (unknown [10.3.19.32]) by mail.maildlp.com (Postfix) with ESMTPS id AF7CA180B6A; Tue, 26 Aug 2025 10:28:24 +0800 (CST) Received: from kwepemq100007.china.huawei.com (7.202.195.175) by dggemv705-chm.china.huawei.com (10.3.19.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 26 Aug 2025 10:28:24 +0800 Received: from localhost.huawei.com (10.169.71.169) by kwepemq100007.china.huawei.com (7.202.195.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 26 Aug 2025 10:28:23 +0800 From: Yongbang Shi To: , , , , , , , , CC: , , , , , , , , Subject: [PATCH v5 drm-dp 1/4] drm/hisilicon/hibmc: fix dp probabilistical detect errors after HPD irq Date: Tue, 26 Aug 2025 10:17:41 +0800 Message-ID: <20250826021744.3237574-2-shiyongbang@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20250826021744.3237574-1-shiyongbang@huawei.com> References: <20250826021744.3237574-1-shiyongbang@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To kwepemq100007.china.huawei.com (7.202.195.175) Content-Type: text/plain; charset="utf-8" From: Baihan Li The issue is that drm_connector_helper_detect_from_ddc() returns wrong status when plugging or unplugging the monitor. To perform a DP detect(), add read_dpcd_cap() and read_sink_count() to detect DP monitor, and 200ms delay doesn't need anymore. Fixes: 3c7623fb5bb6 ("drm/hisilicon/hibmc: Enable this hot plug detect of i= rq feature") Signed-off-by: Baihan Li Signed-off-by: Yongbang Shi --- ChangeLog: v4 -> v5: - fix the commit message and DP detect_ctx(), suggested by Dmitry Baryshk= ov. --- drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c b/drivers/gpu/d= rm/hisilicon/hibmc/hibmc_drm_dp.c index d06832e62e96..123372ae2d40 100644 --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c @@ -12,6 +12,7 @@ =20 #include "hibmc_drm_drv.h" #include "dp/dp_hw.h" +#include "dp/dp_comm.h" =20 #define DP_MASKED_SINK_HPD_PLUG_INT BIT(2) =20 @@ -34,7 +35,16 @@ static int hibmc_dp_connector_get_modes(struct drm_conne= ctor *connector) static int hibmc_dp_detect(struct drm_connector *connector, struct drm_modeset_acquire_ctx *ctx, bool force) { - mdelay(200); + struct hibmc_dp *dp =3D to_hibmc_dp(connector); + int ret; + + ret =3D drm_dp_read_dpcd_caps(&dp->aux, dp->dp_dev->dpcd); + if (ret) + return connector_status_disconnected; + + ret =3D drm_dp_read_sink_count(&dp->aux); + if (ret <=3D 0) + return connector_status_disconnected; =20 return drm_connector_helper_detect_from_ddc(connector, ctx, force); } --=20 2.33.0