dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jitao Shi <jitao.shi@mediatek.com>
To: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: "CK Hu (胡俊光)" <ck.hu@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable()
Date: Wed, 29 May 2019 18:48:39 +0800	[thread overview]
Message-ID: <1559126919.12097.6.camel@mszsdaap41> (raw)
In-Reply-To: <CAJMQK-g3JZ3Eg5U9OmYP9UU3k22VXGWOvZSBrFtAFFHw0Uq0cA@mail.gmail.com>

On Fri, 2019-03-22 at 13:05 +0800, Hsin-Yi Wang wrote:
> On Fri, Mar 22, 2019 at 9:21 AM CK Hu <ck.hu@mediatek.com> wrote:
> >
> > Hi, Hsin-yi:
> >
> > On Thu, 2019-03-21 at 22:09 +0800, Hsin-Yi Wang wrote:
> > > On Thu, Mar 21, 2019 at 9:46 AM CK Hu <ck.hu@mediatek.com> wrote:
> > > >
> > > > Hi, Hsin-yi:
> > > >
> > > > On Thu, 2019-03-21 at 09:28 +0800, CK Hu wrote:
> > > > > Hi, Hsin-yi:
> > > > >
> > > > > On Wed, 2019-03-20 at 15:18 +0800, Hsin-Yi Wang wrote:
> > > > > > mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), which needs
> > > > > > ovl irq for drm_crtc_wait_one_vblank(), since after mtk_dsi_stop() is called,
> > > > > > ovl irq will be disabled. If drm_crtc_wait_one_vblank() is called after last
> > > > > > irq, it will timeout with this message: "vblank wait timed out on crtc 0". This
> > > > > > happens sometimes when turning off the screen.
> > > > > >
> > > > > > In drm_atomic_helper.c#disable_outputs(),
> > > > > > the calling sequence when turning off the screen is:
> > > > > >
> > > > > > 1. mtk_dsi_encoder_disable()
> > > > > >      --> mtk_output_dsi_disable()
> > > > > >        --> mtk_dsi_stop();  // sometimes make vblank timeout in atomic_disable
> > > > > >        --> mtk_dsi_poweroff();
> > > > > > 2. mtk_drm_crtc_atomic_disable()
> > > > > >      --> drm_crtc_wait_one_vblank();
> > > > > >      ...
> > > > > >        --> mtk_dsi_ddp_stop()
> > > > > >          --> mtk_dsi_poweroff();
> > > > > >
> > > > > > mtk_dsi_poweroff() has reference count design, change to make mtk_dsi_stop()
> > > > > > called in mtk_dsi_poweroff() when refcount is 0.
> > > > > >
> > > > > > Fixes: 0707632b5bac ("drm/mediatek: update DSI sub driver flow for sending commands to panel")
> > > > > > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> > > > > > ---
> > > > > > change log:
> > > > > > v1->v2:
> > > > > >  * update commit message.
> > > > > >  * call mtk_dsi_stop() in mtk_dsi_poweroff() when refcount is 0.
> > > > > > ---
> > > > > >  drivers/gpu/drm/mediatek/mtk_dsi.c | 5 ++++-
> > > > > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > index b00eb2d2e086..e152f37af57d 100644
> > > > > > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > > > > > @@ -630,6 +630,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> > > > > >     if (--dsi->refcount != 0)
> > > > > >             return;
> > > > > >
> > > > > > +   mtk_dsi_stop(dsi);
> > > > > > +
> > > > > >     if (!mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500)) {
> > > > > >             if (dsi->panel) {
> > > > > >                     if (drm_panel_unprepare(dsi->panel)) {
> > > > >
> > > > > I think you just move mtk_dsi_stop() into mtk_dsi_poweroff() would works
> > > > > fine, but I would rather like calling mtk_dsi_start() and mtk_dsi_stop()
> > > > > in a symmetric manner. That means you may also move below functions into
> > > > > mtk_dsi_poweron():
> > > > >
> > > > > mtk_dsi_set_mode(dsi);
> > > > > mtk_dsi_clk_hs_mode(dsi, 1);
> > > > > mtk_dsi_start(dsi);
> > >
> > > For MT8183 with bridge panel, calling mtk_dsi_start() in
> > > mtk_dsi_poweron() when refcount is 0->1, like the following order,
> > > will results in no irq, not sure why though. I think this might be the
> > > timing issue you mentioned in patch v1. (MT8183 without bridge panel
> > > doesn't have this issue.)
> > >
> > > atomic_enable
> > >   --> mtk_crtc_ddp_hw_init
> > >     --> mtk_dsi_ddp_start
> > >       --> mtk_dsi_poweron (ref 0->1)
> > >         --> drm_panel_prepare
> > >         --> *mtk_dsi_start  // results in no irq for MT8183 with bridge
> > >   --> drm_crtc_vblank_on
> > >
> > > mtk_output_dsi_enable
> > >   --> mtk_dsi_poweron (ref 1->2, ignored)
> > >   --> mtk_dsi_start //original position
> > >
> > > For mtk_dsi_stop() both with or without bridge is fine.
> Add cc Jitao.
> 
> Hi Jitao,
> Do you know if this is a known hardware behavior?
> 
> Thanks

mtk_dsi_start must after dsi full setting.

If you put it in mtk_dsi_ddp_start, mtk_dsi_set_mode won't work. DSI
will keep cmd mode. So you see no irq.

I think we show keep the mtk_dsi_start in mtk_output_dsi_enable 

Best Regards
Jitao

> >
> > I'm not familiar with dsi hardware, so I could not answer why this
> > problem happen. Jitao is familiar with dsi hardware, you may ask him for
> > help. If this is hardware behavior, I could accept asymmetric flow, but
> > please be sure this is hardware behavior not software bug.
> >
> > Regards,
> > CK
> >
> > >
> > > > >
> > > > >
> > > > > > @@ -696,7 +698,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
> > > > > >             }
> > > > > >     }
> > > > > >
> > > > > > -   mtk_dsi_stop(dsi);
> > > > > >     mtk_dsi_poweroff(dsi);
> > > > > >
> > > > > >     dsi->enabled = false;
> > > > > > @@ -1178,6 +1179,8 @@ static int mtk_dsi_remove(struct platform_device *pdev)
> > > > > >     struct mtk_dsi *dsi = platform_get_drvdata(pdev);
> > > > > >
> > > > > >     mtk_output_dsi_disable(dsi);
> > > > > > +   mtk_dsi_stop(dsi);
> > > > > > +   mtk_dsi_poweroff(dsi);
> > > > >
> > > > > I think mtk_output_dsi_disable() would call mtk_dsi_poweroff(), and
> > > > > mtk_dsi_poweroff() would call mtk_dsi_stop(), so these two line are
> > > > > redundant. And I think you should remove mtk_dsi_stop() in
> > > > > mtk_output_dsi_disable(), why not in this patch?
> > > >
> > > > You've removed mtk_dsi_stop() in mtk_output_dsi_disable(), I just miss
> > > > it, sorry for this.
> > > >
> > > > Regards,
> > > > CK
> > > >
> > > > >
> > > > > Regards,
> > > > > CK
> > > > >
> > > > > >     component_del(&pdev->dev, &mtk_dsi_component_ops);
> > > > > >
> > > > > >     return 0;
> > > > >
> > > >
> > > >
> >
> >

      reply	other threads:[~2019-05-29 10:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20  7:18 [PATCH v2] gpu/drm: mediatek: call mtk_dsi_stop() after mtk_drm_crtc_atomic_disable() Hsin-Yi Wang
2019-03-20 18:01 ` Aw: " Frank Wunderlich
2019-03-21  1:36   ` CK Hu
2019-03-21  1:28 ` CK Hu
2019-03-21  1:46   ` CK Hu
2019-03-21 14:09     ` Hsin-Yi Wang
2019-03-22  1:21       ` CK Hu
2019-03-22  5:05         ` Hsin-Yi Wang
2019-05-29 10:48           ` Jitao Shi [this message]

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=1559126919.12097.6.camel@mszsdaap41 \
    --to=jitao.shi@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hsinyi@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).