dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jitao Shi <jitao.shi@mediatek.com>
To: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	DTML <devicetree@vger.kernel.org>,
	srv_heupstream <srv_heupstream@mediatek.com>,
	"David Airlie" <airlied@linux.ie>,
	"Huijuan Xie (谢慧娟)" <Huijuan.Xie@mediatek.com>,
	"stonea168@163.com" <stonea168@163.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"DRI Development" <dri-devel@lists.freedesktop.org>,
	"Cawa Cheng (鄭曄禧)" <cawa.cheng@mediatek.com>,
	"Rex-BC Chen (陳柏辰)" <Rex-BC.Chen@mediatek.com>,
	"Rob Herring" <robh+dt@kernel.org>,
	"moderated list:ARM/Mediatek SoC support"
	<linux-mediatek@lists.infradead.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Yingjoe Chen (陳英洲)" <Yingjoe.Chen@mediatek.com>,
	"Eddie Huang (黃智傑)" <eddie.huang@mediatek.com>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 3/4] drm/mediatek: fine tune the dsi panel's power sequence
Date: Wed, 19 May 2021 11:54:46 +0800	[thread overview]
Message-ID: <1621396486.18307.22.camel@mszsdaap41> (raw)
In-Reply-To: <CAAOTY_-SKcX+4U5hKOgRaip-vk+ofEWe_g4VNUxFjN7LCprq1w@mail.gmail.com>

On Sat, 2021-04-24 at 00:36 +0800, Chun-Kuang Hu wrote:
> Hi, Jitao:
> 
> Jitao Shi <jitao.shi@mediatek.com> 於 2021年4月20日 週二 下午9:26寫道:
> >
> > Add the drm_panel_prepare_power and drm_panel_unprepare_power control.
> > Turn on panel power(drm_panel_prepare_power) and control before dsi
> > enable. And then dsi enable, send dcs cmd in drm_panel_prepare, last
> > turn on backlight.
> 
> Please describe WHY do you need this patch? Fix any bug?

Most panels, have five steps when poweron.

1. turn on dsi signal to LP11   --> dsi host's action
2. turn on the power supplies,  --> panel's action
3. send the DCS  cmd to panel   --> panel's action
4. start send video stream      --> dsi host's action
5. turn on backlight.           --> panel's action

we put "turn on the power supplies" and "send the DCS  cmd to panel" in
panel_prepare. And "turn on backlight" in panel_enable.

But some other panels has a special poweron sequence as the following.

1. turn on the power supplies,  --> panel's action
2. turn on dsi signal to LP11   --> dsi host's action
3. send the DCS  cmd to panel   --> panel's action
4. start send video stream      --> dsi host's action
5. turn on backlight.           --> panel's action

panel's actions are divided into three parts.

So I add a new api "drm_panel_prepare_power/rm_panel_unprepare_power" to
control the sequence.


Best Regards
Jitao

> 
> >
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > ---
> >  drivers/gpu/drm/mediatek/mtk_dsi.c | 12 ++++++++++--
> >  1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > index a1ff152ef468..455fe582c6b5 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> > @@ -615,10 +615,13 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
> >         dsi->data_rate = DIV_ROUND_UP_ULL(dsi->vm.pixelclock * bit_per_pixel,
> >                                           dsi->lanes);
> >
> > +       if (panel_bridge_prepare_power(dsi->next_bridge))
> 
> ret = panel_bridge_prepare_power(dsi->next_bridge);
> if (ret)
> 
> > +               DRM_INFO("can't prepare power the panel\n");
> 
> I think you should goto err_refcount;

Thanks for your review. I'll fix it next patch.

> 
> > +
> >         ret = clk_set_rate(dsi->hs_clk, dsi->data_rate);
> >         if (ret < 0) {
> >                 dev_err(dev, "Failed to set data rate: %d\n", ret);
> > -               goto err_refcount;
> > +               goto err_prepare_power;
> >         }
> >
> >         phy_power_on(dsi->phy);
> > @@ -661,7 +664,9 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
> >         clk_disable_unprepare(dsi->engine_clk);
> >  err_phy_power_off:
> >         phy_power_off(dsi->phy);
> > -err_refcount:
> > +err_prepare_power:
> > +       if (panel_bridge_unprepare_power(dsi->next_bridge))
> 
> ret = panel_bridge_unprepare_power(dsi->next_bridge);
> 
> > +               DRM_INFO("Can't unprepare power the panel\n");
> >         dsi->refcount--;
> >         return ret;
> >  }
> > @@ -694,6 +699,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
> >         clk_disable_unprepare(dsi->digital_clk);
> >
> >         phy_power_off(dsi->phy);
> > +
> > +       if (panel_bridge_unprepare_power(dsi->next_bridge))
> 
> ret = panel_bridge_unprepare_power(dsi->next_bridge);
> 
> > +               DRM_INFO("Can't unprepare power the panel\n");
> >  }
> >
> >  static void mtk_output_dsi_enable(struct mtk_dsi *dsi)
> > --
> > 2.25.1
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel


  reply	other threads:[~2021-05-19  4:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20 13:26 [PATCH 1/4] drm/panel: seperate panel power control from panel prepare/unprepare Jitao Shi
2021-04-20 13:26 ` [PATCH 2/4] drm/panel: boe-tv101wum-n16 seperate the panel power control Jitao Shi
2021-04-20 13:26 ` [PATCH 3/4] drm/mediatek: fine tune the dsi panel's power sequence Jitao Shi
2021-04-23 16:36   ` Chun-Kuang Hu
2021-05-19  3:54     ` Jitao Shi [this message]
2021-04-20 13:26 ` [PATCH 4/4] drm/mediatek: add dsi module reset driver Jitao Shi
2021-04-23 23:50   ` Chun-Kuang Hu
2021-05-19  5:31     ` Jitao 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=1621396486.18307.22.camel@mszsdaap41 \
    --to=jitao.shi@mediatek.com \
    --cc=Huijuan.Xie@mediatek.com \
    --cc=Rex-BC.Chen@mediatek.com \
    --cc=Yingjoe.Chen@mediatek.com \
    --cc=airlied@linux.ie \
    --cc=cawa.cheng@mediatek.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eddie.huang@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=stonea168@163.com \
    /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).