On Thu, Mar 05, 2015 at 09:50:31AM +0000, Chris Wilson wrote: > On Thu, Mar 05, 2015 at 09:45:41AM +0000, Chris Wilson wrote: > > Since the beginning, sysfs/connector/status has done a heavyweight > > detection of the current connector status. But no user, such as upowerd > > or logind, has ever desired to initiate a probe. Move the probing into a > > new attribute so that existing readers get the behaviour they desire. > > > > v2: David Herrmann suggested using "echo detect > /sys/.../status" to > > trigger the probing, which is a fine idea. This extends that to also > > allow the user to apply the force detection overrides at runtime. > > > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > > Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> > > Cc: David Herrmann <dh.herrmann@xxxxxxxxx> > > Cc: Dave Airlie <airled@xxxxxxxxxx> > > Cc: Alex Deucher <alexdeucher@xxxxxxxxx> > > --- > > drivers/gpu/drm/drm_sysfs.c | 58 ++++++++++++++++++++++++++++++++++++++++----- > > 1 file changed, 52 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c > > index 5c99d3773212..c1ae57ec7afa 100644 > > --- a/drivers/gpu/drm/drm_sysfs.c > > +++ b/drivers/gpu/drm/drm_sysfs.c > > @@ -166,23 +166,69 @@ void drm_sysfs_destroy(void) > > /* > > * Connector properties > > */ > > -static ssize_t status_show(struct device *device, > > +static ssize_t status_store(struct device *device, > > struct device_attribute *attr, > > - char *buf) > > + const char *buf, size_t count) > > { > > struct drm_connector *connector = to_drm_connector(device); > > - enum drm_connector_status status; > > + enum drm_connector_status old_status; > > int ret; > > > > ret = mutex_lock_interruptible(&connector->dev->mode_config.mutex); > > if (ret) > > return ret; > > > > - status = connector->funcs->detect(connector, true); > > + old_status = connector->status; > > + > > + if (strcmp(buf, "detect") == 0) { > > + connector->force = 0; > > + connector->funcs->detect(connector, true); > > This has to be: > connector->status = connector->funcs->detect(connector, true); > > > + } else if (strcmp(buf, "on") == 0) { > > + connector->force = DRM_FORCE_ON; > > + } else if (strcmp(buf, "on-digital") == 0) { > > + connector->force = DRM_FORCE_ON_DIGITAL; > > Is it worth reducing this to just "digital"? Imo ok as-is, digital is just a substate used by some drivers to decide between dvi-d and dvi-i modes. For most connectors it's the same as plain "on". -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel