Skip to content

Instantly share code, notes, and snippets.

@jordi-t
Last active October 8, 2022 13:57
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jordi-t/a740f6a3fb0d18064e26dc66f9be4f1d to your computer and use it in GitHub Desktop.
Save jordi-t/a740f6a3fb0d18064e26dc66f9be4f1d to your computer and use it in GitHub Desktop.
Disabling dGPU on Dell XPS 9560 on Ubuntu 16.10
# Tested with kernel: 4.9.20-040920-generic
#
# Make sure to install following packages
#
sudo apt install acpi acpi-call-dkms
#
# To manually disable, you can run the following command
#
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call # via root
echo '\_SB.PCI0.PEG0.PEGP._OFF' | sudo tee /proc/acpi/call # via your own user
#
# To automate on startup, do the following:
#
echo acpi_call > /etc/modules-load.d/acpi_call.conf
# Create /usr/lib/systemd/user/dgpu-off.service with the following contents:
[Unit]
Description=Power-off dGPU
After=graphical.target
[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo '\\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call"
[Install]
WantedBy=graphical.target
# Enable the new unit file
systemctl enable /usr/lib/systemd/user/dgpu-off.service
@htrex
Copy link

htrex commented Apr 6, 2017

@jseris thank you very much for sharing this! I've tested it with kernel 4.10.0-14-generic and can confirm it works.
The only thing to notice is that after a reboot and opening a terminal from X sudo cat /proc/acpi/call was responding not called.
I guess that's because the 0x0called response is surely there only just after the command is run?
I know what's the idle temp of the XPS 9560 when the dGPU is on or off, the difference is about 10°, and as it stayed very low, despite the not called status I was already sure that your script worked.

Anyway I've changed the ExecStart line to

ExecStart=/bin/sh -c "echo '\\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call; cat /proc/acpi/call > /tmp/nvidia-off"

so that the acpi call response is logged on a temp file, in fact I've found 0x0called there ;)

I was waiting for an help on this issue from some time, thank you again, I'll update the guide here https://www.reddit.com/r/Dell/comments/5y3rii/xps_9560_battery_life_optimization_and_fan/ with proper credits to your contribution.

cheer!

@jordi-t
Copy link
Author

jordi-t commented May 4, 2017

@htrex glad to be of help!

I am not entirely sure why you get the not called response after (re)boot though. I have the same response btw. I know that I tested this by also adding the cat /proc/acpi/call cmd to the ExecStart line of the unit file. After reboot I checked the output with journalctl -u dgpu-off and it showed me 0x0called. I don't think I ever actually did a manual cat, but I did add it in the Gist as a check... I'll remove it as it only confuses.

Btw what I noticed is that when you do cat on /proc/acpi/call for a second time it will also give a not called response, perhaps a similar system call is being done on it after the systemd initialization. But I'm just speculating :)

@meirbon
Copy link

meirbon commented May 13, 2017

@jseris Thanks for sharing! Much cleaner solution than what I had been using.

@quentin-sommer
Copy link

@jordi-t
Copy link
Author

jordi-t commented Jun 21, 2017

@quentin-sommer you are correct, I have updated the gist with your correction. Thanks 👍

@vcovo
Copy link

vcovo commented Mar 19, 2018

@jseris first off, thanks a ton for writing this up - very useful for those who don't want to use bumblebee but still want to disable the GPU. I can confirm that this also works for Ubuntu 16.04.4. There is just one thing left, for some reason when I boot up I get stuck at a black screen unless I add the following kernel parameter nouveau.modeset=0. Since I have blacklisted the module I don't understand why this would still be necessary (and would of course prefer to avoid doing this). Any advice/pointers are appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment