Typically the acpi_video driver will initialize before nouveau, which used to cause /sys/class/backlight/acpi_video0 to get registered and then nouveau would register its own nv_backlight device later. After which the drivers/acpi/video_detect.c code unregistered the acpi_video0 device to avoid there being 2 backlight devices. This means that userspace used to briefly see 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 the ACPI video code has been modified to make backlight class device registration a separate step, relying on the drm/kms driver to ask for the acpi_video backlight registration after it is done setting up its native backlight device. Add a call to the new acpi_video_register_backlight() when native backlight device registration has failed / was skipped to ensure that there is a backlight device available before the drm_device gets registered with userspace. Changes in v2: - Add nouveau_acpi_video_register_backlight() wrapper to avoid unresolved symbol errors on non X86 Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
28 lines
1.1 KiB
C
28 lines
1.1 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
#ifndef __NOUVEAU_ACPI_H__
|
|
#define __NOUVEAU_ACPI_H__
|
|
|
|
#define ROM_BIOS_PAGE 4096
|
|
|
|
#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
|
|
bool nouveau_is_optimus(void);
|
|
bool nouveau_is_v1_dsm(void);
|
|
void nouveau_register_dsm_handler(void);
|
|
void nouveau_unregister_dsm_handler(void);
|
|
void nouveau_switcheroo_optimus_dsm(void);
|
|
void *nouveau_acpi_edid(struct drm_device *, struct drm_connector *);
|
|
bool nouveau_acpi_video_backlight_use_native(void);
|
|
void nouveau_acpi_video_register_backlight(void);
|
|
#else
|
|
static inline bool nouveau_is_optimus(void) { return false; };
|
|
static inline bool nouveau_is_v1_dsm(void) { return false; };
|
|
static inline void nouveau_register_dsm_handler(void) {}
|
|
static inline void nouveau_unregister_dsm_handler(void) {}
|
|
static inline void nouveau_switcheroo_optimus_dsm(void) {}
|
|
static inline void *nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return NULL; }
|
|
static inline bool nouveau_acpi_video_backlight_use_native(void) { return true; }
|
|
static inline void nouveau_acpi_video_register_backlight(void) {}
|
|
#endif
|
|
|
|
#endif
|