[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241122-google-config-fs-v2-13-4b7e6f183320@bootlin.com>
Date: Fri, 22 Nov 2024 18:38:39 +0100
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Rodrigo Siqueira <rodrigosiqueiramelo@...il.com>,
Melissa Wen <melissa.srw@...il.com>,
MaĆra Canal <mairacanal@...eup.net>,
Haneen Mohammed <hamohammed.sa@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Simona Vetter <simona.vetter@...ll.ch>
Cc: jose.exposito89@...il.com, dri-devel@...ts.freedesktop.org,
arthurgrillo@...eup.net, linux-kernel@...r.kernel.org,
jeremie.dautheribes@...tlin.com, miquel.raynal@...tlin.com,
thomas.petazzoni@...tlin.com, seanpaul@...gle.com, nicolejadeyee@...gle.com,
Louis Chauvet <louis.chauvet@...tlin.com>
Subject: [PATCH RFC v2 13/16] drm/vkms: Introduce configfs for connector
status
Signed-off-by: Louis Chauvet <louis.chauvet@...tlin.com>
---
drivers/gpu/drm/vkms/vkms_configfs.c | 45 ++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
diff --git a/drivers/gpu/drm/vkms/vkms_configfs.c b/drivers/gpu/drm/vkms/vkms_configfs.c
index dede56a8a2c1e866734f9c979c76977370907680..6412a8b7b1066f2d3dca1135ebd7fbaed84027b6 100644
--- a/drivers/gpu/drm/vkms/vkms_configfs.c
+++ b/drivers/gpu/drm/vkms/vkms_configfs.c
@@ -981,10 +981,55 @@ static ssize_t connector_type_store(struct config_item *item,
return count;
}
+static ssize_t connector_status_show(struct config_item *item, char *page)
+{
+ struct vkms_config_connector *connector;
+ enum drm_connector_status status;
+ struct vkms_configfs_device *vkms_configfs = connector_child_item_to_vkms_configfs_device(item);
+
+ mutex_lock(&vkms_configfs->lock);
+ connector = connector_item_to_vkms_configfs_connector(item)->vkms_config_connector;
+ status = connector->status;
+ mutex_unlock(&vkms_configfs->lock);
+
+ return sprintf(page, "%u", status);
+}
+
+static ssize_t connector_status_store(struct config_item *item,
+ const char *page, size_t count)
+{
+ struct vkms_config_connector *connector;
+ enum drm_connector_status status = connector_status_unknown;
+ struct vkms_configfs_device *vkms_configfs = connector_child_item_to_vkms_configfs_device(item);
+ int ret;
+
+ ret = kstrtouint(page, 10, &status);
+ if (ret)
+ return ret;
+
+ switch (status) {
+ case connector_status_unknown:
+ case connector_status_connected:
+ case connector_status_disconnected:
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ scoped_guard(mutex, &vkms_configfs->lock) {
+ connector = connector_item_to_vkms_configfs_connector(item)->vkms_config_connector;
+ vkms_config_connector_update_status(connector, status);
+ }
+
+ return count;
+}
+
CONFIGFS_ATTR(connector_, type);
+CONFIGFS_ATTR(connector_, status);
static struct configfs_attribute *connector_attrs[] = {
&connector_attr_type,
+ &connector_attr_status,
NULL,
};
--
2.47.0
Powered by blists - more mailing lists