linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm: Keep disabled outputs disabled after suspend / resume
@ 2009-12-30 13:10 David John
  2009-12-31  4:12 ` David John
  0 siblings, 1 reply; 5+ messages in thread
From: David John @ 2009-12-30 13:10 UTC (permalink / raw)
  To: airlied; +Cc: linux-kernel, eric, jbarnes

With the current DRM code, an output that has been powered off
from userspace will automatically power back on when resuming
from suspend. This patch fixes this behaviour.

Tested only with the Intel i915 driver on an Intel GM45 Express
chipset.

Signed-off-by: David John <davidjon@xenontk.org>

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 4231d6d..9f685bb 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -216,7 +216,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
 EXPORT_SYMBOL(drm_helper_crtc_in_use);
 
 /**
- * drm_disable_unused_functions - disable unused objects
+ * drm_helper_disable_unused_functions - disable unused objects
  * @dev: DRM device
  *
  * LOCKING:
@@ -1162,6 +1162,9 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
 int drm_helper_resume_force_mode(struct drm_device *dev)
 {
 	struct drm_crtc *crtc;
+	struct drm_encoder *encoder;
+	struct drm_encoder_helper_funcs *encoder_funcs;
+	struct drm_crtc_helper_funcs *crtc_funcs;
 	int ret;
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -1174,6 +1177,23 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
 
 		if (ret == false)
 			DRM_ERROR("failed to set mode on crtc %p\n", crtc);
+
+		/* Turn off outputs that were already powered off */
+		if (drm_helper_choose_crtc_dpms(crtc)) {
+			list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+
+				if(encoder->crtc != crtc)
+					continue;
+
+				encoder_funcs = encoder->helper_private;
+				if (encoder_funcs->dpms)
+					(*encoder_funcs->dpms) (encoder, DRM_MODE_DPMS_OFF);
+
+				crtc_funcs = crtc->helper_private;
+				if (crtc_funcs->dpms)
+					(*crtc_funcs->dpms) (crtc, DRM_MODE_DPMS_OFF);
+			}
+		}
 	}
 	/* disable the unused connectors while restoring the modesetting */
 	drm_helper_disable_unused_functions(dev);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm: Keep disabled outputs disabled after suspend / resume
  2009-12-30 13:10 [PATCH] drm: Keep disabled outputs disabled after suspend / resume David John
@ 2009-12-31  4:12 ` David John
  2009-12-31  6:30   ` [PATCH v2] " David John
  0 siblings, 1 reply; 5+ messages in thread
From: David John @ 2009-12-31  4:12 UTC (permalink / raw)
  To: airlied; +Cc: linux-kernel, eric, jbarnes

On 12/30/2009 06:40 PM, David John wrote:
> With the current DRM code, an output that has been powered off
> from userspace will automatically power back on when resuming
> from suspend. This patch fixes this behaviour.
> 
> Tested only with the Intel i915 driver on an Intel GM45 Express
> chipset.
> 
> Signed-off-by: David John <davidjon@xenontk.org>

Sorry, this patch is a bit incorrect. I'll send an updated one soon.

Regards,
David.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] drm: Keep disabled outputs disabled after suspend / resume
  2009-12-31  4:12 ` David John
@ 2009-12-31  6:30   ` David John
  2010-01-07  7:54     ` David John
  0 siblings, 1 reply; 5+ messages in thread
From: David John @ 2009-12-31  6:30 UTC (permalink / raw)
  To: airlied; +Cc: linux-kernel, eric, jbarnes

With the current DRM code, an output that has been powered off
from userspace will automatically power back on when resuming
from suspend. This patch fixes this behaviour.

Tested only with the Intel i915 driver on an Intel GM45 Express
chipset.

Signed-off-by: David John <davidjon@xenontk.org>

diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 4231d6d..aba79c4 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -216,7 +216,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
 EXPORT_SYMBOL(drm_helper_crtc_in_use);
 
 /**
- * drm_disable_unused_functions - disable unused objects
+ * drm_helper_disable_unused_functions - disable unused objects
  * @dev: DRM device
  *
  * LOCKING:
@@ -1162,6 +1162,9 @@ EXPORT_SYMBOL(drm_helper_mode_fill_fb_struct);
 int drm_helper_resume_force_mode(struct drm_device *dev)
 {
 	struct drm_crtc *crtc;
+	struct drm_encoder *encoder;
+	struct drm_encoder_helper_funcs *encoder_funcs;
+	struct drm_crtc_helper_funcs *crtc_funcs;
 	int ret;
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
@@ -1174,6 +1177,25 @@ int drm_helper_resume_force_mode(struct drm_device *dev)
 
 		if (ret == false)
 			DRM_ERROR("failed to set mode on crtc %p\n", crtc);
+
+		/* Turn off outputs that were already powered off */
+		if (drm_helper_choose_crtc_dpms(crtc)) {
+			list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+
+				if(encoder->crtc != crtc)
+					continue;
+
+				encoder_funcs = encoder->helper_private;
+				if (encoder_funcs->dpms)
+					(*encoder_funcs->dpms) (encoder,
+								drm_helper_choose_encoder_dpms(encoder));
+
+				crtc_funcs = crtc->helper_private;
+				if (crtc_funcs->dpms)
+					(*crtc_funcs->dpms) (crtc,
+							     drm_helper_choose_crtc_dpms(crtc));
+			}
+		}
 	}
 	/* disable the unused connectors while restoring the modesetting */
 	drm_helper_disable_unused_functions(dev);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drm: Keep disabled outputs disabled after suspend / resume
  2009-12-31  6:30   ` [PATCH v2] " David John
@ 2010-01-07  7:54     ` David John
  2010-01-07 16:35       ` Jesse Barnes
  0 siblings, 1 reply; 5+ messages in thread
From: David John @ 2010-01-07  7:54 UTC (permalink / raw)
  To: airlied; +Cc: linux-kernel, eric, jbarnes, dri-devel

On 12/31/2009 12:00 PM, David John wrote:
> With the current DRM code, an output that has been powered off
> from userspace will automatically power back on when resuming
> from suspend. This patch fixes this behaviour.
> 
> Tested only with the Intel i915 driver on an Intel GM45 Express
> chipset.
> 
> Signed-off-by: David John <davidjon@xenontk.org>

Ping.

Any update on this? Correct? Incorrect? Utter rubbish that I should be
ashamed of myself?

Regards,
David.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] drm: Keep disabled outputs disabled after suspend / resume
  2010-01-07  7:54     ` David John
@ 2010-01-07 16:35       ` Jesse Barnes
  0 siblings, 0 replies; 5+ messages in thread
From: Jesse Barnes @ 2010-01-07 16:35 UTC (permalink / raw)
  To: davidjon; +Cc: airlied, linux-kernel, eric, dri-devel

On Thu, 07 Jan 2010 13:24:06 +0530
David John <davidjon@xenontk.org> wrote:

> On 12/31/2009 12:00 PM, David John wrote:
> > With the current DRM code, an output that has been powered off
> > from userspace will automatically power back on when resuming
> > from suspend. This patch fixes this behaviour.
> > 
> > Tested only with the Intel i915 driver on an Intel GM45 Express
> > chipset.
> > 
> > Signed-off-by: David John <davidjon@xenontk.org>
> 
> Ping.
> 
> Any update on this? Correct? Incorrect? Utter rubbish that I should be
> ashamed of myself?

Yeah, sorry David, looks good to me.

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

-- 
Jesse Barnes, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-01-07 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-30 13:10 [PATCH] drm: Keep disabled outputs disabled after suspend / resume David John
2009-12-31  4:12 ` David John
2009-12-31  6:30   ` [PATCH v2] " David John
2010-01-07  7:54     ` David John
2010-01-07 16:35       ` Jesse Barnes

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).