summaryrefslogtreecommitdiff
path: root/include/acpi
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2022-04-15 14:59:48 +0300
committerHans de Goede <hdegoede@redhat.com>2022-08-17 13:30:05 +0300
commit2600bfa3df9944562d43d1f17016832a6ffa3b38 (patch)
tree5206d8cc6ea54884b7b434d1c395349c0b34d6d3 /include/acpi
parent568035b01cfb107af8d2e4bd2fb9aea22cf5b868 (diff)
downloadlinux-2600bfa3df9944562d43d1f17016832a6ffa3b38.tar.xz
ACPI: video: Add acpi_video_backlight_use_native() helper
ATM on x86 laptops where we want userspace to use the acpi_video backlight device we often register both the GPU's native backlight device and acpi_video's firmware acpi_video# backlight device. This relies on userspace preferring firmware type backlight devices over native ones, but registering 2 backlight devices for a single display really is undesirable. On x86 laptops where the native GPU backlight device should be used, the registering of other backlight devices is avoided by their drivers using acpi_video_get_backlight_type() and only registering their backlight if the return value matches their type. acpi_video_get_backlight_type() uses backlight_device_get_by_type(BACKLIGHT_RAW) to determine if a native driver is available and will never return native if this returns false. This means that the GPU's native backlight registering code cannot just call acpi_video_get_backlight_type() to determine if it should register its backlight, since acpi_video_get_backlight_type() will never return native until the native backlight has already registered. To fix this add a new internal native function parameter to acpi_video_get_backlight_type(), which when set to true will make acpi_video_get_backlight_type() behave as if a native backlight has already been registered. And add a new acpi_video_backlight_use_native() helper, which sets this to true, for use in native GPU backlight code. Changes in v2: - Replace adding a native parameter to acpi_video_get_backlight_type() with adding a new acpi_video_backlight_use_native() helper. Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/video.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/acpi/video.h b/include/acpi/video.h
index db8548ff03ce..4705e339c252 100644
--- a/include/acpi/video.h
+++ b/include/acpi/video.h
@@ -56,6 +56,7 @@ extern void acpi_video_unregister(void);
extern int acpi_video_get_edid(struct acpi_device *device, int type,
int device_id, void **edid);
extern enum acpi_backlight_type acpi_video_get_backlight_type(void);
+extern bool acpi_video_backlight_use_native(void);
extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type);
/*
* Note: The value returned by acpi_video_handles_brightness_key_presses()
@@ -77,6 +78,10 @@ static inline enum acpi_backlight_type acpi_video_get_backlight_type(void)
{
return acpi_backlight_vendor;
}
+static inline bool acpi_video_backlight_use_native(void)
+{
+ return true;
+}
static inline void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type)
{
}