diff mbox

drm/nouveau: only runtime suspend by default in optimus configuration

Message ID 1386818341-11506-1-git-send-email-imirkin@alum.mit.edu (mailing list archive)
State New, archived
Headers show

Commit Message

Ilia Mirkin Dec. 12, 2013, 3:19 a.m. UTC
The intent was to only enable it by default for optimus, e.g. see the
runtime_idle callback. The suspend callback may be called directly, e.g.
as a result of nouveau_crtc_set_config.

Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: stable@vger.kernel.org
---

See http://lists.freedesktop.org/archives/dri-devel/2013-November/049738.html
for my analysis of the situation. Since this has been around since 3.12, I'm
tagging it for stable.

 drivers/gpu/drm/nouveau/nouveau_drm.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Stefan Lippers-Hollmann Dec. 12, 2013, 7:48 p.m. UTC | #1
Hi

On Thursday 12 December 2013, Ilia Mirkin wrote:
> The intent was to only enable it by default for optimus, e.g. see the
> runtime_idle callback. The suspend callback may be called directly, e.g.
> as a result of nouveau_crtc_set_config.
> 
> Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> Cc: stable@vger.kernel.org
> ---
> 
> See http://lists.freedesktop.org/archives/dri-devel/2013-November/049738.html
> for my analysis of the situation. Since this has been around since 3.12, I'm
> tagging it for stable.
[…]

Thanks a lot, this works fine on the affected system[1] (with and 
without a monitor attached and without the nouveau.runpm=0 workaround);
feel free to add

Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>

Regards
	Stefan Lippers-Hollmann

[1]	trivially rebased against 3.12.4
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index 7a3759f..98a22e6 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -858,6 +858,12 @@  static int nouveau_pmops_runtime_suspend(struct device *dev)
 	if (nouveau_runtime_pm == 0)
 		return -EINVAL;
 
+	/* are we optimus enabled? */
+	if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
+		DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
+		return -EINVAL;
+	}
+
 	nv_debug_level(SILENT);
 	drm_kms_helper_poll_disable(drm_dev);
 	vga_switcheroo_set_dynamic_switch(pdev, VGA_SWITCHEROO_OFF);