All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Call sysfs_notify after changing drm_connector::dpms
@ 2017-09-19  9:53 Karsten Wiese
  2017-09-25 13:48 ` Jani Nikula
  0 siblings, 1 reply; 11+ messages in thread
From: Karsten Wiese @ 2017-09-19  9:53 UTC (permalink / raw)
  To: dri-devel; +Cc: Karsten Wiese

This makes poll work for the
/sys/class/drm/cardX/connectorY/dpms attributes.

Tested with i915 suspended by XScreenServer and
suspend to RAM.

Signed-off-by: Karsten Wiese <fzuuzf@googlemail.com>
---
 drivers/gpu/drm/drm_atomic.c        | 4 ++++
 drivers/gpu/drm/drm_atomic_helper.c | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 2fd383d..b6fa87b 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1880,6 +1880,10 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state,
 out:
 	if (ret != 0)
 		connector->dpms = old_mode;
+	else
+		if (connector->dpms != old_mode)
+			sysfs_notify(&connector->kdev->kobj, NULL, "dpms");
+
 	return ret;
 }
 
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
index 4e53aae..6198772 100644
--- a/drivers/gpu/drm/drm_atomic_helper.c
+++ b/drivers/gpu/drm/drm_atomic_helper.c
@@ -921,12 +921,16 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev,
 		crtc = new_conn_state->crtc;
 		if ((!crtc && old_conn_state->crtc) ||
 		    (crtc && drm_atomic_crtc_needs_modeset(crtc->state))) {
-			int mode = DRM_MODE_DPMS_OFF;
+			int old_mode, mode = DRM_MODE_DPMS_OFF;
 
 			if (crtc && crtc->state->active)
 				mode = DRM_MODE_DPMS_ON;
 
+			old_mode = connector->dpms;
 			connector->dpms = mode;
+			if (old_mode != mode)
+				sysfs_notify(&connector->kdev->kobj,
+						NULL, "dpms");
 		}
 	}
 
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-09-27 15:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-19  9:53 [PATCH] drm: Call sysfs_notify after changing drm_connector::dpms Karsten Wiese
2017-09-25 13:48 ` Jani Nikula
2017-09-26 22:29   ` Karsten Wiese
2017-09-27  7:18     ` Jani Nikula
2017-09-27 10:20       ` Karsten Wiese
2017-09-27 11:47         ` Daniel Vetter
2017-09-27 12:58           ` Jani Nikula
2017-09-27 15:03             ` Karsten Wiese
2017-09-27 15:16               ` Jani Nikula
2017-09-27  8:45     ` Daniel Vetter
2017-09-27 10:38       ` Karsten Wiese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.