Who is responsible for creating the "/sys/class/drm" directory structure, more specifically the "/sys/class/drm/card0-LVDS-1" directory?
I am using kernel-2.6.38 and an nVidia card.
Who is responsible for creating the "/sys/class/drm" directory structure, more specifically the "/sys/class/drm/card0-LVDS-1" directory?
I am using kernel-2.6.38 and an nVidia card.
The DRM module is responsible for that subtree in SysFS. You can browse the source code for that in drivers/gpu/drm/drm_sysfs.c.
The subdirectories are per-connector, with a name of the form card%d-%s with %d replaced by an index (that I know nothing about) and %s replaced with the connector name.
Five files per device should show up:
For some devices, you'll get extra information for sub-connectors too.
There has been some development since the last accepted answer, hence I'm creating a new answer.
As of v6.2.11 the source code responsible for this sysfs subtree is still drivers/gpu/drm/drm_sysfs.c (working link).
The DRM driver itself may create 5 different entry types, based on hardware support. They are: card%d, controlD%s, renderD%d, accel%d, then for each card connector card%d-%s. The %d are device minor numbers, which should start at 0 for the cards then in matching 64 increments for controlD, renderD and accel respectively. There are no minors for the connectors, they are on their respective card's minor.
The controlD entries are backward-compatibility symlinks created by create_compat_control_link() in drivers/gpu/drm/drm_drv.c.
The connector name's format (the %s in card%d-%s) is %s-%d, where %s is a name from struct drm_conn_prop_enum_list drm_connector_enum_list[] in drivers/gpu/drm/drm_connector.c and %d is a connector index number starting from 1 (as a card may have more than one connector of the same type).
Finally, any driver can register its own devices here using drm_class_device_register() in drivers/gpu/drm/drm_sysfs.c.