mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Yongbang Shi <shiyongbang@huawei.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, lidongming5@huawei.com,
	libaihan@huawei.com, shenjian15@huawei.com, shaojijie@huawei.com,
	jani.nikula@linux.intel.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH drm-dp 02/10] drm/hisilicon/hibmc: fix dp probabilistical detect errors after HPD irq
Date: Mon, 9 Jun 2025 17:49:04 +0300	[thread overview]
Message-ID: <a5658165-9e8a-49e6-b2ed-75b25c074b87@oss.qualcomm.com> (raw)
In-Reply-To: <49a4644d-0e73-419a-aa53-0db69bd00833@huawei.com>

On 09/06/2025 17:47, Yongbang Shi wrote:
> 
>> On Fri, May 30, 2025 at 05:54:24PM +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.
>>>
>>> Fixes: 3c7623fb5bb6 ("drm/hisilicon/hibmc: Enable this hot plug 
>>> detect of irq feature")
>>> Signed-off-by: Baihan Li <libaihan@huawei.com>
>>> ---
>>>   drivers/gpu/drm/hisilicon/hibmc/dp/dp_hw.h    |  1 +
>>>   .../gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c    | 38 +++++++++++++------
>>>   2 files changed, 28 insertions(+), 11 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..191fb434baa7 100644
>>> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
>>> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_dp.c
>>> @@ -13,7 +13,8 @@
>>>   #include "hibmc_drm_drv.h"
>>>   #include "dp/dp_hw.h"
>>> -#define DP_MASKED_SINK_HPD_PLUG_INT    BIT(2)
>>> +#define HIBMC_DP_MASKED_SINK_HPD_PLUG_INT    BIT(2)
>>> +#define HIBMC_DP_MASKED_SINK_HPD_UNPLUG_INT    BIT(3)
>>>   static int hibmc_dp_connector_get_modes(struct drm_connector 
>>> *connector)
>>>   {
>>> @@ -34,9 +35,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,22 +119,34 @@ 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) {
>>> -        drm_dbg_dp(&priv->dev, "HPD IN isr occur!\n");
>>> -        hibmc_dp_hpd_cfg(&priv->dp);
>>> +    if (dp->hpd_status) { /* only check unplug int when the last 
>>> status is HPD in */
>> I think this way you'll ignore HPD short pulses. Could you possibly
>> clarify whether it is the case or not?
> 
> We actually doesn't enable short HPD here, this feature just used in our 
> electrical tests.
> 
> 
>>> +        if ((dp->irq_status & HIBMC_DP_MASKED_SINK_HPD_UNPLUG_INT)) {
>>> +            drm_dbg_dp(dev, "HPD OUT isr occur.");
>>> +            hibmc_dp_reset_link(dp);
>>> +            dp->hpd_status = 0;
>>> +            if (dev->registered)
>>> +                drm_connector_helper_hpd_irq_event(&dp->connector);
>>> +        } else {
>>> +            drm_warn(dev, "HPD OUT occurs, irq status err: %u", dp- 
>>> >irq_status);
>> These should be ratelimited.
> 
> Sorry, I didn't get it. Do you mean I need print the link rate here?
> 

No, I was thinking about drm_err_ratelimited() in case something gets 
stuck in the hw.

-- 
With best wishes
Dmitry

  reply	other threads:[~2025-06-09 14:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30  9:54 [PATCH drm-dp 00/10] Fix hibmc driver bugs Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 01/10] drm/hisilicon/hibmc: fix the i2c device resource leak when vdac init failed Yongbang Shi
2025-06-08 11:20   ` Dmitry Baryshkov
2025-06-09 14:45     ` Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 02/10] drm/hisilicon/hibmc: fix dp probabilistical detect errors after HPD irq Yongbang Shi
2025-06-08 11:37   ` Dmitry Baryshkov
2025-06-09 14:47     ` Yongbang Shi
2025-06-09 14:49       ` Dmitry Baryshkov [this message]
2025-06-10 13:26         ` Yongbang Shi
2025-06-09 16:57       ` Dmitry Baryshkov
2025-05-30  9:54 ` [PATCH drm-dp 03/10] drm/hisilicon/hibmc: fix irq_request()'s irq name variable is local Yongbang Shi
2025-06-08 11:43   ` Dmitry Baryshkov
2025-06-09 14:50     ` Yongbang Shi
2025-06-09 14:53       ` Dmitry Baryshkov
2025-06-10 13:28         ` Yongbang Shi
2025-06-16  9:27         ` Zenghui Yu
2025-05-30  9:54 ` [PATCH drm-dp 04/10] drm/hisilicon/hibmc: fix the hibmc loaded failed bug Yongbang Shi
     [not found]   ` <b0587eda-df65-4abc-b2af-c5dcb717c8b6@163.com>
2025-06-06  8:20     ` Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 05/10] drm/hisilicon/hibmc: fix rare monitors cannot display problem Yongbang Shi
2025-06-08 12:36   ` Dmitry Baryshkov
2025-06-09 14:56     ` Yongbang Shi
2025-06-09 18:53       ` Dmitry Baryshkov
2025-05-30  9:54 ` [PATCH drm-dp 06/10] drm/hisilicon/hibmc: add dp mode valid check Yongbang Shi
2025-06-08 12:39   ` Dmitry Baryshkov
2025-06-09 14:57     ` Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 07/10] drm/hisilicon/hibmc: add dp encoder modeset Yongbang Shi
2025-06-08 12:41   ` Dmitry Baryshkov
2025-06-10 13:30     ` Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 08/10] drm/hisilicon/hibmc: fix DP no showing after HPD with VGA connected Yongbang Shi
2025-06-08 12:44   ` Dmitry Baryshkov
2025-06-10 13:31     ` Yongbang Shi
2025-06-10 14:03     ` Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 09/10] drm/hisilicon/hibmc: fix HPD no showing with VGA para of GRUB Yongbang Shi
2025-06-08 12:47   ` Dmitry Baryshkov
2025-06-11 12:54     ` Yongbang Shi
2025-05-30  9:54 ` [PATCH drm-dp 10/10] drm/hisilicon/hibmc: fix no showing problem with loading hibmc manually Yongbang Shi
2025-06-08 12:54   ` Dmitry Baryshkov
2025-06-11 12:52     ` Yongbang Shi

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=a5658165-9e8a-49e6-b2ed-75b25c074b87@oss.qualcomm.com \
    --to=dmitry.baryshkov@oss.qualcomm.com \
    --cc=airlied@gmail.com \
    --cc=chenjianmin@huawei.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=liangjian010@huawei.com \
    --cc=libaihan@huawei.com \
    --cc=lidongming5@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=shiyongbang@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

all inboxes | Powered by JetHome®