Contribute
Register

[DEV] Disabling the nvidia card for battery life (optimus)

Status
Not open for further replies.
Joined
Jun 25, 2011
Messages
22
Motherboard
Dell XPS 15 9550 (Clover)
CPU
i7 6700hq
Graphics
hd530, 1920x1080
Yesterday I told myself as a n53sv owner that if there were not any way to use the DGPU (nvidia 540m in my case) there must be at least a way to disable it to save battery power.
I never used anything programming-on-osx-related but I got Xcode and started playing with it.
I must say that it was really easy.
This is the result:
Code:
NoNvidia: NoNvidia by michyprima, init
NoNvidia: got the ACPI device
NoNvidia: disabling nvidia card
NoNvidia: nvidia card successfully disabled
The code gets the ACPI device from the PCI device and calls the DOFF method. If your DGPU device (GFX0 in my case) has a DOFF method, you do not have to modify anything (if you don't care about the GFX led remaining white), since the ACPI device is got from the device id (0x0df410de in my case) set in the Info.plist
If your device has not a DOFF method or you want the led to turn blue, you have to do a little mod to your dsdt.
If your disabling function is not DOFF but i.e. GPUOFF is enough to replace any occurrence of GPUOFF with DOFF. (it's not the asus n53sv case)
If you want a complete disable, including the blue led (asus n53sv case) find where the DOFF function is called, in my case the _PS3 method inside the LCDD device:
Code:
		Method (_PS3, 0, NotSerialized)
		{
			If (LEqual (^^^GFX0.P3MO, 0x03))
			{
				DOFF ()
				SGPL (0x23, One, Zero)
				Store (0x03, ^^^GFX0._PSC)
				Store (One, ^^^GFX0.DGPS)
				Store (0x02, ^^^GFX0.P3MO)
			}
		}
and move everything under the DOFF() call at the end of the DOFF method, so you will have:
Code:
		Method (_PS3, 0, NotSerialized)
		{
			If (LEqual (^^^GFX0.P3MO, 0x03))
			{
				DOFF ()
			}
		}
[…]
Method (DOFF, 0, NotSerialized)
		{
			If (LNotEqual (MFTM, One))
			{
				_OFF ()
				If (LEqual (CTBO, One))
				{
					OBCP (Zero)
				}
			}

			SGPL (0x23, One, Zero)
			Store (0x03, ^^^GFX0._PSC)
			Store (One, ^^^GFX0.DGPS)
			Store (0x02, ^^^GFX0.P3MO)
		}
Congratulations, you got a better battery life, a cooler laptop, and the blue led back.

Result:
http://imageshack.us/photo/my-images/809/img20111030144315.jpg/

Please report success or problems.
Enjoy
 

Attachments

  • NoNvidia.kext.zip
    9.4 KB · Views: 189
Moved to correct forum,
Snow Leopard Installation -> 10.6 Laptops.
 
Hello, I am playing with this nvidia optimus thing here too, can you send me via email or pm or here, the source code that you used ?

Its because I almost have turned on the nvidia here and I want to play with your method.

thank you.
 
Yesterday I told myself as a n53sv owner that if there were not any way to use the DGPU (nvidia 540m in my case) there must be at least a way to disable it to save battery power.
I never used anything programming-on-osx-related but I got Xcode and started playing with it.
I must say that it was really easy.
This is the result:
Code:
NoNvidia: NoNvidia by michyprima, init
NoNvidia: got the ACPI device
NoNvidia: disabling nvidia card
NoNvidia: nvidia card successfully disabled
The code gets the ACPI device from the PCI device and calls the DOFF method. If your DGPU device (GFX0 in my case) has a DOFF method, you do not have to modify anything (if you don't care about the GFX led remaining white), since the ACPI device is got from the device id (0x0df410de in my case) set in the Info.plist
If your device has not a DOFF method or you want the led to turn blue, you have to do a little mod to your dsdt.
If your disabling function is not DOFF but i.e. GPUOFF is enough to replace any occurrence of GPUOFF with DOFF. (it's not the asus n53sv case)
If you want a complete disable, including the blue led (asus n53sv case) find where the DOFF function is called, in my case the _PS3 method inside the LCDD device:
Code:
        Method (_PS3, 0, NotSerialized)
        {
            If (LEqual (^^^GFX0.P3MO, 0x03))
            {
                DOFF ()
                SGPL (0x23, One, Zero)
                Store (0x03, ^^^GFX0._PSC)
                Store (One, ^^^GFX0.DGPS)
                Store (0x02, ^^^GFX0.P3MO)
            }
        }
and move everything under the DOFF() call at the end of the DOFF method, so you will have:
Code:
        Method (_PS3, 0, NotSerialized)
        {
            If (LEqual (^^^GFX0.P3MO, 0x03))
            {
                DOFF ()
            }
        }
[…]
Method (DOFF, 0, NotSerialized)
        {
            If (LNotEqual (MFTM, One))
            {
                _OFF ()
                If (LEqual (CTBO, One))
                {
                    OBCP (Zero)
                }
            }

            SGPL (0x23, One, Zero)
            Store (0x03, ^^^GFX0._PSC)
            Store (One, ^^^GFX0.DGPS)
            Store (0x02, ^^^GFX0.P3MO)
        }
Congratulations, you got a better battery life, a cooler laptop, and the blue led back.

Result:
http://imageshack.us/photo/my-images/809/img20111030144315.jpg/

Please report success or problems.
Enjoy

I have the n53sv-xe and was wordering if disabling the nvidia card will led the intel hd-3000 to activate?
how can i activate it back in any case??
 
Hi,

I tried your kext. But it does not load, see the log messages below?

Did I miss anything?
Artimess

5/22/14 8:58:46.690 PM com.apple.kextd[12]: WARNING - Invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/NoNvidia.kext"
5/22/14 8:58:46.697 PM com.apple.kextd[12]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:58:46.702 PM com.apple.kextd[12]: Can't load NoNvidia.kext - failed to resolve dependencies.
5/22/14 8:58:46.706 PM com.apple.kextd[12]: Load com.michyprima.NoNvidia failed; removing personalities from kernel.
5/22/14 8:58:56.217 PM com.apple.kextcache[490]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:58:56.219 PM com.apple.kextcache[490]: NoNvidia.kext is missing dependencies (including anyway; dependencies may be available from elsewhere)
5/22/14 8:58:56.221 PM com.apple.kextcache[490]: WARNING - Invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/NoNvidia.kext"
5/22/14 8:59:26.893 PM com.apple.kextcache[490]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:59:29.620 PM com.apple.kextcache[490]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:59:29.621 PM com.apple.kextcache[490]: Prelink failed for com.michyprima.NoNvidia; omitting from prelinked kernel.
5/22/14 9:02:57.443 PM com.apple.kextd[12]: WARNING - Invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/NoNvidia.kext"
5/22/14 9:02:57.502 PM com.apple.kextd[12]: /System/Library/Extensions/NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 9:02:57.504 PM com.apple.kextd[12]: Can't load /System/Library/Extensions/NoNvidia.kext - failed to resolve dependencies.
5/22/14 9:02:57.505 PM com.apple.kextd[12]: Load com.michyprima.NoNvidia failed; removing personalities from kernel.
 
Hi,

I tried your kext. But it does not load, see the log messages below?

Did I miss anything?
Artimess

5/22/14 8:58:46.690 PM com.apple.kextd[12]: WARNING - Invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/NoNvidia.kext"
5/22/14 8:58:46.697 PM com.apple.kextd[12]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:58:46.702 PM com.apple.kextd[12]: Can't load NoNvidia.kext - failed to resolve dependencies.
5/22/14 8:58:46.706 PM com.apple.kextd[12]: Load com.michyprima.NoNvidia failed; removing personalities from kernel.
5/22/14 8:58:56.217 PM com.apple.kextcache[490]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:58:56.219 PM com.apple.kextcache[490]: NoNvidia.kext is missing dependencies (including anyway; dependencies may be available from elsewhere)
5/22/14 8:58:56.221 PM com.apple.kextcache[490]: WARNING - Invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/NoNvidia.kext"
5/22/14 8:59:26.893 PM com.apple.kextcache[490]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:59:29.620 PM com.apple.kextcache[490]: NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 8:59:29.621 PM com.apple.kextcache[490]: Prelink failed for com.michyprima.NoNvidia; omitting from prelinked kernel.
5/22/14 9:02:57.443 PM com.apple.kextd[12]: WARNING - Invalid signature -67062 0xFFFFFFFFFFFEFA0A for kext "/System/Library/Extensions/NoNvidia.kext"
5/22/14 9:02:57.502 PM com.apple.kextd[12]: /System/Library/Extensions/NoNvidia.kext - no compatible dependency found for com.apple.driver.AppleACPIPlatform.
5/22/14 9:02:57.504 PM com.apple.kextd[12]: Can't load /System/Library/Extensions/NoNvidia.kext - failed to resolve dependencies.
5/22/14 9:02:57.505 PM com.apple.kextd[12]: Load com.michyprima.NoNvidia failed; removing personalities from kernel.

Try removing dependency on com.apple.driver.AppleACPIPlatform (OSBundleLibraries in Info.plist).

But this is an old kext (from 2011) with no source code, so it might not work...
 
Status
Not open for further replies.
Back
Top