linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Eugeniu Rosca <erosca@de.adit-jv.com>
Cc: Jacopo Mondi <jacopo@jmondi.org>,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	kieran.bingham+renesas@ideasonboard.com, geert@linux-m68k.org,
	horms@verge.net.au, uli+renesas@fpond.eu,
	VenkataRajesh.Kalakodima@in.bosch.com, airlied@linux.ie,
	daniel@ffwll.ch, koji.matsuoka.xm@renesas.com, muroya@ksk.co.jp,
	Harsha.ManjulaMallikarjun@in.bosch.com, ezequiel@collabora.com,
	seanpaul@chromium.org, linux-renesas-soc@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	michael.dege@renesas.com, gotthard.voellmeke@renesas.com,
	efriedrich@de.adit-jv.com, mrodin@de.adit-jv.com,
	ChaitanyaKumar.Borah@in.bosch.com,
	Eugeniu Rosca <roscaeugeniu@gmail.com>
Subject: Re: [PATCH v5 0/8] drm: rcar-du: Add Color Management Module (CMM)
Date: Fri, 12 Jun 2020 18:50:41 +0300	[thread overview]
Message-ID: <20200612155041.GB28336@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200612153607.GA23962@lxhi-065.adit-jv.com>

Hi Eugeniu,

On Fri, Jun 12, 2020 at 05:36:07PM +0200, Eugeniu Rosca wrote:
> On Fri, Jun 12, 2020 at 06:10:05PM +0300, Laurent Pinchart wrote:
> > On Fri, Jun 12, 2020 at 05:00:32PM +0200, Jacopo Mondi wrote:
> > > On Tue, Jun 09, 2020 at 04:29:59PM +0200, Eugeniu Rosca wrote:
> > > > On Sun, Jun 07, 2020 at 05:41:58AM +0300, Laurent Pinchart wrote:
> > > > > Note that the CMM driver is controlled by the DU driver. As the DU
> > > > > driver will reenable the display during resume, it will call
> > > > > rcar_du_cmm_setup() at resume time, which will reprogram the CMM. There
> > > > > should thus be no need for manual suspend/resume handling in the CMM as
> > > > > far as I can tell, but we need to ensure that the CMM is suspended
> > > > > before and resumed after the DU. I believe this could be implemented
> > > > > using device links.
> > > >
> > > > Based on below quote [*] from Jacopo's commit [**], isn't the device
> > > > link relationship already in place?
> > > 
> > > Yes, it's in place already.
> > > 
> > > I added pm_ops to cmm just to be able to printout when suspend/resume
> > > happens and the sequence is what comment [*] reports
> > > 
> > > [  222.909002] rcar_du_pm_suspend:505
> > > [  223.145497] rcar_cmm_pm_suspend:193
> > > 
> > > [  223.208053] rcar_cmm_pm_resume:200
> > > [  223.460094] rcar_du_pm_resume:513
> > > 
> > > However, Laurent mentioned that in his comment here that he expects
> > > the opposite sequence to happen (CMM to suspend before and resume after
> > > DU).
> > > 
> > > I still think what is implemented is correct:
> > > - CMM is suspended after DU: when CMM is suspended, DU is not feeding
> > >   it with data
> > > - CMM is resumed before: once DU restart operations CMM is ready to
> > >   receive data.
> > > 
> > > Laurent, what do you think ?
> > 
> > I think I shouldn't have written the previous e-mail in the middle of
> > the night :-) Suspending CMM after DU is obviously correct.
> 
> Thanks to Renesas team (kudos to Gotthard and Michael), we've
> figured out that below sequence of clock handling (happening during
> concurrent suspend and HDMI display unplug) leads to SoC lockup:
> 
> cmm1 OFF 	(caused by HDMI unplug)
> x21-clock OFF 	(caused by HDMI unplug)
> du1 OFF 	(caused by HDMI unplug)
> cmm1 ON (caused by suspend to ram, as preparation for CMM register save)
> # Freeze happens
> 
> That seems to be explained by Chapter 35A.4.3 "Restriction of enabling
> clock signal of the CMM" of HW User's manual (Rev.2.00 Jul 2019):
> 
>  -----8<-----
>  When the clock signal of the CMM is enabled (RMSTPCR7.CMMn or
>  SMSTPCR7.CMMn = 0), the clock signal of the DU should be also enabled
>  (RMSTPCR7.DUn or SMSTPCR7.DUn = 0).
>  -----8<-----
> 
> So, the lesson learned from the above is: do not enable the CMMi clock
> while the DUi clock is disabled. I expect this to also potentially
> give some input w.r.t. what to suspend/resume first, CMM or DU.

This may be an ugly one. The DU driver needs to disable the CMM when
suspending, and enabling the CMM when resuming. To do so, it calls
functions of the CMM driver, and those functions access CMM registers.
We can't do so while the CMM is suspended, so the DU has to suspend
before the CMM, and resume after the CMM.

On the other hand, as you state here, we need to make sure the CMM clock
is disabled first. The CMM thus needs to suspend before the DU, and
resume after the DU.

Those are conflicting requirements.

One option could be to use the .suspend_late() and .resume_early() PM
operations for the DU, to turn the DU clock off late and turn it back on
early. Integrating it with the DRM suspend/resume helpers will likely be
complicated though. I wonder if we could find a more elegant solution.

I the above sequence, you list "cmm1 ON" as a preparation for CMM
register save. We don't need to save any register, the CMM driver has no
.suspend() handler. The PM core should really skip waking up the device
at that point (I recall complaining about the spurious wake ups at
suspend time a while ago, but that neevr got addressed). Geert, any
opinion on that ?

> > > > [*] Quote from commit [**]
> > > >    Enforce the probe and suspend/resume ordering of DU and CMM by
> > > >    creating a stateless device link between the two.
> > > >
> > > > [**] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8de707aeb45241
> > > >     ("drm: rcar-du: kms: Initialize CMM instances")

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2020-06-12 15:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 10:46 [PATCH v5 0/8] drm: rcar-du: Add Color Management Module (CMM) Jacopo Mondi
2019-10-15 10:46 ` [PATCH v5 1/8] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation Jacopo Mondi
2019-10-15 11:38   ` Kieran Bingham
2019-10-15 14:03   ` Geert Uytterhoeven
2019-10-15 10:46 ` [PATCH v5 2/8] dt-bindings: display, renesas,du: Document cmms property Jacopo Mondi
2019-10-15 10:46 ` [PATCH v5 3/8] drm: rcar-du: Add support for CMM Jacopo Mondi
2019-10-15 11:53   ` Kieran Bingham
2019-10-15 13:17     ` Kieran Bingham
2019-10-15 13:33     ` Jacopo Mondi
2019-10-15 14:26       ` Kieran Bingham
2019-10-15 17:25   ` Laurent Pinchart
2019-10-15 10:46 ` [PATCH v5 4/8] drm: rcar-du: kms: Initialize CMM instances Jacopo Mondi
2019-10-15 10:46 ` [PATCH v5 5/8] drm: rcar-du: crtc: Control CMM operations Jacopo Mondi
2019-10-15 13:15   ` Kieran Bingham
2019-10-15 13:37     ` Jacopo Mondi
2019-10-15 17:54       ` Laurent Pinchart
2019-10-15 19:17         ` Jacopo Mondi
2019-10-15 19:53           ` Laurent Pinchart
2019-10-15 10:46 ` [PATCH v5 6/8] drm: rcar-du: crtc: Register GAMMA_LUT properties Jacopo Mondi
2019-10-15 10:46 ` [PATCH v5 7/8] arm64: dts: renesas: Add CMM units to Gen3 SoCs Jacopo Mondi
2019-10-15 12:52   ` Kieran Bingham
2019-10-15 18:06     ` Laurent Pinchart
2019-10-15 10:46 ` [PATCH v5 8/8] drm: rcar-du: kms: Expand comment in vsps parsing routine Jacopo Mondi
2019-10-15 13:04   ` Kieran Bingham
2019-10-15 16:54 ` [PATCH v5 0/8] drm: rcar-du: Add Color Management Module (CMM) Laurent Pinchart
2019-11-11 11:21 ` Kalakodima Venkata Rajesh (RBEI/ECF3)
2019-11-11 13:06   ` Jacopo Mondi
2020-05-27  7:15 ` Eugeniu Rosca
2020-05-27  7:34   ` Geert Uytterhoeven
2020-05-27  7:40     ` Gotthard Voellmeke
2020-05-27  7:44     ` Eugeniu Rosca
2020-06-05 13:29   ` Jacopo Mondi
2020-06-05 13:41     ` Eugeniu Rosca
2020-06-05 13:53       ` Jacopo Mondi
2020-06-07  2:41         ` Laurent Pinchart
2020-06-08  9:44           ` Eugeniu Rosca
2020-06-12 15:12             ` Jacopo Mondi
2020-06-15 14:17               ` Eugeniu Rosca
2020-07-17 15:06                 ` Jacopo Mondi
2020-06-09 14:29           ` Eugeniu Rosca
2020-06-12 15:00             ` Jacopo Mondi
2020-06-12 15:10               ` Laurent Pinchart
2020-06-12 15:36                 ` Eugeniu Rosca
2020-06-12 15:50                   ` Laurent Pinchart [this message]
2020-08-18  9:50                     ` Geert Uytterhoeven
2020-06-05 19:05     ` 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=20200612155041.GB28336@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=ChaitanyaKumar.Borah@in.bosch.com \
    --cc=Harsha.ManjulaMallikarjun@in.bosch.com \
    --cc=VenkataRajesh.Kalakodima@in.bosch.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=efriedrich@de.adit-jv.com \
    --cc=erosca@de.adit-jv.com \
    --cc=ezequiel@collabora.com \
    --cc=geert@linux-m68k.org \
    --cc=gotthard.voellmeke@renesas.com \
    --cc=horms@verge.net.au \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jacopo@jmondi.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=koji.matsuoka.xm@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=michael.dege@renesas.com \
    --cc=mrodin@de.adit-jv.com \
    --cc=muroya@ksk.co.jp \
    --cc=roscaeugeniu@gmail.com \
    --cc=seanpaul@chromium.org \
    --cc=uli+renesas@fpond.eu \
    /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).