linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: Konrad Dybcio <konradybcio@gmail.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>, Daniel Vetter <daniel@ffwll.ch>,
	Rob Herring <robh+dt@kernel.org>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/panel: Add Truly NT35521 panel driver
Date: Sun, 8 Aug 2021 17:29:30 +0200	[thread overview]
Message-ID: <YQ/4WkA9ajpQx06A@gerhold.net> (raw)
In-Reply-To: <20210808134456.GB6795@dragon>

On Sun, Aug 08, 2021 at 09:44:57PM +0800, Shawn Guo wrote:
> On Wed, Aug 04, 2021 at 02:09:19PM +0200, Stephan Gerhold wrote:
> > On Wed, Aug 04, 2021 at 04:13:52PM +0800, Shawn Guo wrote:
> > > + ...
> > > +	nt_dcs_write(0xb1, 0x6c, 0x21);
> > > +	nt_dcs_write(0xf0, 0x55, 0xaa, 0x52, 0x00, 0x00);
> > > +	nt_dcs_write(0x35, 0x00);
> > > +	nt_gen_write(0x11, 0x00);
> > > +	msleep(120);
> > > +	nt_gen_write(0x29, 0x00);
> > > +	usleep_range(1000, 1500);
> > > +	nt_dcs_write(0x53, 0x24);
> > 
> > Did you mix up "nt_dcs_write" and "nt_gen_write" here?
> > The nt_gen_write(0x11, 0x00); looks like MIPI_DCS_EXIT_SLEEP_MODE
> > and the nt_gen_write(0x29, 0x00); looks like MIPI_DCS_SET_DISPLAY_ON.
> > 
> > For reference you can pull your original reference DTB from Sony through
> > my panel driver generator: https://github.com/msm8916-mainline/linux-mdss-dsi-panel-driver-generator
> 
> Wow, very nice!  It really deserves wider spread!
> 
> > 
> > It produces the following (I compiled "msm8939-kanuti_tulip.dtb"
> > from https://github.com/sonyxperiadev/kernel/tree/aosp/LA.BR.1.3.3_rb2.14,
> > not sure if that is right):
> > 
> > 	// ...
> > 	dsi_generic_write_seq(dsi, 0x35, 0x00);
> > 
> > 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> > 	if (ret < 0) {
> > 		dev_err(dev, "Failed to exit sleep mode: %d\n", ret);
> > 		return ret;
> > 	}
> > 	msleep(120);
> > 
> > 	ret = mipi_dsi_dcs_set_display_on(dsi);
> > 	if (ret < 0) {
> > 		dev_err(dev, "Failed to set display on: %d\n", ret);
> > 		return ret;
> > 	}
> > 	usleep_range(1000, 2000);
> > 
> > 	dsi_generic_write_seq(dsi, 0x53, 0x24);
> > 
> > Which also suggests that generic and DCS writes are mixed up here.
> > 
> > Note however that you could not use the generated driver as-is,
> > because Sony seems to use their own display driver instead of Qualcomm's
> > and some things seem to be different.
> 
> I re-created the driver using your generator.  With modeling the 5v
> control GPIOs with regulators and adding backlight-gpios support, the
> driver works quite nicely, except the following two problems:
> 
> 1) I have to drop the MIPI_DSI_MODE_LPM configuration from .update_status
>    hook. Otherwise brightness did not get updated to panel.
> 
> ---8<------
> diff --git a/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c b/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
> index 31e5f942a039..eba926c6f722 100644
> --- a/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
> +++ b/drivers/gpu/drm/panel/panel-sony-tulip-truly-nt35521.c
> @@ -420,33 +420,23 @@ static int truly_nt35521_bl_update_status(struct backlight_device *bl)
>         u16 brightness = backlight_get_brightness(bl);
>         int ret;
>  
> -       dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> -
>         ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness);
>         if (ret < 0)
>                 return ret;
>  
> -       dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> -
>         return 0;
>  }
> ------>8---
> 

I have to admit I don't know much about Low Power Mode vs High Speed
Mode. As long it works it is good I guess :-)

> 2) The driver works good, if the kernel is launched via "fastboot boot".
>    But if the kernel is flashed to eMMC and launched by bootloader with
>    splash screen, kernel will fail to bring up the panel.  After kernel
>    boots up, a blank & unblank cycle can get panel work though.
> 
> The problem 2) is not driver generator related.  @Konrad, did you see
> it on asus-z00t-tm5p5-n35596 driver?
> 

Do you have CONFIG_DRM_MSM=y (built-in) instead of =m (module) maybe?
I think a similar issue exists on MSM8916 but it does not happen
for some reason if CONFIG_DRM_MSM=m instead of =y. Somehow having it
load later during the boot process fixes some things there.

Thanks,
Stephan

  reply	other threads:[~2021-08-08 15:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  8:13 [PATCH 0/2] Add Truly NT35521 panel driver support Shawn Guo
2021-08-04  8:13 ` [PATCH 1/2] dt-bindings: display: panel: Add Truly NT35521 panel support Shawn Guo
     [not found]   ` <YQq6ascrSCtErWrf@ravnborg.org>
2021-08-08 12:04     ` Shawn Guo
2021-08-11 18:51   ` Rob Herring
2021-08-13 13:59     ` Shawn Guo
2021-08-04  8:13 ` [PATCH 2/2] drm/panel: Add Truly NT35521 panel driver Shawn Guo
2021-08-04 12:09   ` Stephan Gerhold
2021-08-08 13:44     ` Shawn Guo
2021-08-08 15:29       ` Stephan Gerhold [this message]
2021-08-09  4:20         ` Shawn Guo
     [not found]   ` <YQq/LOWEgTIk9zIT@ravnborg.org>
2021-08-08 13:49     ` Shawn Guo

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=YQ/4WkA9ajpQx06A@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=konradybcio@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=shawn.guo@linaro.org \
    --cc=thierry.reding@gmail.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).