drm/sysfs: Expose DRM connector id in each connector sysfs
authorWon Chung <wonchung@google.com>
Wed, 29 Mar 2023 01:44:55 +0000 (01:44 +0000)
committerManasi Navare <navaremanasi@chromium.org>
Fri, 28 Apr 2023 20:13:50 +0000 (20:13 +0000)
commitf0038cffa843697501c442eff4468e3ab37031f1
tree0dc2bd7b97f72900a562a511f79faa625faf44d9
parent0be05a75de2916421e88e0d64b001984f54df0bd
drm/sysfs: Expose DRM connector id in each connector sysfs

Expose DRM connector id in device sysfs so that we can map the connector
id to the connector syspath. Currently, even if we can derive the
connector id from modeset, we do not have a way to find the
corresponding connector's syspath.

This is helpful when determining the root connector of MST tree. When a
tree of multiple MST hub is connected to the system, modeset describes
the tree in the PATH blob. For example, consider the following scenario.

+-------------+
| Source      |    +-------------+
| (Device)    |    | BranchX     |
|             |    | (MST)       |
|       [conn6]--->|       [port1]--->DisplayA
+-------------+    |             |
                   |             |    +-------------+
                   |             |    | BranchY     |
                   |             |    | (MST)       |
                   |       [port2]--->|       [port1]----->DisplayB
                   +-------------+    |             |
                                      |       [port2]----->DisplayC
                                      +-------------+

DPMST connector of DisplayA would have "mst:6-1" PATH.
DPMST connector of DisplayB would have "mst:6-2-1" PATH.
DPMST connector of DisplayC would have "mst:6-2-2" PATH.

Given that connector id of 6 is the root of the MST connector tree, we
can utilize this patch to parse through DRM connectors sysfs and find
which connector syspath corresponds to the root connector (id == 6).

ChromeOS intend to use this information for metrics collection. For
example, we want to tell which port is deriving which displays even with
a MST hub. Chromium patch for parsing DRM connector id from the kernel
is at http://crrev.com/c/4317207.

Signed-off-by: Won Chung <wonchung@google.com>
Reviewed-by: Manasi Navare <navaremanasi@chromium.org>
Signed-off-by: Manasi Navare <navaremanasi@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230329014455.1990104-1-wonchung@google.com
drivers/gpu/drm/drm_sysfs.c