All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Nick Bowler <nbowler@draconx.ca>
Cc: Archit Taneja <architt@codeaurora.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Dave Airlie <airlied@redhat.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Jose Abreu <Jose.Abreu@synopsys.com>
Subject: Re: PROBLEM: Asus C201 video mode problems on HDMI hotplug (regression)
Date: Tue, 05 Dec 2017 11:41:22 +0200	[thread overview]
Message-ID: <189080660.yi4IrDcgPy@avalon> (raw)
In-Reply-To: <20171205032228.m62nquqgrnswfbxl@aura.draconx.ca>

Hi Nick,

On Tuesday, 5 December 2017 05:22:28 EET Nick Bowler wrote:
> On 2017-12-04 21:34 +0200, Laurent Pinchart wrote:
> > On Monday, 4 December 2017 21:30:01 EET Nick Bowler wrote:
> >> On 2017-12-04 21:06 +0200, Laurent Pinchart wrote:
> >>> As you reported that the PLL lock failure message is not printed, the
> >>> failure can only come from either the extra delay introduced by the
> >>> above loop, or from reading the HDMI_PHY_STAT0 register.
> >>> 
> >>> How many iterations of the for loop execute before the condition
> >>> becomes true?
> >> 
> >> Judging from the log posted elsethread (where I added extra printouts),
> >> it seems to consistently become true on the second iteration.
> >> 
> >> I will try to rule out read side effects by replacing the polling loop
> >> with an unconditional delay.
> > 
> > You're reading my mind :-)
> 
> I did this test by applying the following patch on 4.15-rc1, and the
> problem remains.  So it appears the delay is responsible somehow.

That's interesting. I think it also means we really need to find the root 
cause, as otherwise your system would be susceptible to random malfunction if 
the scheduler ends up interrupting the power on sequence. That might not 
happen frequently, but would be much harder to debug.

> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index
> bf14214fa464..4aec4d5c130e 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1101,8 +1101,6 @@ static void dw_hdmi_phy_power_off(struct dw_hdmi
> *hdmi) static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi)
>  {
>         const struct dw_hdmi_phy_data *phy = hdmi->phy.data;
> -       unsigned int i;
> -       u8 val;
> 
>         if (phy->gen == 1) {
>                 dw_hdmi_phy_enable_powerdown(hdmi, false);
> @@ -1116,21 +1114,7 @@ static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi)
> dw_hdmi_phy_gen2_txpwron(hdmi, 1);
>         dw_hdmi_phy_gen2_pddq(hdmi, 0);
> 
> -       /* Wait for PHY PLL lock */
> -       for (i = 0; i < 5; ++i) {
> -               val = hdmi_readb(hdmi, HDMI_PHY_STAT0) &
> HDMI_PHY_TX_PHY_LOCK; -               if (val)
> -                       break;
> -
> -               usleep_range(1000, 2000);
> -       }
> -
> -       if (!val) {
> -               dev_err(hdmi->dev, "PHY PLL failed to lock\n");
> -               return -ETIMEDOUT;
> -       }
> -
> -       dev_dbg(hdmi->dev, "PHY PLL locked %u iterations\n", i);
> +       usleep_range(1000, 2000);
>         return 0;
>  }

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Nick Bowler <nbowler@draconx.ca>
Cc: Jose Abreu <Jose.Abreu@synopsys.com>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Dave Airlie <airlied@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: PROBLEM: Asus C201 video mode problems on HDMI hotplug (regression)
Date: Tue, 05 Dec 2017 11:41:22 +0200	[thread overview]
Message-ID: <189080660.yi4IrDcgPy@avalon> (raw)
In-Reply-To: <20171205032228.m62nquqgrnswfbxl@aura.draconx.ca>

Hi Nick,

On Tuesday, 5 December 2017 05:22:28 EET Nick Bowler wrote:
> On 2017-12-04 21:34 +0200, Laurent Pinchart wrote:
> > On Monday, 4 December 2017 21:30:01 EET Nick Bowler wrote:
> >> On 2017-12-04 21:06 +0200, Laurent Pinchart wrote:
> >>> As you reported that the PLL lock failure message is not printed, the
> >>> failure can only come from either the extra delay introduced by the
> >>> above loop, or from reading the HDMI_PHY_STAT0 register.
> >>> 
> >>> How many iterations of the for loop execute before the condition
> >>> becomes true?
> >> 
> >> Judging from the log posted elsethread (where I added extra printouts),
> >> it seems to consistently become true on the second iteration.
> >> 
> >> I will try to rule out read side effects by replacing the polling loop
> >> with an unconditional delay.
> > 
> > You're reading my mind :-)
> 
> I did this test by applying the following patch on 4.15-rc1, and the
> problem remains.  So it appears the delay is responsible somehow.

That's interesting. I think it also means we really need to find the root 
cause, as otherwise your system would be susceptible to random malfunction if 
the scheduler ends up interrupting the power on sequence. That might not 
happen frequently, but would be much harder to debug.

> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index
> bf14214fa464..4aec4d5c130e 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1101,8 +1101,6 @@ static void dw_hdmi_phy_power_off(struct dw_hdmi
> *hdmi) static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi)
>  {
>         const struct dw_hdmi_phy_data *phy = hdmi->phy.data;
> -       unsigned int i;
> -       u8 val;
> 
>         if (phy->gen == 1) {
>                 dw_hdmi_phy_enable_powerdown(hdmi, false);
> @@ -1116,21 +1114,7 @@ static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi)
> dw_hdmi_phy_gen2_txpwron(hdmi, 1);
>         dw_hdmi_phy_gen2_pddq(hdmi, 0);
> 
> -       /* Wait for PHY PLL lock */
> -       for (i = 0; i < 5; ++i) {
> -               val = hdmi_readb(hdmi, HDMI_PHY_STAT0) &
> HDMI_PHY_TX_PHY_LOCK; -               if (val)
> -                       break;
> -
> -               usleep_range(1000, 2000);
> -       }
> -
> -       if (!val) {
> -               dev_err(hdmi->dev, "PHY PLL failed to lock\n");
> -               return -ETIMEDOUT;
> -       }
> -
> -       dev_dbg(hdmi->dev, "PHY PLL locked %u iterations\n", i);
> +       usleep_range(1000, 2000);
>         return 0;
>  }

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-12-05  9:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02  5:16 PROBLEM: Asus C201 video mode problems on HDMI hotplug (regression) Nick Bowler
2017-11-05 16:41 ` Nick Bowler
2017-11-16  6:28   ` Nick Bowler
2017-11-27  4:05     ` Archit Taneja
2017-11-27  4:05       ` Archit Taneja
2017-11-27  9:00       ` Laurent Pinchart
2017-11-27  9:00         ` Laurent Pinchart
2017-11-27 16:34         ` Nick Bowler
2017-11-28  3:30         ` Nick Bowler
2017-12-01  0:11           ` Nick Bowler
2017-12-02 17:11             ` Jose Abreu
2017-12-02 17:11               ` Jose Abreu
2017-12-03  5:20               ` Nick Bowler
2017-12-04 10:04                 ` Jose Abreu
2017-12-04 10:04                   ` Jose Abreu
2017-12-04 18:33                   ` Nick Bowler
2017-12-05  6:18                     ` Nick Bowler
2017-12-04 19:06             ` Laurent Pinchart
2017-12-04 19:06               ` Laurent Pinchart
2017-12-04 19:30               ` Nick Bowler
2017-12-04 19:34                 ` Laurent Pinchart
2017-12-05  3:22                   ` Nick Bowler
2017-12-05  9:41                     ` Laurent Pinchart [this message]
2017-12-05  9:41                       ` Laurent Pinchart

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=189080660.yi4IrDcgPy@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@redhat.com \
    --cc=architt@codeaurora.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbowler@draconx.ca \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.