Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13876c6e authored by Matthew Garrett's avatar Matthew Garrett Committed by Ben Skeggs
Browse files

nouveau: fix state detection with switchable graphics



Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent dd19e44b
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -90,21 +90,21 @@ int nouveau_hybrid_setup(struct drm_device *dev)
{
	int result;

	if (nouveau_dsm(dev, NOUVEAU_DSM_ACTIVE, NOUVEAU_DSM_ACTIVE_QUERY,
	if (nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STATE,
								&result))
		return -ENODEV;

	NV_INFO(dev, "_DSM hardware status gave 0x%x\n", result);

	if (result & 0x1) {	/* Stamina mode - disable the external GPU */
	if (result) { /* Ensure that the external GPU is enabled */
		nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
		nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
									NULL);
	} else { /* Stamina mode - disable the external GPU */
		nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_STAMINA,
									NULL);
		nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STAMINA,
									NULL);
	} else {		/* Ensure that the external GPU is enabled */
		nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
		nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
									NULL);
	}

	return 0;