All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 05/12] drm: shmob_drm: Convert to clk_prepare/unprepare
Date: Mon, 11 Nov 2013 13:55:16 +0100	[thread overview]
Message-ID: <1968627.DN20fBmCvM@avalon> (raw)
In-Reply-To: <20131111085523.GC3884@ulmo.nvidia.com>


[-- Attachment #1.1: Type: text/plain, Size: 3016 bytes --]

Hi Thierry,

On Monday 11 November 2013 09:55:24 Thierry Reding wrote:
> On Sat, Nov 09, 2013 at 01:51:04PM +0100, Laurent Pinchart wrote:
> > Hi Dave,
> > 
> > Could you please pick this patch up ?
> > 
> > On Monday 28 October 2013 23:49:22 Laurent Pinchart wrote:
> > > Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
> > > clk_disable_unprepare() to get ready for the migration to the common
> > > clock framework.
> > > 
> > > Cc: David Airlie <airlied@linux.ie>
> > > Cc: dri-devel@lists.freedesktop.org
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > > 
> > >  drivers/gpu/drm/shmobile/shmob_drm_crtc.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > > b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index 54bad98..562f9a4
> > > 100644
> > > --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > > +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c
> > > @@ -40,7 +40,7 @@
> > >  static void shmob_drm_clk_on(struct shmob_drm_device *sdev)
> > >  {
> > >  	if (sdev->clock)
> > > -		clk_enable(sdev->clock);
> > > +		clk_prepare_enable(sdev->clock);
> 
> Sorry for jumping in so late, but shouldn't this be split into two
> separate calls, clk_prepare() in .probe() and clk_enable() here?

The clock prepare and enable operations are split to allow clock 
implementations to sleep. Clocks should be kept disable whenever possible, the 
clk_enable() and clk_disable() calls should be as close as possible to the 
time range during which the clock needs to be enabled. This means that those 
calls might happen in a context where sleeping isn't allowed. If a clock 
implementation needs to sleep to enable the clock (by performing an I2C access 
for instance), that operation should be performed at prepare time.

>From a clock user point of view, both clk_prepare() and clk_enable() should be 
called as late as possible. If clk_enable() needs to be called in an atomic 
context clk_prepare() must be called earlier, in a non-atomic context(). 
Otherwise there'e no point in splitting the two calls.

> Also note that both clk_prepare() and clk_enable() (and therefore
> clk_prepare_enable() as well) can fail, so you should really check
> the return values here.

Yes, that's a good point. I'd like to fix that in a separate patch in order to 
avoid delaying this one.

> > >  #if 0
> > >  	if (sdev->meram_dev && sdev->meram_dev->pdev)
> > >  		pm_runtime_get_sync(&sdev->meram_dev->pdev->dev);
> > > @@ -54,7 +54,7 @@ static void shmob_drm_clk_off(struct shmob_drm_device
> > > *sdev)
> > > 	pm_runtime_put_sync(&sdev->meram_dev->pdev->dev);
> > >  #endif
> > >  	if (sdev->clock)
> > > -		clk_disable(sdev->clock);
> > > +		clk_disable_unprepare(sdev->clock);
> 
> Similarily I'd expect this to be clk_disable() only, with the
> clk_unprepare() in .remove(). Or perhaps there's a very good reason to
> do both here?

-- 
Regards,

Laurent Pinchart

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

  reply	other threads:[~2013-11-11 12:54 UTC|newest]

Thread overview: 202+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 22:49 [PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration Laurent Pinchart
2013-10-28 22:49 ` Laurent Pinchart
2013-10-28 22:49 ` Laurent Pinchart
2013-10-28 22:49 ` [PATCH 01/12] clocksource: sh_cmt: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  5:55   ` Simon Horman
2013-10-29  5:55     ` Simon Horman
2013-10-29  5:55     ` Simon Horman
2013-10-29  9:55     ` Laurent Pinchart
2013-10-29  9:55       ` Laurent Pinchart
2013-10-29  9:55       ` Laurent Pinchart
2013-10-30  0:10       ` Simon Horman
2013-10-30  0:10         ` Simon Horman
2013-10-30  0:10         ` Simon Horman
2013-10-30  0:13         ` Laurent Pinchart
2013-10-30  0:13           ` Laurent Pinchart
2013-10-30  0:13           ` Laurent Pinchart
2013-10-30  0:27           ` Simon Horman
2013-10-30  0:27             ` Simon Horman
2013-10-30  0:27             ` Simon Horman
2013-10-28 22:49 ` [PATCH 02/12] clocksource: sh_mtu2: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  5:55   ` Simon Horman
2013-10-29  5:55     ` Simon Horman
2013-10-29  5:55     ` Simon Horman
2013-10-29 11:15   ` Sergei Shtylyov
2013-10-29 11:15     ` Sergei Shtylyov
2013-10-29 11:15     ` Sergei Shtylyov
2013-10-29 13:24     ` Laurent Pinchart
2013-10-29 13:24       ` Laurent Pinchart
2013-10-29 13:24       ` Laurent Pinchart
2013-10-29 14:30   ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Laurent Pinchart
2013-10-29 14:30     ` Laurent Pinchart
2013-10-29 14:30     ` Laurent Pinchart
2013-10-29 14:30     ` [PATCH v2 2/2] clocksource: sh_mtu2: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-29 14:30       ` Laurent Pinchart
2013-10-29 14:30       ` Laurent Pinchart
2013-10-31  5:23       ` Simon Horman
2013-10-31  5:23         ` Simon Horman
2013-10-31  5:23         ` Simon Horman
2013-11-08 10:10       ` Daniel Lezcano
2013-11-08 10:10         ` Daniel Lezcano
2013-11-08 10:10         ` Daniel Lezcano
2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_mtu2: Release clock when sh_mtu2_register() fails Simon Horman
2013-10-31  5:23       ` Simon Horman
2013-10-31  5:23       ` Simon Horman
2013-11-08 10:10     ` Daniel Lezcano
2013-11-08 10:10       ` Daniel Lezcano
2013-11-08 10:10       ` Daniel Lezcano
2013-10-28 22:49 ` [PATCH 03/12] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  5:55   ` Simon Horman
2013-10-29  5:55     ` Simon Horman
2013-10-29  5:55     ` Simon Horman
2013-10-29 11:17   ` Sergei Shtylyov
2013-10-29 11:17     ` Sergei Shtylyov
2013-10-29 11:17     ` Sergei Shtylyov
2013-10-29 14:31   ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Laurent Pinchart
2013-10-29 14:31     ` Laurent Pinchart
2013-10-29 14:31     ` Laurent Pinchart
2013-10-29 14:31     ` [PATCH v2 2/2] clocksource: sh_tmu: Add clk_prepare/unprepare support Laurent Pinchart
2013-10-29 14:31       ` Laurent Pinchart
2013-10-29 14:31       ` Laurent Pinchart
2013-10-31  5:24       ` Simon Horman
2013-10-31  5:24         ` Simon Horman
2013-10-31  5:24         ` Simon Horman
2013-11-07 13:40         ` Daniel Lezcano
2013-11-07 13:40           ` Daniel Lezcano
2013-11-07 13:40           ` Daniel Lezcano
2013-11-08  5:22           ` Simon Horman
2013-11-08  5:22             ` Simon Horman
2013-11-08  5:22             ` Simon Horman
2013-11-08 10:10       ` Daniel Lezcano
2013-11-08 10:10         ` Daniel Lezcano
2013-11-08 10:10         ` Daniel Lezcano
2013-10-31  5:23     ` [PATCH v2 1/2] clocksource: sh_tmu: Release clock when sh_tmu_register() fails Simon Horman
2013-10-31  5:23       ` Simon Horman
2013-10-31  5:23       ` Simon Horman
2013-11-08 10:10     ` Daniel Lezcano
2013-11-08 10:10       ` Daniel Lezcano
2013-11-08 10:10       ` Daniel Lezcano
2013-10-28 22:49 ` [PATCH 04/12] sata_rcar: Convert to clk_prepare/unprepare Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29 18:41   ` Tejun Heo
2013-10-29 18:41     ` Tejun Heo
2013-10-29 18:41     ` Tejun Heo
2013-10-28 22:49 ` [PATCH 05/12] drm: shmob_drm: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-11-09 12:51   ` Laurent Pinchart
2013-11-11  8:55     ` Thierry Reding
2013-11-11 12:55       ` Laurent Pinchart [this message]
2013-10-28 22:49 ` [PATCH 06/12] i2c: sh_mobile: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  5:02   ` Wolfram Sang
2013-10-29  5:02     ` Wolfram Sang
2013-10-29  5:02     ` Wolfram Sang
2013-10-29  5:58     ` Simon Horman
2013-10-29  5:58       ` Simon Horman
2013-10-29  5:58       ` Simon Horman
2013-10-29  9:41       ` Laurent Pinchart
2013-10-29  9:41         ` Laurent Pinchart
2013-10-29  9:41         ` Laurent Pinchart
2013-10-31 11:49   ` Wolfram Sang
2013-10-31 11:49     ` Wolfram Sang
2013-10-31 11:49     ` Wolfram Sang
2013-10-28 22:49 ` [PATCH 07/12] mmc: sh_mmcif: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  8:10   ` Guennadi Liakhovetski
2013-10-29  8:10     ` Guennadi Liakhovetski
2013-10-29  8:10     ` Guennadi Liakhovetski
2013-10-30 22:23     ` Guennadi Liakhovetski
2013-10-30 22:23       ` Guennadi Liakhovetski
2013-10-30 22:23       ` Guennadi Liakhovetski
2013-10-30 23:13       ` Laurent Pinchart
2013-10-30 23:13         ` Laurent Pinchart
2013-10-30 23:13         ` Laurent Pinchart
2013-10-30 23:27         ` Ulf Hansson
2013-10-30 23:27           ` Ulf Hansson
2013-10-30 23:27           ` Ulf Hansson
2013-10-30 23:48           ` Laurent Pinchart
2013-10-30 23:48             ` Laurent Pinchart
2013-10-30 23:48             ` Laurent Pinchart
2013-10-28 22:49 ` [PATCH 08/12] mmc: sh_mobile_sdhi: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  8:09   ` Guennadi Liakhovetski
2013-10-29  8:09     ` Guennadi Liakhovetski
2013-10-29  8:09     ` Guennadi Liakhovetski
2013-11-09 12:56     ` Laurent Pinchart
2013-11-09 12:56       ` Laurent Pinchart
2013-11-09 12:56       ` Laurent Pinchart
2013-11-26  2:02       ` Laurent Pinchart
2013-11-26  2:02         ` Laurent Pinchart
2013-11-26  2:02         ` Laurent Pinchart
2013-12-11 12:01         ` Laurent Pinchart
2013-12-11 12:01           ` Laurent Pinchart
2013-12-11 12:01           ` Laurent Pinchart
2013-12-12  1:29           ` Chris Ball
2013-12-12  1:29             ` Chris Ball
2013-12-12  1:29             ` Chris Ball
2013-12-12  2:16             ` Laurent Pinchart
2013-12-12  2:16               ` Laurent Pinchart
2013-12-12  2:16               ` Laurent Pinchart
2013-12-12  2:25               ` Chris Ball
2013-12-12  2:25                 ` Chris Ball
2013-12-12  2:25                 ` Chris Ball
2013-12-14  1:05                 ` Simon Horman
2013-12-14  1:05                   ` Simon Horman
2013-12-14  1:05                   ` Simon Horman
2013-10-28 22:49 ` [PATCH 09/12] usb: gadget: r8a66597-udc: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  9:47   ` Shimoda, Yoshihiro
2013-10-29  9:47     ` Shimoda, Yoshihiro
2013-11-09 14:09     ` Laurent Pinchart
2013-11-09 14:09       ` Laurent Pinchart
2013-11-11 19:53       ` Felipe Balbi
2013-11-11 19:53         ` Felipe Balbi
2013-11-26  1:59         ` Laurent Pinchart
2013-11-26  1:59           ` Laurent Pinchart
2013-11-26  2:12           ` Felipe Balbi
2013-11-26  2:12             ` Felipe Balbi
2013-11-26  2:16             ` Laurent Pinchart
2013-11-26  2:16               ` Laurent Pinchart
2013-11-26 19:54               ` Felipe Balbi
2013-11-26 19:54                 ` Felipe Balbi
2013-11-26 21:43                 ` Laurent Pinchart
2013-11-26 21:43                   ` Laurent Pinchart
2013-10-28 22:49 ` [PATCH 10/12] usb: r8a66597-hcd: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-29  9:47   ` Shimoda, Yoshihiro
2013-10-29  9:47     ` Shimoda, Yoshihiro
2013-11-09 14:12     ` Laurent Pinchart
2013-11-09 14:12       ` Laurent Pinchart
2013-11-09 16:10       ` Greg Kroah-Hartman
2013-11-09 16:10         ` Greg Kroah-Hartman
2013-11-26  2:00         ` Laurent Pinchart
2013-11-26  2:00           ` Laurent Pinchart
2013-11-26  2:36           ` Greg Kroah-Hartman
2013-11-26  2:36             ` Greg Kroah-Hartman
2013-11-26 14:08             ` Laurent Pinchart
2013-11-26 14:08               ` Laurent Pinchart
2013-11-28  8:20               ` Simon Horman
2013-11-28  8:20                 ` Simon Horman
2013-10-28 22:49 ` [PATCH 11/12] fbdev: shmobile-hdmi: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-31 10:48   ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-31 10:48     ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-09 14:13     ` Laurent Pinchart
2013-11-09 14:13       ` Laurent Pinchart
2013-11-11 13:34       ` Tomi Valkeinen
2013-11-11 13:34         ` Tomi Valkeinen
2013-10-28 22:49 ` [PATCH 12/12] fbdev: shmobile-lcdcfb: " Laurent Pinchart
2013-10-28 22:49   ` Laurent Pinchart
2013-10-31 10:47   ` Jean-Christophe PLAGNIOL-VILLARD
2013-10-31 10:47     ` Jean-Christophe PLAGNIOL-VILLARD

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=1968627.DN20fBmCvM@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.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 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.