linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: shawn.guo@freescale.com (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] imx-drm: imx-drm-core: add suspend/resume support
Date: Thu, 24 Jul 2014 22:59:36 +0800	[thread overview]
Message-ID: <20140724145934.GD8821@dragon> (raw)
In-Reply-To: <20140724103859.GS15237@phenom.ffwll.local>

On Thu, Jul 24, 2014 at 12:38:59PM +0200, Daniel Vetter wrote:
> > > > +static int imx_drm_suspend(struct device *dev)
> > > > +{
> > > > +	struct drm_device *drm_dev = dev_get_drvdata(dev);
> > > > +	struct drm_connector *connector;
> > > > +
> > > > +	drm_kms_helper_poll_disable(drm_dev);
> > > > +
> > > 
> > > That's ok.
> > > 
> > > > +	drm_modeset_lock_all(drm_dev);
> > > > +	list_for_each_entry(connector, &drm_dev->mode_config.connector_list, head) {
> > > > +		if (connector->funcs->dpms)
> > > > +			connector->funcs->dpms(connector, DRM_MODE_DPMS_OFF);
> > > > +	}
> > > 
> > > Don't touch DPMS state here. See below.
> > 
> > In which case, how else does the hardware get placed into a low power
> > mode on suspend?
> > 
> > DRM has nothing provided, and this is left up to each DRM driver to
> > implement (probably because it tends to be very driver specific.)
> > i915 for example calls the CRTC DPMS function with DRM_MODE_DPMS_OFF.
> > 
> > This provides a similar mechanism, but also informs the connector, any
> > bridge, and encoder associated with the connector as well as the CRTC
> > to place themselves into a low power mode (which is what
> > DRM_MODE_DPMS_OFF should be doing anyway.)
> 
> Well you need to call internal functions to make sure you can restore the
> state again. Not sure any more how that all works with the crtc helpers
> and whether they restore dpms state properly at all. i915 uses something
> completely different nowadays.

Is it okay to do what exynos driver does, i.e. saving/restoring the dpms
state before/after calling connector .dpms function?

        list_for_each_entry(connector, &drm_dev->mode_config.connector_list, head) {
                int old_dpms = connector->dpms;

                if (connector->funcs->dpms)
                        connector->funcs->dpms(connector, DRM_MODE_DPMS_OFF);

                /* Set the old mode back to the connector for resume */
                connector->dpms = old_dpms;
        }

Shawn

  reply	other threads:[~2014-07-24 14:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-24  9:17 [PATCH] imx-drm: imx-drm-core: add suspend/resume support Shawn Guo
2014-07-24  9:38 ` Philipp Zabel
2014-07-25  6:31   ` Shawn Guo
2014-07-24  9:47 ` Lucas Stach
2014-07-24  9:54   ` Russell King - ARM Linux
2014-07-24 10:38     ` Daniel Vetter
2014-07-24 14:59       ` Shawn Guo [this message]
2014-07-25  8:20         ` Daniel Vetter
2014-07-24  9:56   ` Marc Kleine-Budde
2014-07-25  6:34     ` Shawn Guo
2014-07-25  5:46   ` 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=20140724145934.GD8821@dragon \
    --to=shawn.guo@freescale.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).