Skip to content

Sony Vaio Z21 News: Switching off Nvidia card seems possible under Linux!

Good news, I think. We've been able to switch off the Nvidia graphics adapter after booting Linux, which means it's possible now to boot directly into Linux and have X11 working with DRI and compositing enabled without the trip through booting into XP first.

It's quite a crude method, though. The hack with acpi_evaluate_object() I mentioned in my previous post worked, I just call the "_DSM" ACPI method of the built in Intel chipset graphics card and instruct it to call the "_OFF" ACPI method of the Nvidia card. I've also found out how to switch the Speed and Stamina LEDs so that you have some visual feedback of what's happening. You cannot see any difference in lcpci, which means that the card is still registered to the bus, apparently it's just powered down. I have no idea currently how to detach it entirely from the bus to reproduce exactly the configuration after having booted XP, maybe through PCI hotplugging? That being said, I have also no idea yet if the card is really powered down entirely.

My wife Eva has uploaded our experimental sony-laptop.c, grab it here. I don't make any guarantees about not damaging your precious toy if you dare trying it.

We're quite pleased with the current status however. It means that Eva can now shut down the laptop without having to make the stupid WinXP detour before using Linux again.

Her detailed log of installing openSUSE 11.1 on the Z21 can be found here.

30 thoughts on “Sony Vaio Z21 News: Switching off Nvidia card seems possible under Linux!

  1. Anonymous

    awesome awesome awesome. i am going to try this new module when I get home. Do you notice any improvement in power consumption? Power consumption is my biggest gripe right now with the laptop!

  2. Matze

    @jtechs: I'll email you tomorrow, bed time here now 😉

    @Anonymous: No, I didn't check power consumption yet, but that is of course on the TODO list. I really hope that there is an improvement, too.

  3. Matze

    @jtechs: I've just emailed you, please send me back your Vista DSDT and also one from running under Linux. The LED not working makes me think you may have a different BIOS working.

    By the way, did any of you test the 3G modem power switch?

  4. Matze

    @jtechs: Thanks for sending me the DSDT dump of Vista. I've compared it with the one from Linux but I see only minor differences, no differences in functionality.

  5. Jtechs

    Ok thats good to know.

    I updated my kernel to and the compile worked and the stanima light came on.. so the old kernel was my main problem (duh)

    Would the driver (nvidia) be the main activating point? With the vista dump, I installed only Vista and the Sony/Nvidia driver. With only that driver I was able to change the SPEED/STANIMA mode...


  6. jtechs

    Sony/Nvidia = Sony Nvidia Driver.

    Yes I used the special sony version and only that driver nothing else. I was going through the inf's and I think there is a service that controls the mode change, NVLDDMKM.SYS I was trying to decompile it but I ran out of time,

    In the drivers there is a lot of registry keys that control the speed stanima mode..

    Do you think the speed/stamina switch is a software one? As in it only tells the nvidia drivers what mode is on and the nvidia drivers then tell the hardware what to do?

    Anyway I will try to find out more after work today..

  7. Matze

    Switching the graphics cards on the fly is quite complex. In Stamina mode, the Nvidia card is completely powered down and the LCD (or DVI/HDMI/CRT) receives data from the Intel card. Flipping the switch means the driver needs to power up the nvidia device, completely initialize it, copy the settings of the currently active Intel card, then configure the video switch matrix to disconnect the Intel card and connect the NVidia card.

    So far, so good. But there is also the memory mapping of the framebuffer: The Intel card uses UMA, i.e. the framebuffer memory is just normal SDRAM. The NVidia card - possibly - uses on-board VRAM, which is at a different physical address. Hence the driver also needs to modify the memory mapping through the MMU so that running applications have the same view on the framebuffer memory.

    More problems: Vista uses hardware acceleration for all the visual bling. Each Window on the screen is basically a textured DirectX surface. Now, are the texture formats of Intel and Nvidia compatible or not? Probably the driver has to copy and convert the textures as well, or at least tell all running applications that they have to reload the textures into graphics memory.

    I think some of the stuff is pure hardware (or at least I hope), which means it's a matter of calling the right ACPI methods to configure the related hardware devices. I hope the video switch matrix can be controlled like via ACPI, that is key to switching between Speed and Stamina after the device has booted.

  8. Anonymous

    I've just downloaded and installed the 0.5,it works (I mean the light for stamina on),but it will be off after a reboot so I have to make and make install everytime,is this normal or abnormal?
    I am using Ubuntu 8.10 and my laptop model is vaio Z15 (a Chinese model but everything almost the same as yours).
    thks for your hard working.

  9. Matze

    Michael, the module should end up in /lib/modules/(kernel-version)/updates, and automatically be loaded on each reboot. It should not be necessary to make/make install each time.

  10. Mehran

    Is there any way to turn the Intel card off after the boot?
    I need the graphics power, so I want to use the nvidia card.

  11. Anonymous

    Matze,I've tried many times but it won't work after reboot,any idea?

  12. Matze

    Michael, can you check in /lib/modules/(kernel-version)/update if there's a sony-laptop.ko with a matching modification date?

  13. Anonymous

    Matze,I guess the problem maybe is that the old sony-laptop loaded instead of yours when booting because I tried to check the modinfo and found the version is 0.6 and the author is not your name.

    Maybe Ubuntu needs a different way to install as you are using Suse.

    but I am sure the one in /updates/ is still yours because the modification date and time is correct.

    Any idea?


  14. Mickaël

    Thank you very much Matze for your work.
    I'm not sure to have all understood.

    With your module, you boot on intel/Nvidia depending on stamina button position ?
    The unused card is unpowered ?

    But you can't swith on the fly !

    Thank for your answers, I will try this week-end to install last archlinux.


  15. Anonymous

    Matze,I've found out an solution "sudo cp /lib/modules/2.6.27-12-generic/updates/sony-laptop.ko /lib/modules/2.6.27-12-generic/kernel/drivers/misc/",because when ubuntu boot it load the driver from there and you need manually copy and replace the old one in there.
    Now it work beautifully.


  16. Anonymous

    I have some further questions please clarify:
    1."insmod sony-laptop speed_stamina=1",this seems not so good because if you use "insmod" you need to give the full route for sony-laptop.ko,I think "modprobe sony-laptop" will be better;
    2.but I cannot switch to speed mod no matter how, I tried many ways but only the stamina light on;
    3.Can you give more details how we can switch to speed mod?

    thks & b/rgds.

  17. Matze

    @Michael: I think it's the "insmod" inside the makefile you're talking about? That's only for development purposes.

    @Mickaël: The "Speed/Stamina" switch is not taken into account. I don't know yet how to check it. Also, only Stamina mode works for now. You can set "Speed" by sysfs or module parameter, but it does not work.

  18. jtechs

    I agree, SPEED mode is a no go. Only the LED is affected (on) but the card remains uninitialised. You will have to use the 'BOOT XP' method to get this working.

    Regarding the NvidiaSony Driver: I have not had much time so I have not been able(nor do i know how yet) to decompile it or debug it. BUT I am sure its the driver that inits the hardware. There must be some mechanism that does it, as my previous post: I installed vista and only the sonynvidia driver and it was able to init the card ok.. I will try this weekend to trace the driver actions...

  19. Matze

    jtechs, if you can achieve that, it will be a good basis for moving forward. We'll try this weekend to dump all the ACPI variables in Speed and Stamina mode to see what changes between these modes. Maybe this will give us more hints.

  20. Anonymous

    Hi, thanks for this work, already good job... Did you find something new?

  21. Matze

    Not much progress in the recent weeks, but I've tried the trick dumping all ACPI objects and comparing them with the laptop in different states (speed vs. stamin, coming from XP or Linux). But the information is not conclusive.


Leave a Reply

Your email address will not be published. Required fields are marked *