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
 * (EDIT): 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.
 * (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.

The knobs to configure the displays are:


 * 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 takes 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.

As of 2018-12-21, a recipe to have the latter configuration working is:

Setup

 * 1) Install NVIDIA proprietary drivers
 * 2) Install  and
 * 3) Edit Bumblebee's  as follows (important bits are   and  ):
 * 4) Add an  snippet as follows (to use the   driver, which offers ):
 * 5) Set  to have   and , which allows to keep the display active after running a dummy

Usage

 * 1) Run  to start the Bumblebee X server
 * 2) Run  which will 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).