drm/vkms: Allow to update the connector status

Implement the drm_connector_funcs.detect() callback to update the
connector status by returning the status stored in the configuration.

Tested-by: Mark Yacoub <markyacoub@google.com>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Link: https://lore.kernel.org/r/20251016175618.10051-16-jose.exposito89@gmail.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
This commit is contained in:
José Expósito 2025-10-16 19:56:17 +02:00 committed by Luca Ceresoli
parent 6f00987f5c
commit 466f43885a
2 changed files with 31 additions and 0 deletions

View File

@ -5,9 +5,37 @@
#include <drm/drm_managed.h>
#include <drm/drm_probe_helper.h>
#include "vkms_config.h"
#include "vkms_connector.h"
static enum drm_connector_status vkms_connector_detect(struct drm_connector *connector,
bool force)
{
struct drm_device *dev = connector->dev;
struct vkms_device *vkmsdev = drm_device_to_vkms_device(dev);
struct vkms_connector *vkms_connector;
enum drm_connector_status status;
struct vkms_config_connector *connector_cfg;
vkms_connector = drm_connector_to_vkms_connector(connector);
/*
* The connector configuration might not exist if its configfs directory
* was deleted. Therefore, use the configuration if present or keep the
* current status if we can not access it anymore.
*/
status = connector->status;
vkms_config_for_each_connector(vkmsdev->config, connector_cfg) {
if (connector_cfg->connector == vkms_connector)
status = vkms_config_connector_get_status(connector_cfg);
}
return status;
}
static const struct drm_connector_funcs vkms_connector_funcs = {
.detect = vkms_connector_detect,
.fill_modes = drm_helper_probe_single_connector_modes,
.reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,

View File

@ -5,6 +5,9 @@
#include "vkms_drv.h"
#define drm_connector_to_vkms_connector(target) \
container_of(target, struct vkms_connector, base)
/**
* struct vkms_connector - VKMS custom type wrapping around the DRM connector
*