From: Yongbang Shi <shiyongbang@huawei.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: <xinliang.liu@linaro.org>, <tiantao6@hisilicon.com>,
<maarten.lankhorst@linux.intel.com>, <mripard@kernel.org>,
<tzimmermann@suse.de>, <airlied@gmail.com>, <daniel@ffwll.ch>,
<kong.kongxinwei@hisilicon.com>, <liangjian010@huawei.com>,
<chenjianmin@huawei.com>, <fengsheng5@huawei.com>,
<libaihan@huawei.com>, <shenjian15@huawei.com>,
<shaojijie@huawei.com>, <dri-devel@lists.freedesktop.org>,
<linux-kernel@vger.kernel.org>, <shiyongbang@huawei.com>
Subject: Re: [PATCH v4 drm-dp 02/11] drm/hisilicon/hibmc: fix dp probabilistical detect errors after HPD irq
Date: Thu, 11 Sep 2025 17:32:40 +0800 [thread overview]
Message-ID: <8bbfd02f-138d-420c-b456-10d0c913f46e@huawei.com> (raw)
In-Reply-To: <ce47v3y77uc4dunlwyvmfe6j7d7mza4zfrbvu5dz67t66jdlop@vqgv47saj37i>
> On Thu, Aug 14, 2025 at 08:19:41PM +0800, Yongbang Shi wrote:
>>> On Wed, Aug 13, 2025 at 05:42:29PM +0800, Yongbang Shi wrote:
>>>> From: Baihan Li <libaihan@huawei.com>
>>>>
>>>> The debouncing when HPD pulled out still remains sometimes, 200ms still can
>>>> not ensure helper_detect() is correct. So add a flag to hold the sink
>>>> status, and changed detect_ctx() functions by using flag to check status.
>>> THis doesn't explain what is wrong with
>>> drm_connector_helper_detect_from_ddc(). In the end, this function
>>> doesn't use the HPD pin.
>> I'm sorry about the misunderstanding.
>> The issue is that after plugging or unplugging the monitor, the driver takes no action sometimes
>> even though an interrupt is triggered. The root cause is that drm_connector_helper_detect_from_ddc()
>> still returns connected status when the monitor is unplugged.
>> And I will fix the way in the end.
> Can you perform a normal DP detection: read DPCD and check that there is
> a DPRX attached and that it's either non-branch device or it has one or
> more sinks?
I'm very sorry that I didn't get the last sentence's asking before.
It's a non-branch device. We just connect a DP monitor.
Thanks,
Baihan Li!
>> Thanks,
>> Baihan Li!
>>
>>
>>>> Fixes: 3c7623fb5bb6 ("drm/hisilicon/hibmc: Enable this hot plug detect of irq feature")
>>>> Signed-off-by: Baihan Li <libaihan@huawei.com>
>>>> Signed-off-by: Yongbang Shi <shiyongbang@huawei.com>
>>>> ---
>>>> ChangeLog:
>>>> v3 -> v4:
>>>> - remove link training process in hibmc_dp_detect(), suggested by Dmitry Baryshkov.
>>>> - remove if (dev->registered), suggested by Dmitry Baryshkov.
>>>> ---
>>>> drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.h | 1 +
>>>> .../gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c | 19 ++++++++++++-------
>>>> 2 files changed, 13 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.h b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.h
>>>> index 665f5b166dfb..68867475508c 100644
>>>> --- a/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.h
>>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.h
>>>> @@ -50,6 +50,7 @@ struct hibmc_dp {
>>>> struct drm_dp_aux aux;
>>>> struct hibmc_dp_cbar_cfg cfg;
>>>> u32 irq_status;
>>>> + int hpd_status;
>>>> };
>>>> int hibmc_dp_hw_init(struct hibmc_dp *dp);
>>>> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
>>>> index d06832e62e96..ded38530ecda 100644
>>>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
>>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
>>>> @@ -34,9 +34,12 @@ static int hibmc_dp_connector_get_modes(struct drm_connector *connector)
>>>> static int hibmc_dp_detect(struct drm_connector *connector,
>>>> struct drm_modeset_acquire_ctx *ctx, bool force)
>>>> {
>>>> - mdelay(200);
>>>> + struct hibmc_dp *dp = to_hibmc_dp(connector);
>>>> - return drm_connector_helper_detect_from_ddc(connector, ctx, force);
>>>> + if (dp->hpd_status)
>>>> + return connector_status_connected;
>>>> + else
>>>> + return connector_status_disconnected;
>>>> }
>>>> static const struct drm_connector_helper_funcs hibmc_dp_conn_helper_funcs = {
>>>> @@ -115,21 +118,23 @@ irqreturn_t hibmc_dp_hpd_isr(int irq, void *arg)
>>>> {
>>>> struct drm_device *dev = (struct drm_device *)arg;
>>>> struct hibmc_drm_private *priv = to_hibmc_drm_private(dev);
>>>> + struct hibmc_dp *dp = &priv->dp;
>>>> int idx;
>>>> if (!drm_dev_enter(dev, &idx))
>>>> return -ENODEV;
>>>> - if (priv->dp.irq_status & DP_MASKED_SINK_HPD_PLUG_INT) {
>>>> + if (((dp->irq_status & DP_MASKED_SINK_HPD_PLUG_INT) && !dp->hpd_status)) {
>>>> drm_dbg_dp(&priv->dev, "HPD IN isr occur!\n");
>>>> - hibmc_dp_hpd_cfg(&priv->dp);
>>>> + hibmc_dp_hpd_cfg(dp);
>>>> + dp->hpd_status = 1;
>>>> } else {
>>>> drm_dbg_dp(&priv->dev, "HPD OUT isr occur!\n");
>>>> - hibmc_dp_reset_link(&priv->dp);
>>>> + hibmc_dp_reset_link(dp);
>>>> + dp->hpd_status = 0;
>>>> }
>>>> - if (dev->registered)
>>>> - drm_connector_helper_hpd_irq_event(&priv->dp.connector);
>>>> + drm_connector_helper_hpd_irq_event(&priv->dp.connector);
>>>> drm_dev_exit(idx);
>>>> --
>>>> 2.33.0
>>>>
next prev parent reply other threads:[~2025-09-11 9:32 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 9:42 [PATCH v4 drm-dp 00/11] Fix hibmc driver bugs Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 01/11] drm/hisilicon/hibmc: fix the i2c device resource leak when vdac init failed Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 02/11] drm/hisilicon/hibmc: fix dp probabilistical detect errors after HPD irq Yongbang Shi
2025-08-14 9:05 ` Dmitry Baryshkov
2025-08-14 12:19 ` Yongbang Shi
2025-08-16 22:32 ` Dmitry Baryshkov
2025-08-18 7:42 ` Yongbang Shi
2025-09-11 9:32 ` Yongbang Shi [this message]
2025-09-11 10:18 ` Dmitry Baryshkov
2025-09-12 1:23 ` Yongbang Shi
2025-09-12 11:25 ` Dmitry Baryshkov
2025-09-15 12:25 ` Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 03/11] drm/hisilicon/hibmc: fix irq_request()'s irq name variable is local Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 04/11] drm/hisilicon/hibmc: fix the hibmc loaded failed bug Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 05/11] drm/hisilicon/hibmc: fix rare monitors cannot display problem Yongbang Shi
2025-08-16 22:33 ` Dmitry Baryshkov
2025-08-13 9:42 ` [PATCH v4 drm-dp 06/11] drm/hisilicon/hibmc: add dp mode valid check Yongbang Shi
2025-08-17 15:18 ` Dmitry Baryshkov
2025-08-17 15:32 ` Dmitry Baryshkov
2025-08-18 7:43 ` Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 07/11] drm/hisilicon/hibmc: fix dp and vga cannot show together Yongbang Shi
2025-08-16 22:44 ` Dmitry Baryshkov
2025-08-13 9:42 ` [PATCH v4 drm-dp 08/11] drm/hisilicon/hibmc: fix no showing when no connectors connected Yongbang Shi
2025-08-17 13:09 ` Dmitry Baryshkov
2025-08-18 7:44 ` Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 09/11] drm/hisilicon/hibmc: fix no showing problem with loading hibmc manually Yongbang Shi
2025-08-13 9:42 ` [PATCH v4 drm-dp 10/11] drm/hisilicon/hibmc: Adding reset colorbar cfg in dp init Yongbang Shi
2025-08-17 13:17 ` Dmitry Baryshkov
2025-08-13 9:42 ` [PATCH v4 drm-dp 11/11] drm/hisilicon/hibmc: moving HDCP cfg after the dp reset operation Yongbang Shi
2025-08-17 13:18 ` Dmitry Baryshkov
2025-08-18 7:44 ` Yongbang Shi
2025-08-17 15:34 ` (subset) [PATCH v4 drm-dp 00/11] Fix hibmc driver bugs Dmitry Baryshkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8bbfd02f-138d-420c-b456-10d0c913f46e@huawei.com \
--to=shiyongbang@huawei.com \
--cc=airlied@gmail.com \
--cc=chenjianmin@huawei.com \
--cc=daniel@ffwll.ch \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fengsheng5@huawei.com \
--cc=kong.kongxinwei@hisilicon.com \
--cc=liangjian010@huawei.com \
--cc=libaihan@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=shaojijie@huawei.com \
--cc=shenjian15@huawei.com \
--cc=tiantao6@hisilicon.com \
--cc=tzimmermann@suse.de \
--cc=xinliang.liu@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox