Before this commit when we want userspace to use the acpi_video backlight
device we 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.
Registering 2 backlight devices for a single display really is
undesirable, don't register the GPU's native backlight device when
another backlight device should be used.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220917205920.647212-5-hdegoede@redhat.com
 
  * Authors: Eric Knopp
  */
 
+#include <acpi/video.h>
+
 #include "psb_drv.h"
 #include "psb_intel_reg.h"
 #include "psb_intel_drv.h"
        if (ret)
                return ret;
 
+       if (!acpi_video_backlight_use_native()) {
+               drm_info(dev, "Skipping %s backlight registration\n",
+                        dev_priv->ops->backlight_name);
+               return 0;
+       }
+
 #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE
        props.brightness = dev_priv->backlight_level;
        props.max_brightness = PSB_MAX_BRIGHTNESS;