test bl_idx instead of the connector type to check for backlight
authorjsg <jsg@openbsd.org>
Tue, 26 Mar 2024 11:09:02 +0000 (11:09 +0000)
committerjsg <jsg@openbsd.org>
Tue, 26 Mar 2024 11:09:02 +0000 (11:09 +0000)
tested by tb@

sys/dev/pci/drm/amd/amdgpu/amdgpu_drv.c

index d6dced8..e66e503 100644 (file)
@@ -3448,15 +3448,16 @@ amdgpu_init_backlight(struct amdgpu_device *adev)
        struct backlight_device *bd = adev->dm.backlight_dev[0];
        struct drm_connector_list_iter conn_iter;
        struct drm_connector *connector;
+       struct amdgpu_dm_connector *aconnector;
 
        if (bd == NULL)
                return;
                
        drm_connector_list_iter_begin(dev, &conn_iter);
        drm_for_each_connector_iter(connector, &conn_iter) {
-               if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS &&
-                   connector->connector_type != DRM_MODE_CONNECTOR_eDP &&
-                   connector->connector_type != DRM_MODE_CONNECTOR_DSI)
+               aconnector = to_amdgpu_dm_connector(connector);
+
+               if (aconnector->bl_idx == -1)
                        continue;
 
                connector->backlight_device = bd;
@@ -3464,6 +3465,8 @@ amdgpu_init_backlight(struct amdgpu_device *adev)
                    0, "Backlight", 0, bd->props.max_brightness);
                drm_object_attach_property(&connector->base,
                    connector->backlight_property, bd->props.brightness);
+
+               break;
        }
        drm_connector_list_iter_end(&conn_iter);
 }