diff mbox series

drm/bridge: Add 200ms delay to wait FW HPD status stable

Message ID 20230921091435.3524869-1-xji@analogixsemi.com (mailing list archive)
State New, archived
Headers show
Series drm/bridge: Add 200ms delay to wait FW HPD status stable | expand

Commit Message

Xin Ji Sept. 21, 2023, 9:14 a.m. UTC
For the none-interrupt design(sink device is panel, polling HPD
status when chip power on), anx7625 FW has more than 200ms HPD
de-bounce time in FW, for the safety to get HPD status, driver
better to wait 200ms before HPD detection after OS resume back.

Signed-off-by: Xin Ji <xji@analogixsemi.com>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Jani Nikula Sept. 21, 2023, 12:09 p.m. UTC | #1
On Thu, 21 Sep 2023, Xin Ji <xji@analogixsemi.com> wrote:
> For the none-interrupt design(sink device is panel, polling HPD
> status when chip power on), anx7625 FW has more than 200ms HPD
> de-bounce time in FW, for the safety to get HPD status, driver
> better to wait 200ms before HPD detection after OS resume back.
>
> Signed-off-by: Xin Ji <xji@analogixsemi.com>
> ---
>  drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> index 51abe42c639e..833d6d50a03d 100644
> --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> @@ -1464,6 +1464,9 @@ static int _anx7625_hpd_polling(struct anx7625_data *ctx,
>  	if (ctx->pdata.intp_irq)
>  		return 0;
>  
> +	/* Delay 200ms for FW HPD de-bounce */
> +	usleep_range(200000, 201000);

If you need to sleep for 200 ms, maybe use msleep instead?

BR,
Jani.

> +
>  	ret = readx_poll_timeout(anx7625_read_hpd_status_p0,
>  				 ctx, val,
>  				 ((val & HPD_STATUS) || (val < 0)),
Laurent Pinchart Sept. 21, 2023, 12:13 p.m. UTC | #2
The subject line is missing the driver name.

On Thu, Sep 21, 2023 at 03:09:10PM +0300, Jani Nikula wrote:
> On Thu, 21 Sep 2023, Xin Ji <xji@analogixsemi.com> wrote:
> > For the none-interrupt design(sink device is panel, polling HPD

s/none-interrupt/no-interrupt/ ?

s/design/design /

> > status when chip power on), anx7625 FW has more than 200ms HPD
> > de-bounce time in FW, for the safety to get HPD status, driver
> > better to wait 200ms before HPD detection after OS resume back.
> >
> > Signed-off-by: Xin Ji <xji@analogixsemi.com>
> > ---
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 51abe42c639e..833d6d50a03d 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -1464,6 +1464,9 @@ static int _anx7625_hpd_polling(struct anx7625_data *ctx,
> >  	if (ctx->pdata.intp_irq)
> >  		return 0;
> >  
> > +	/* Delay 200ms for FW HPD de-bounce */
> > +	usleep_range(200000, 201000);
> 
> If you need to sleep for 200 ms, maybe use msleep instead?

fsleep() could be a nice replacement.

> > +
> >  	ret = readx_poll_timeout(anx7625_read_hpd_status_p0,
> >  				 ctx, val,
> >  				 ((val & HPD_STATUS) || (val < 0)),
Xin Ji Sept. 22, 2023, 6:57 a.m. UTC | #3
Hi Laurent Pinchart, thanks for reviewing, I'll update the new patch, thanks!
Xin

> -----Original Message-----
> From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Sent: Thursday, September 21, 2023 8:13 PM
> To: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Xin Ji <xji@analogixsemi.com>; Andrzej Hajda <andrzej.hajda@intel.com>;
> Neil Armstrong <neil.armstrong@linaro.org>; Robert Foss <rfoss@kernel.org>;
> Jonas Karlman <jonas@kwiboo.se>; Jernej Skrabec <jernej.skrabec@gmail.com>;
> David Airlie <airlied@gmail.com>; Daniel Vetter <daniel@ffwll.ch>; Qilin Wen
> <qwen@analogixsemi.com>; linux-kernel@vger.kernel.org; dri-
> devel@lists.freedesktop.org; hsinyi@chromium.org; Bernie Liang
> <bliang@analogixsemi.com>
> Subject: Re: [PATCH] drm/bridge: Add 200ms delay to wait FW HPD status stable
> 
> CAUTION: This email originated from outside of the organization. Please do not
> click links or open attachments unless you recognize the sender, and know the
> content is safe.
> 
> 
> The subject line is missing the driver name.
> 
> On Thu, Sep 21, 2023 at 03:09:10PM +0300, Jani Nikula wrote:
> > On Thu, 21 Sep 2023, Xin Ji <xji@analogixsemi.com> wrote:
> > > For the none-interrupt design(sink device is panel, polling HPD
> 
> s/none-interrupt/no-interrupt/ ?
OK
> 
> s/design/design /
OK
> 
> > > status when chip power on), anx7625 FW has more than 200ms HPD
> > > de-bounce time in FW, for the safety to get HPD status, driver
> > > better to wait 200ms before HPD detection after OS resume back.
> > >
> > > Signed-off-by: Xin Ji <xji@analogixsemi.com>
> > > ---
> > >  drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > > b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > > index 51abe42c639e..833d6d50a03d 100644
> > > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > > @@ -1464,6 +1464,9 @@ static int _anx7625_hpd_polling(struct
> anx7625_data *ctx,
> > >     if (ctx->pdata.intp_irq)
> > >             return 0;
> > >
> > > +   /* Delay 200ms for FW HPD de-bounce */
> > > +   usleep_range(200000, 201000);
> >
> > If you need to sleep for 200 ms, maybe use msleep instead?
> 
> fsleep() could be a nice replacement.
OK
> 
> > > +
> > >     ret = readx_poll_timeout(anx7625_read_hpd_status_p0,
> > >                              ctx, val,
> > >                              ((val & HPD_STATUS) || (val < 0)),
> 
> --
> Regards,
> 
> Laurent Pinchart
Xin Ji Sept. 22, 2023, 7 a.m. UTC | #4
Hi Jani Nikula, thanks for reviewing, I'll use msleep instead,  thanks!
Xin

> -----Original Message-----
> From: Jani Nikula <jani.nikula@linux.intel.com>
> Sent: Thursday, September 21, 2023 8:09 PM
> To: Xin Ji <xji@analogixsemi.com>; Andrzej Hajda <andrzej.hajda@intel.com>;
> Neil Armstrong <neil.armstrong@linaro.org>; Robert Foss <rfoss@kernel.org>;
> Laurent Pinchart <Laurent.pinchart@ideasonboard.com>; Jonas Karlman
> <jonas@kwiboo.se>; Jernej Skrabec <jernej.skrabec@gmail.com>; David Airlie
> <airlied@gmail.com>; Daniel Vetter <daniel@ffwll.ch>
> Cc: Qilin Wen <qwen@analogixsemi.com>; linux-kernel@vger.kernel.org; dri-
> devel@lists.freedesktop.org; hsinyi@chromium.org; Bernie Liang
> <bliang@analogixsemi.com>; Xin Ji <xji@analogixsemi.com>
> Subject: Re: [PATCH] drm/bridge: Add 200ms delay to wait FW HPD status stable
> 
> On Thu, 21 Sep 2023, Xin Ji <xji@analogixsemi.com> wrote:
> > For the none-interrupt design(sink device is panel, polling HPD status
> > when chip power on), anx7625 FW has more than 200ms HPD de-bounce time
> > in FW, for the safety to get HPD status, driver better to wait 200ms
> > before HPD detection after OS resume back.
> >
> > Signed-off-by: Xin Ji <xji@analogixsemi.com>
> > ---
> >  drivers/gpu/drm/bridge/analogix/anx7625.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > index 51abe42c639e..833d6d50a03d 100644
> > --- a/drivers/gpu/drm/bridge/analogix/anx7625.c
> > +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
> > @@ -1464,6 +1464,9 @@ static int _anx7625_hpd_polling(struct
> anx7625_data *ctx,
> >  	if (ctx->pdata.intp_irq)
> >  		return 0;
> >
> > +	/* Delay 200ms for FW HPD de-bounce */
> > +	usleep_range(200000, 201000);
> 
> If you need to sleep for 200 ms, maybe use msleep instead?
OK
> 
> BR,
> Jani.
> 
> > +
> >  	ret = readx_poll_timeout(anx7625_read_hpd_status_p0,
> >  				 ctx, val,
> >  				 ((val & HPD_STATUS) || (val < 0)),
> 
> --
> Jani Nikula, Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 51abe42c639e..833d6d50a03d 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1464,6 +1464,9 @@  static int _anx7625_hpd_polling(struct anx7625_data *ctx,
 	if (ctx->pdata.intp_irq)
 		return 0;
 
+	/* Delay 200ms for FW HPD de-bounce */
+	usleep_range(200000, 201000);
+
 	ret = readx_poll_timeout(anx7625_read_hpd_status_p0,
 				 ctx, val,
 				 ((val & HPD_STATUS) || (val < 0)),