Lenovo ThinkPad P52

As of 2018-09-30 this is a WIP page inspired by Lenovo ThinkPad P50. Feel free to chat with me (zougloub on freenode) if you're figuring stuff out or have questions.

Peculiarities

 * (EDIT): The system doesn't boot from the Gentoo Install or Gentoo Admin USB Key (converted from ISO as there's not optical drive included). In order to get this working you need to boot from another distribution
 * The system boots with Hybrid Graphics Mode, but doesn't work correctly. You can't run startx or run lspci. it will cause the system to hang when using SystemRescueCD (tested version 6.0.2). To solve this you need to edit the grub configuration before booting and append the following 2 items: acpi_osi=! acpi_osi="Windows 2009" and press F10 to boot. After Hybrid Graphics mode boots fine. The same happens with Ubuntu 18.10. The USB Key boots, it shows the graphical desktop. You can move the mouse around, but you can't click anything and nothing else responds. It's solved with the acpi_osi kernel parameters.
 * After installing Gentoo with a recent kernel it's safe to use acpi_osi=! acpi_osi="Linux". This works without a problem.
 * (EDIT): startx doesnt't work when booting as described below. As a temporary solution is to run rmmod nouveau and create an /etc/X11/xorg.conf on the USB key and specify the Intel lines described in the corresponding section below. After xorg will start just fine.
 * (EDIT): Touchpad works fine with the 4.19.* gentoo-sources kernel after compiling in ELAN support as PS/2 and I2C driver and the IBM TrackPoint driver. It's registered as a serio device and after installing and activating gpm I can report that the mouse is working and even scroll functionality of the middle mouse button works
 * Hybrid graphics are not a breeze to use
 * (EDIT): Make sure to run at least UEFI / BIOS version 1.18 due to a corruption bug when switching from Dedicated to Hybrid Graphics mode

Power management
This section deals with:


 * Tips for reducing power consumption
 * Suspend/resume

TODO see Lenovo_ThinkPad_P50

Kernel
To get everything working properly including power management and Low Power Subsystems support, make sure the following items are included in the .config file

TODO

Graphics
The laptop has an integrated Intel GPU (iGPU) and a second NVIDIA GPU (dGPU). External displays are routed through the dGPU, and the laptop screen is connected to the iGPU.

There's several ways to configure the display(s).


 * The BIOS: It can either enable hybrid graphics or only the dGPU.
 * The bbswitch module (part of Bumblebee) can enable/disable the dGPU in a hybrid graphics configuration.
 * Bumblebee can route OpenGL / OpenCL calls to the dGPU.
 * The PRIME "thing" handles display routing through one or the other GPU.
 * Using the nouveau or NVIDIA proprietary drivers.

Obviously:


 * If external displays are to be used, the dGPU must be on.
 * The iGPU uses less power (see Power Management).
 * The ideal configuration is Hybrid Graphics, with all display connectors available, and rendering mainly done using the iGPU, with the dGPU helping out for graphics-intensive loads and when external displays are to be used.

Notable configurations that work:


 * 1) BIOS in discrete graphics with NVIDIA-only display (that's the easiest way)
 * 2) BIOS in hybrid graphics with Intel-only display and Bumblebee, no external displays (everything is good except for no external displays)
 * 3) BIOS in hybrid graphics with laptop panel on iGPU and xf86-video-intel (not modesetting) and external displays using eGPU and NVIDIA proprietary drivers, which will be detailed hereafter.

The configuration of bumblebee needs to be adjusted according to usage.

Setup for Hybrid Graphics mode with external displays on the dGPU
Note: Failure to change the settings above, will cause the keyboard to stop responding when exiting X or restarting the bumblebeed daemon.
 * 1) Install NVIDIA proprietary drivers
 * 2) Install  and
 * 3) Edit Bumblebee's  as follows (important bits are   and  ):
 * 4) Edit Bumblebee's configuration file
 * 5) Restart the bumblebeed daemon
 * 6) For systemd users: systemctl enable bumblebeed && systemctl start bumblebeed
 * 7) For openRC users: rc-update add bumblebeed default && service bumblebeed start


 * 1) Add an  snippet as follows (to use the   driver, which offers ):

Setup for Hybrid Graphics mode without external displays on the dGPU and only using the dGPU for your eDP display

 * 1) Set  to have   and , which allows to keep the display active after running a dummy

Usage

 * 1) Run  to start the Bumblebee X server if you want to start display output on your local screen
 * 2) Run  to plug the NVIDIA hardware outputs as virtual outputs on the current X screen
 * 3) At this point the plugged external monitors will become available in XRandR, as virtual devices, e.g.

Thunderbolt
Use  or.

DisplayPort outputs are simply routed graphics, i.e. their working depends on the GPU configuration...

SD card reader
Handled by the  kernel module.

Smart Card Reader
Some versions of the Lenovo ThinkPad P52 contain a Alcor AU based series USB Smart Card reader. Follow the PCSC Lite guide to get this working. The driver needed is:.

Touchpad
In order to have the trackpoint/touchpad work:


 * Ensure the  module has been built with elantech options
 * Pass  to the   kernel module (either by kernel command-line or modprobe.d configuration file)

Touchscreen
In order to have the touchscreen work:


 * Multi-touch is handled by the  kernel module
 * Multi-touch at the X/Wayland level is handled by the  X module (not  !).

Notes:


 * will show a non-empty list of event if the touchscreen is configured properly:


 * will show finger ids when configured properly:


 * :3[examples]'s gtk3-demo has a multi-touch test window that can be useful to visually check that everything is OK within GTK (there aren't so many multi-touch enabled apps out there).