From: <sunpeng.li-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: "Leo Li" <sunpeng.li-5C7GfCeVMHo@public.gmane.org>,
"Ville Syrjälä"
<ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: [PATCH 4/7] drm/sysfs: Add mstpath attribute to connector devices
Date: Thu, 16 May 2019 11:18:00 -0400 [thread overview]
Message-ID: <1558019883-12397-5-git-send-email-sunpeng.li@amd.com> (raw)
In-Reply-To: <1558019883-12397-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
From: Leo Li <sunpeng.li@amd.com>
This can be used to create more descriptive symlinks for MST aux
devices. Consider the following udev rule:
SUBSYSTEM=="drm_dp_aux_dev", SUBSYSTEMS=="drm", ATTRS{mstpath}=="?*",
SYMLINK+="drm_dp_aux/by-path/$attr{mstpath}"
The following symlinks will be created (depending on your MST topology):
$ ls /dev/drm_dp_aux/by-path/
card0-mst:0-1 card0-mst:0-1-1 card0-mst:0-1-8 card0-mst:0-8
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: Leo Li <sunpeng.li@amd.com>
---
drivers/gpu/drm/drm_sysfs.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index ecb7b33..e000e0c 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -229,16 +229,39 @@ static ssize_t modes_show(struct device *device,
return written;
}
+static ssize_t mstpath_show(struct device *device,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct drm_connector *connector = to_drm_connector(device);
+ ssize_t ret = 0;
+ char *path;
+
+ mutex_lock(&connector->dev->mode_config.mutex);
+ if (!connector->path_blob_ptr)
+ goto unlock;
+
+ path = connector->path_blob_ptr->data;
+ ret = snprintf(buf, PAGE_SIZE, "card%d-%s\n",
+ connector->dev->primary->index, path);
+
+unlock:
+ mutex_unlock(&connector->dev->mode_config.mutex);
+ return ret;
+}
+
static DEVICE_ATTR_RW(status);
static DEVICE_ATTR_RO(enabled);
static DEVICE_ATTR_RO(dpms);
static DEVICE_ATTR_RO(modes);
+static DEVICE_ATTR_RO(mstpath);
static struct attribute *connector_dev_attrs[] = {
&dev_attr_status.attr,
&dev_attr_enabled.attr,
&dev_attr_dpms.attr,
&dev_attr_modes.attr,
+ &dev_attr_mstpath.attr,
NULL
};
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-05-16 15:18 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-16 15:17 [PATCH 0/7] Add DP MST AUX devices sunpeng.li-5C7GfCeVMHo
2019-05-16 15:17 ` [PATCH 1/7] drm/dp: Use non-cyclic idr sunpeng.li
[not found] ` <1558019883-12397-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-05-16 15:17 ` [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports sunpeng.li-5C7GfCeVMHo
[not found] ` <1558019883-12397-3-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-05-16 21:40 ` Lyude Paul
[not found] ` <3e237f325a98b044231661886329a808d6701146.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-05-30 18:20 ` Li, Sun peng (Leo)
2019-06-03 19:25 ` Lyude Paul
2019-06-03 19:28 ` Lyude Paul
2019-06-06 19:41 ` Li, Sun peng (Leo)
[not found] ` <1acd58fd-a5e8-0f07-709a-902ea67ba760-5C7GfCeVMHo@public.gmane.org>
2019-06-06 21:07 ` Lyude Paul
2019-06-27 22:21 ` Li, Sun peng (Leo)
[not found] ` <f800b501-422e-c7fb-ebce-bd0e1717d2b2-5C7GfCeVMHo@public.gmane.org>
2019-07-01 20:43 ` Lyude Paul
2019-05-16 15:17 ` [PATCH 3/7] drm/dp-mst: Use connector kdev as aux device parent sunpeng.li-5C7GfCeVMHo
[not found] ` <1558019883-12397-4-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-05-16 20:23 ` Lyude Paul
2019-05-16 21:30 ` Lyude Paul
2019-05-16 15:18 ` sunpeng.li-5C7GfCeVMHo [this message]
2019-05-16 15:18 ` [PATCH 7/7] drm/nouveau: " sunpeng.li-5C7GfCeVMHo
[not found] ` <1558019883-12397-8-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-05-16 21:40 ` Lyude Paul
2019-05-16 19:54 ` [PATCH 0/7] Add DP MST AUX devices Lyude Paul
2019-05-16 20:18 ` Lyude Paul
[not found] ` <2248d762446e824def09699f0ef719b9c90d0dbc.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-05-16 20:21 ` Li, Sun peng (Leo)
2019-05-16 15:18 ` [PATCH 5/7] drm/amd/display: Use connector kdev as aux device parent sunpeng.li
2019-05-16 17:21 ` Kazlauskas, Nicholas
2019-05-16 15:18 ` [PATCH 6/7] drm/bridge/analogix-anx78xx: " sunpeng.li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1558019883-12397-5-git-send-email-sunpeng.li@amd.com \
--to=sunpeng.li-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox