summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_sysfs.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-10-18 10:47:25 +0200
committerSimon Ser <contact@emersion.fr>2021-11-02 14:27:06 +0100
commit0d6a8c5e96833f644b91528de6a3a4398214fb9c (patch)
tree1c4e617fa6069501df5d53d41b315d6611c5a462 /drivers/gpu/drm/drm_sysfs.c
parentdrm/sched: Avoid lockdep spalt on killing a processes (diff)
downloadlinux-0d6a8c5e96833f644b91528de6a3a4398214fb9c.tar.xz
linux-0d6a8c5e96833f644b91528de6a3a4398214fb9c.zip
drm/sysfs: introduce drm_sysfs_connector_hotplug_event
This function sends a hotplug uevent with a CONNECTOR property. Signed-off-by: Simon Ser <contact@emersion.fr> Reviewed-by: Sam Ravnborg <sam@ravnborg.org> Acked-by: Harry Wentland <harry.wentland@amd.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/20211018084707.32253-2-contact@emersion.fr
Diffstat (limited to 'drivers/gpu/drm/drm_sysfs.c')
-rw-r--r--drivers/gpu/drm/drm_sysfs.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 76ff6ec3421b..430e00b16eec 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -410,6 +410,31 @@ void drm_sysfs_hotplug_event(struct drm_device *dev)
EXPORT_SYMBOL(drm_sysfs_hotplug_event);
/**
+ * drm_sysfs_connector_hotplug_event - generate a DRM uevent for any connector
+ * change
+ * @connector: connector which has changed
+ *
+ * Send a uevent for the DRM connector specified by @connector. This will send
+ * a uevent with the properties HOTPLUG=1 and CONNECTOR.
+ */
+void drm_sysfs_connector_hotplug_event(struct drm_connector *connector)
+{
+ struct drm_device *dev = connector->dev;
+ char hotplug_str[] = "HOTPLUG=1", conn_id[21];
+ char *envp[] = { hotplug_str, conn_id, NULL };
+
+ snprintf(conn_id, sizeof(conn_id),
+ "CONNECTOR=%u", connector->base.id);
+
+ drm_dbg_kms(connector->dev,
+ "[CONNECTOR:%d:%s] generating connector hotplug event\n",
+ connector->base.id, connector->name);
+
+ kobject_uevent_env(&dev->primary->kdev->kobj, KOBJ_CHANGE, envp);
+}
+EXPORT_SYMBOL(drm_sysfs_connector_hotplug_event);
+
+/**
* drm_sysfs_connector_status_event - generate a DRM uevent for connector
* property status change
* @connector: connector on which property status changed