Skip to content
Snippets Groups Projects
  1. Sep 03, 2022
    • Hans de Goede's avatar
      ACPI: video: Refactor acpi_video_get_backlight_type() a bit · b39be9f4
      Hans de Goede authored
      
      Refactor acpi_video_get_backlight_type() so that the heuristics /
      detection steps are stricly in order of descending precedence.
      
      Also move the comments describing the steps to when the various steps are
      actually done, to avoid the comments getting out of sync with the code.
      
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      b39be9f4
    • Hans de Goede's avatar
      platform/x86: nvidia-wmi-ec-backlight: Move fw interface definitions to a header (v2) · 3db2aeb1
      Hans de Goede authored
      
      Move the WMI interface definitions to a header, so that the definitions
      can be shared with drivers/acpi/video_detect.c .
      
      Changes in v2:
      - Add missing Nvidia copyright header
      - Move WMI_BRIGHTNESS_GUID to nvidia-wmi-ec-backlight.h as well
      
      Suggested-by: default avatarDaniel Dadap <ddadap@nvidia.com>
      Reviewed-by: default avatarDaniel Dadap <ddadap@nvidia.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      3db2aeb1
    • Hans de Goede's avatar
      drm/radeon: Register ACPI video backlight when skipping radeon backlight registration · 5e0e33f9
      Hans de Goede authored
      Typically the acpi_video driver will initialize before radeon, which
      used to cause /sys/class/backlight/acpi_video0 to get registered and then
      radeon would register its own radeon_bl# 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 radeon skips
      registering its own backlight device because of e.g. the firmware_flags
      or the acpi_video_get_backlight_type() return value. This ensures that
      if the acpi_video backlight device should be used, it will be available
      before the radeon drm_device gets registered with userspace.
      
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      5e0e33f9
    • Hans de Goede's avatar
      drm/amdgpu: Register ACPI video backlight when skipping amdgpu backlight registration · c0f50c5d
      Hans de Goede authored
      Typically the acpi_video driver will initialize before amdgpu, which
      used to cause /sys/class/backlight/acpi_video0 to get registered and then
      amdgpu would register its own amdgpu_bl# 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 amdgpu skips
      registering its own backlight device because of either the firmware_flags
      or the acpi_video_get_backlight_type() return value. This ensures that
      if the acpi_video backlight device should be used, it will be available
      before the amdgpu drm_device gets registered with userspace.
      
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      c0f50c5d
    • Hans de Goede's avatar
      drm/nouveau: Register ACPI video backlight when nv_backlight registration fails (v2) · c0533838
      Hans de Goede authored
      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: default avatarLyude Paul <lyude@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      c0533838
    • Hans de Goede's avatar
      drm/i915: Call acpi_video_register_backlight() (v3) · 3c8b6a39
      Hans de Goede authored
      On machins without an i915 opregion the acpi_video driver immediately
      probes the ACPI video bus and used to also immediately register
      acpi_video# backlight devices when supported.
      
      Once the drm/kms driver then loaded later and possibly registered
      a native backlight device then the drivers/acpi/video_detect.c code
      unregistered the acpi_video0 device to avoid there being 2 backlight
      devices (when acpi_video_get_backlight_type()==native).
      
      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() after the i915 calls
      acpi_video_register() (after setting up the i915 opregion) so that the
      acpi_video backlight devices get registered on systems where the i915
      native backlight device is not registered.
      
      Changes in v2:
      -Only call acpi_video_register_backlight() when a panel is detected
      
      Changes in v3:
      -Add a new intel_acpi_video_register() helper which checks if a panel
       is present and then calls acpi_video_register_backlight()
      
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      3c8b6a39
  2. Sep 02, 2022
  3. Aug 25, 2022
    • Hans de Goede's avatar
      drm/radeon: Don't register backlight when another backlight should be used (v3) · 1eb67781
      Hans de Goede authored
      
      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.
      
      Changes in v2:
      - To avoid linker errors when amdgpu is builtin and video_detect.c is in
        a module, select ACPI_VIDEO and its deps if ACPI is enabled.
        When ACPI is disabled, ACPI_VIDEO is also always disabled, ensuring
        the stubs from acpi/video.h will be used.
      
      Changes in v3:
      - Use drm_info(drm_dev, "...") to log messages
      - ACPI_VIDEO can now be enabled on non X86 too,
        adjust the Kconfig changes to match this.
      
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      1eb67781
    • Hans de Goede's avatar
      drm/amdgpu: Don't register backlight when another backlight should be used (v3) · da11ef83
      Hans de Goede authored
      
      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.
      
      Changes in v2:
      - To avoid linker errors when amdgpu is builtin and video_detect.c is in
        a module, select ACPI_VIDEO and its deps if ACPI is enabled.
        When ACPI is disabled, ACPI_VIDEO is also always disabled, ensuring
        the stubs from acpi/video.h will be used.
      
      Changes in v3:
      - Use drm_info(drm_dev, "...") to log messages
      - ACPI_VIDEO can now be enabled on non X86 too,
        adjust the Kconfig changes to match this.
      
      Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      da11ef83
    • Hans de Goede's avatar
      drm/i915: Don't register backlight when another backlight should be used (v2) · b1d36e73
      Hans de Goede authored
      
      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.
      
      Changes in v2:
      - Use drm_info(drm_dev,  ...) for log messages
      
      Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      b1d36e73
  4. Aug 17, 2022
    • Hans de Goede's avatar
      ACPI: video: Add acpi_video_backlight_use_native() helper · 2600bfa3
      Hans de Goede authored
      
      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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      2600bfa3
  5. Aug 12, 2022
  6. Aug 11, 2022
Loading