• Hans de Goede's avatar
    ACPI: video: Make backlight class device registration a separate step (v2) · 3dbc80a3
    Hans de Goede authored
    On x86/ACPI boards the acpi_video driver will usually initialize before
    the kms driver (except i915). This causes /sys/class/backlight/acpi_video0
    to show up and then the kms driver registers its own native backlight
    device after which the drivers/acpi/video_detect.c code unregisters
    the acpi_video0 device (when acpi_video_get_backlight_type()==native).
    
    This means that userspace briefly sees 2 devices and the disappearing of
    acpi_video0 after a brief time confuses the systemd backlight level
    save/restore code, see e.g.:
    https://bbs.archlinux.org/viewtopic.php?id=269920
    
    To fix this make backlight class device registration a separate step
    done by a new acpi_video_register_backlight() function. The intend is for
    this to be called by the drm/kms driver *after* it is done setting up its
    own native backlight device. So that acpi_video_get_backlight_type() knows
    if a native backlight will be available or not at acpi_video backlight
    registration time, avoiding the add + remove dance.
    
    Note the new acpi_video_register_backlight() function is also called from
    a delayed work to ensure that the acpi_video backlight devices does get
    registered if necessary even if there is no drm/kms driver or when it is
    disabled.
    
    Changes in v2:
    - Make register_backlight_delay a module parameter, mainly so that it can
      be disabled by Nvidia binary driver users
    Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    3dbc80a3
video.h 3.04 KB