Lenovo ThinkPad P50

Power management
Make sure you have "Hybrid Graphics" enabled in the BIOS, and are using the proprietary NVIDIA driver. Make sure all of these packages are installed:

First add a udev rule for putting devices to sleep when not in use:

You'll also want the sound card to sleep when unused, to have direct fan control (just for fun), and to not automatically load the NVIDIA driver:

Disable the NMI watchdog so that the CPU can go into deeper sleep states:

Make load at boot time:

The Intel graphics card requires firmware available at initramfs time to enable its power management features, so be sure /lib/firmware/i915 is included in your initramfs.

Read onward with the NVIDIA Optimus configuration below to complete the power savings.

NVIDIA Optimus
Assuming you've enabled "Hybrid Graphics" in the BIOS, emerged the NVIDIA proprietary driver, emerged and configured bbswitch as in the power management section above, and emerged the Intel OpenCL SDK, continue here to get hybrid graphics working well.

Make sure generally your portage configuration is optimal:

When in hybrid graphics mode, the laptop's panel is connected to the Intel card. So, using the Intel card works as usual, but the NVIDIA card requires some tricks.

Assuming you're using SDDM as the display manager, put the following in your Xsetup, which turns off the NVIDIA card to save power, when not in use, and otherwise instructs the NVIDIA card to use the screen attached to the Intel card when in use:

Now install these various configuration files:

When using :

Finally, add this script:

Mark this executable and enable the Intel card to start:

When you want to use the NVIDIA card, simply run this command with  and restart sddm:

When you want to use the Intel card, simply run this command with  and restart sddm:

Note that you'll need to use the NVIDIA card in order to drive external displays.

Remapping useless FN keys
The keys - to - aren't particularly useful out of the box. A nice application is to (low level) remap the keys to media buttons. This can be done via udev:

Next reload the hwdb database:

If this doesn't work, reboot the system.

Toggle touchpad with FN+F4
To toggle the touchpad with + add an additional line:

Thunderbolt connector
As the thunderbolt controller is just PCIe, you don't need to do anything at all. Have PCI express hotplugging enabled in your kernel. When you insert a thunderbolt device, the BIOS will enumerate it, and simply hotplug a PCIe device, just like express port.

Similarly, if you use the port for USB 3.1 via the USB-C connector, a new XHCI controller will be hotplugged, which will have your USB device connected to it, at USB 3.1 gen 2 speeds.

TPM (and suspend/resume)
A common problem can be encountered if the TPM chip has been activated in UEFI/BIOS. If the kernel lacks the necessary drivers the system freezes when attempting to resume from a suspend. Simply configuring the kernel with TPM supports resolves the problem:

Trackpoint and Touchpad
There are various nobs for the trackpoint and touchpad: