drm/sysfs: expose the "force" connector attribute
Subsystems (2)
PATCH 1/1 drm/sysfs: expose the "force" connector attribute
--- drivers/gpu/drm/drm_sysfs.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)
drivers/gpu/drm/drm_sysfs.c +49 -0
@@ -338,11 +338,60 @@ static ssize_t select_subconnector_show(struct device *device, drm_get_dvi_i_select_name((int)subconnector)); } +static ssize_t force_show (struct device *device, +struct device_attribute *attr, +char *buf) +{ +struct drm_connector *connector =to_drm_connector (device); +char *status; + +switch (connector->force) { +case DRM_FORCE_ON : + status ="on" ; +break ; + +case DRM_FORCE_ON_DIGITAL : + status ="digital" ; +break ; + +case DRM_FORCE_OFF : + status ="off" ; +break ; + +case DRM_FORCE_UNSPECIFIED : + status ="unspecified" ; +break ; + +default : +return 0 ; + } + +return snprintf (buf,PAGE_SIZE ,"%s\n" , status); +} + +ssize_t force_store (struct device *device,struct device_attribute *attr, +const char *buf,size_t count) +{ +struct drm_connector *connector =to_drm_connector (device); + +if (strcmp (buf,"on" ) ==0 ) + connector->force =DRM_FORCE_ON ; +else if (strcmp (buf,"digital" ) ==0 ) + connector->force =DRM_FORCE_ON_DIGITAL ; +else if (strcmp (buf,"off" ) ==0 ) + connector->force =DRM_FORCE_OFF ; +else if (strcmp (buf,"unspecified" ) ==0 ) + connector->force =DRM_FORCE_UNSPECIFIED ; + +return count; +} +static struct device_attribute connector_attrs[] = {__ATTR_RO (status),__ATTR_RO (enabled),__ATTR_RO (dpms),__ATTR_RO (modes), +__ATTR_RW (force), };/* These attributes are for both DVI-I connectors and all types of tv-out. */
Signature · 1 line
1.9.0
Hi
Quoted 1 line · Thomas Wood
Signed-off-by Thomas Wood <[email protected]>
The commit-msg lacks any discussion why this change is done. What is the reason to do that? Isn't the kernel-command-line enough? Why is this a regular feature instead of a debugfs attribute?
Quoted 9 lines
--- drivers/gpu/drm/drm_sysfs.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)drivers/gpu/drm/drm_sysfs.c +0
-0
drivers/gpu/drm/drm_sysfs.c static ssize_t select_subconnector_show(struct device *device, · line 346
Quoted 9 lines
drivers/gpu/drm/drm_sysfs.c +6
-0@@ -338,11 +338,60 @@ static ssize_t select_subconnector_show(struct device *device, drm_get_dvi_i_select_name((int)subconnector)); } +static ssize_t force_show (struct device *device, +struct device_attribute *attr, +char *buf) +{ +struct drm_connector *connector =to_drm_connector (device); +char *status;
"const char *" or gcc might warn on string assignments.
Quoted 28 lines
drivers/gpu/drm/drm_sysfs.c +28
-0+ +switch (connector->force) { +case DRM_FORCE_ON : + status ="on" ; +break ; + +case DRM_FORCE_ON_DIGITAL : + status ="digital" ; +break ; + +case DRM_FORCE_OFF : + status ="off" ; +break ; + +case DRM_FORCE_UNSPECIFIED : + status ="unspecified" ; +break ; + +default : +return 0 ; + } + +return snprintf (buf,PAGE_SIZE ,"%s\n" , status); +} + +ssize_t force_store (struct device *device,struct device_attribute *attr, +const char *buf,size_t count) +{
drivers/gpu/drm/drm_sysfs.c static ssize_t select_subconnector_show(struct device *device, · line 384
Quoted 10 lines
drivers/gpu/drm/drm_sysfs.c +10
-0+struct drm_connector *connector =to_drm_connector (device); + +if (strcmp (buf,"on" ) ==0 ) + connector->force =DRM_FORCE_ON ; +else if (strcmp (buf,"digital" ) ==0 ) + connector->force =DRM_FORCE_ON_DIGITAL ; +else if (strcmp (buf,"off" ) ==0 ) + connector->force =DRM_FORCE_OFF ; +else if (strcmp (buf,"unspecified" ) ==0 ) + connector->force =DRM_FORCE_UNSPECIFIED ;
else
return -EINVAL;
This really looks like a debug-feature to me. If it's a real feature, we _must_ rescan connectors here, otherwise it seems odd writing "on" into that file but nothing happens until the next modeset.
Thanks
David
Quoted 20 lines
drivers/gpu/drm/drm_sysfs.c +5
-1+ +return count; +} +static struct device_attribute connector_attrs[] = {__ATTR_RO (status),__ATTR_RO (enabled),__ATTR_RO (dpms),__ATTR_RO (modes), +__ATTR_RW (force), };/* These attributes are for both DVI-I connectors and all types of tv-out. */ --1.9.0
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 8 lines · David Herrmann
Hi
Quoted 1 line · Thomas Wood
Signed-off-by Thomas Wood <[email protected]>The commit-msg lacks any discussion why this change is done. What is the reason to do that? Isn't the kernel-command-line enough? Why is this a regular feature instead of a debugfs attribute?
It was intended as a debug/testing feature to allow tests in intel-gpu-tools to enable or disable connectors:
http://lists.freedesktop.org/archives/intel-gfx/2014-May/045556.html
I'll update the commit message for the next version of the patch.
Quoted 92 lines
Quoted 10 lines
--- drivers/gpu/drm/drm_sysfs.c | 49 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+)drivers/gpu/drm/drm_sysfs.c +0
-0drivers/gpu/drm/drm_sysfs.c static ssize_t select_subconnector_show(struct device *device, · line 346
Quoted 9 lines
drivers/gpu/drm/drm_sysfs.c +6
-0@@ -338,11 +338,60 @@ static ssize_t select_subconnector_show(struct device *device, drm_get_dvi_i_select_name((int)subconnector)); } +static ssize_t force_show (struct device *device, +struct device_attribute *attr, +char *buf) +{ +struct drm_connector *connector =to_drm_connector (device); +char *status;"const char *" or gcc might warn on string assignments.
Quoted 28 lines
drivers/gpu/drm/drm_sysfs.c +28
-0+ +switch (connector->force) { +case DRM_FORCE_ON : + status ="on" ; +break ; + +case DRM_FORCE_ON_DIGITAL : + status ="digital" ; +break ; + +case DRM_FORCE_OFF : + status ="off" ; +break ; + +case DRM_FORCE_UNSPECIFIED : + status ="unspecified" ; +break ; + +default : +return 0 ; + } + +return snprintf (buf,PAGE_SIZE ,"%s\n" , status); +} + +ssize_t force_store (struct device *device,struct device_attribute *attr, +const char *buf,size_t count) +{drivers/gpu/drm/drm_sysfs.c static ssize_t select_subconnector_show(struct device *device, · line 384
Quoted 10 lines
drivers/gpu/drm/drm_sysfs.c +10
-0+struct drm_connector *connector =to_drm_connector (device); + +if (strcmp (buf,"on" ) ==0 ) + connector->force =DRM_FORCE_ON ; +else if (strcmp (buf,"digital" ) ==0 ) + connector->force =DRM_FORCE_ON_DIGITAL ; +else if (strcmp (buf,"off" ) ==0 ) + connector->force =DRM_FORCE_OFF ; +else if (strcmp (buf,"unspecified" ) ==0 ) + connector->force =DRM_FORCE_UNSPECIFIED ;else
return -EINVAL;This really looks like a debug-feature to me. If it's a real feature, we _must_ rescan connectors here, otherwise it seems odd writing "on" into that file but nothing happens until the next modeset.
Thanks
DavidQuoted 20 lines
drivers/gpu/drm/drm_sysfs.c +5
-1+ +return count; +} +static struct device_attribute connector_attrs[] = {__ATTR_RO (status),__ATTR_RO (enabled),__ATTR_RO (dpms),__ATTR_RO (modes), +__ATTR_RW (force), };/* These attributes are for both DVI-I connectors and all types of tv-out. */ --1.9.0
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi
Quoted 11 lines · Thomas Wood
Quoted 8 lines · David Herrmann
Hi
Quoted 1 line · Thomas Wood
Signed-off-by Thomas Wood <[email protected]>The commit-msg lacks any discussion why this change is done. What is the reason to do that? Isn't the kernel-command-line enough? Why is this a regular feature instead of a debugfs attribute?
Quoted 7 lines
It was intended as a debug/testing feature to allow tests in intel-gpu-tools to enable or disable connectors:
http://lists.freedesktop.org/archives/intel-gfx/2014-May/045556.html
I'll update the commit message for the next version of the patch.
Thanks! But please make it a debugfs feature, if possible. We shouldn't expose interfaces in sysfs that aren't part of the core API. Note that this might require you to encode the connector-name in the debugfs-attribute-name.
Thanks
David
Quoted 20 lines · David Herrmann
Hi
Quoted 17 lines · Thomas Wood
Quoted 8 lines · David Herrmann
Hi
Quoted 1 line · Thomas Wood
Signed-off-by Thomas Wood <[email protected]>The commit-msg lacks any discussion why this change is done. What is the reason to do that? Isn't the kernel-command-line enough? Why is this a regular feature instead of a debugfs attribute?
It was intended as a debug/testing feature to allow tests in intel-gpu-tools to enable or disable connectors:
http://lists.freedesktop.org/archives/intel-gfx/2014-May/045556.html
Quoted 6 lines
Quoted 1 line
I'll update the commit message for the next version of the patch.
Thanks! But please make it a debugfs feature, if possible. We shouldn't expose interfaces in sysfs that aren't part of the core API. Note that this might require you to encode the connector-name in the debugfs-attribute-name.
Imo having the read and write side in completely different parts doesn't make a lot of sense. Hence I think doing this in sysfs is ok. Also users might want to frob this for testing, and usually debugfs is a bit further away on most systems.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Hi
Quoted 15 lines · Daniel Vetter
Quoted 7 lines · David Herrmann
Quoted 6 lines · Thomas Wood
It was intended as a debug/testing feature to allow tests in intel-gpu-tools to enable or disable connectors:
http://lists.freedesktop.org/archives/intel-gfx/2014-May/045556.html
Quoted 6 lines
Quoted 1 line
I'll update the commit message for the next version of the patch.
Thanks! But please make it a debugfs feature, if possible. We shouldn't expose interfaces in sysfs that aren't part of the core API. Note that this might require you to encode the connector-name in the debugfs-attribute-name.
Quoted 4 lines
Imo having the read and write side in completely different parts doesn't make a lot of sense. Hence I think doing this in sysfs is ok. Also users might want to frob this for testing, and usually debugfs is a bit further away on most systems.
So the read-side is not debug-only? That wasn't clear to me. In that case, I'm fine with keeping it in sysfs, although I'm not entirely sure why anyone is interested in "force" information.
Thanks
David
Quoted 17 lines · David Herrmann
Quoted 15 lines · Daniel Vetter
Quoted 13 lines · David Herrmann
Quoted 7 lines · Thomas Wood
It was intended as a debug/testing feature to allow tests in intel-gpu-tools to enable or disable connectors:
http://lists.freedesktop.org/archives/intel-gfx/2014-May/045556.html
I'll update the commit message for the next version of the patch.
Thanks! But please make it a debugfs feature, if possible. We shouldn't expose interfaces in sysfs that aren't part of the core API. Note that this might require you to encode the connector-name in the debugfs-attribute-name.
Quoted 8 lines
Quoted 4 lines
Imo having the read and write side in completely different parts doesn't make a lot of sense. Hence I think doing this in sysfs is ok. Also users might want to frob this for testing, and usually debugfs is a bit further away on most systems.
So the read-side is not debug-only? That wasn't clear to me. In that case, I'm fine with keeping it in sysfs, although I'm not entirely sure why anyone is interested in "force" information.
Oh, I've mixed this up with the corresponding patch to overwrite the edid, which we want to keep exposing through sysfs ofc. I guess debugfs for this is indeed fine then since it's completely new. Might be a bit of fun for lifetimes (especially with dp mst), but meh on that one - we can't make this worse really. So I agree that debugfs makes more sense.
For the filename bikeshed a simpley "connector_<name>_force seems good enough. Or maybe a connector-<name> subdir if we want to dwell in overkill.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch