[Intel-gfx] [v2 2/2] drm/i915/display: Add darkscreen debugfs entry under crtc

Nemesa Garg nemesa.garg at intel.com
Fri Oct 27 09:53:36 UTC 2023


This is to set the enable/disable status.

v2: Addressed review comments (Jani)

Signed-off-by: Nemesa Garg <nemesa.garg at intel.com>
---
 .../gpu/drm/i915/display/intel_darkscreen.c   | 36 +++++++++++++++++++
 .../drm/i915/display/intel_display_debugfs.c  |  2 ++
 2 files changed, 38 insertions(+)

diff --git a/drivers/gpu/drm/i915/display/intel_darkscreen.c b/drivers/gpu/drm/i915/display/intel_darkscreen.c
index 0be719c76c4e..2d0b78c4d645 100644
--- a/drivers/gpu/drm/i915/display/intel_darkscreen.c
+++ b/drivers/gpu/drm/i915/display/intel_darkscreen.c
@@ -85,3 +85,39 @@ void intel_dark_screen_disable(struct intel_crtc_state *crtc_state)
 
 	intel_de_write(dev_priv, DARK_SCREEN(cpu_transcoder), 0);
 }
+
+static int intel_darkscreen_debugfs_status_get(void *data, u64 *val)
+{
+	struct intel_crtc *crtc = data;
+
+	*val = crtc->dark_screen.enable;
+
+	return 0;
+}
+
+static int intel_darkscreen_debugfs_status_set(void *data, u64 val)
+{
+	struct intel_crtc *crtc = data;
+	struct intel_crtc_state *crtc_state;
+
+	crtc->dark_screen.enable = val;
+
+	crtc_state = to_intel_crtc_state(crtc->base.state);
+
+	if (val)
+		intel_dark_screen_enable(crtc_state);
+	else
+		intel_dark_screen_disable(crtc_state);
+
+	return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(intel_darkscreen_debugfs_status_fops,
+			 intel_darkscreen_debugfs_status_get,
+			 intel_darkscreen_debugfs_status_set, "%llu\n");
+
+void intel_darkscreen_crtc_debugfs_add(struct intel_crtc *crtc)
+{
+	debugfs_create_file("i915_darkscreen_status", 0644, crtc->base.debugfs_entry,
+			    crtc, &intel_darkscreen_debugfs_status_fops);
+}
diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
index d76f9aa0b192..48a0d802b838 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -16,6 +16,7 @@
 #include "intel_crtc.h"
 #include "intel_de.h"
 #include "intel_crtc_state_dump.h"
+#include "intel_darkscreen.h"
 #include "intel_display_debugfs.h"
 #include "intel_display_power.h"
 #include "intel_display_power_well.h"
@@ -1551,6 +1552,7 @@ void intel_crtc_debugfs_add(struct intel_crtc *crtc)
 	intel_drrs_crtc_debugfs_add(crtc);
 	intel_fbc_crtc_debugfs_add(crtc);
 	hsw_ips_crtc_debugfs_add(crtc);
+	intel_darkscreen_crtc_debugfs_add(crtc);
 
 	debugfs_create_file("i915_current_bpc", 0444, root, crtc,
 			    &i915_current_bpc_fops);
-- 
2.25.1



More information about the Intel-gfx mailing list