drm/amd/display: Pass proper parent for DM backlight device registration

The parent for the backlight device should be the drm-connector object,
not the PCI device.

Userspace relies on this to be able to detect which backlight class device
to use on hybrid gfx devices where there may be multiple native (raw)
backlight devices registered.

Specifically gnome-settings-daemon expects the parent device to have
an "enabled" sysfs attribute (as drm_connector devices do) and tests
that this returns "enabled" when read.

This aligns the parent of the backlight device with i915, nouveau, radeon.
Note that drivers/gpu/drm/amd/amdgpu/atombios_encoders.c also already
uses the drm_connector as parent, only amdgpu_dm.c used the PCI device
as parent before this change.

Note this is marked as a RFC because I don't have hw to test, so this
has only been compile tested! If someone can test this on actual
hw which hits the changed code path that would be great.

Link: https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/issues/730
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Hans de Goede
2023-02-15 12:38:33 +01:00
committed by Alex Deucher
parent 424b3d7582
commit d24b77e444

View File

@@ -4142,7 +4142,8 @@ static const struct backlight_ops amdgpu_dm_backlight_ops = {
};
static void
amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm,
struct amdgpu_dm_connector *aconnector)
{
char bl_name[16];
struct backlight_properties props = { 0 };
@@ -4165,7 +4166,7 @@ amdgpu_dm_register_backlight_device(struct amdgpu_display_manager *dm)
adev_to_drm(dm->adev)->primary->index + dm->num_of_edps);
dm->backlight_dev[dm->num_of_edps] = backlight_device_register(bl_name,
adev_to_drm(dm->adev)->dev,
aconnector->base.kdev,
dm,
&amdgpu_dm_backlight_ops,
&props);
@@ -4218,6 +4219,7 @@ static int initialize_plane(struct amdgpu_display_manager *dm,
static void register_backlight_device(struct amdgpu_display_manager *dm,
struct amdgpu_dm_connector *aconnector,
struct dc_link *link)
{
if ((link->connector_signal & (SIGNAL_TYPE_EDP | SIGNAL_TYPE_LVDS)) &&
@@ -4228,7 +4230,7 @@ static void register_backlight_device(struct amdgpu_display_manager *dm,
* is better then a black screen.
*/
if (!dm->backlight_dev[dm->num_of_edps])
amdgpu_dm_register_backlight_device(dm);
amdgpu_dm_register_backlight_device(dm, aconnector);
if (dm->backlight_dev[dm->num_of_edps]) {
dm->backlight_link[dm->num_of_edps] = link;
@@ -4415,7 +4417,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev)
if (ret) {
amdgpu_dm_update_connector_after_detect(aconnector);
register_backlight_device(dm, link);
register_backlight_device(dm, aconnector, link);
if (dm->num_of_edps)
update_connector_ext_caps(aconnector);