From 4f1d387b777425aead44232bd2c3d5c3517d4ff8 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 9 Dec 2021 16:35:11 +0100 Subject: [PATCH] fix(drm): add privacy screen modules to the initrd Starting with kernel 5.17 the kernel supports the builtin privacy screens built into the LCD panel of some new laptop models. This means that the drm drivers will now return -EPROBE_DEFER from their probe() method on models with a builtin privacy screen when the privacy screen provider driver has not been loaded yet. Make dracut add the privacy screen providing drivers to the initrd (when necessary for hostmode=yes), so that drm drivers on affected drivers can probe() successfully. Signed-off-by: Hans de Goede --- modules.d/50drm/module-setup.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh index aca01505..cff0550c 100755 --- a/modules.d/50drm/module-setup.sh +++ b/modules.d/50drm/module-setup.sh @@ -29,6 +29,8 @@ installkernel() { # as we could e.g. be in the installer; nokmsboot boot parameter will disable # loading of the driver if needed if [[ $hostonly ]]; then + local i modlink modname + for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?}/*/modalias; do [[ -e $i ]] || continue [[ -n $(< "$i") ]] || continue @@ -39,7 +41,19 @@ installkernel() { fi fi done + # if there is a privacy screen then its driver must be loaded before the + # kms driver will bind, otherwise its probe() will return -EPROBE_DEFER + # note privacy screens always register, even with e.g. nokmsboot + for i in /sys/class/drm/privacy_screen-*/device/driver/module; do + [[ -L $i ]] || continue + modlink=$(readlink "$i") + modname=$(basename "$modlink") + instmods "$modname" + done else dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging" + # also include privacy screen providers (see above comment) + # atm all providers live under drivers/platform/x86 + dracut_instmods -o -s "drm_privacy_screen_register" "=drivers/platform/x86" fi } -- 2.33.1