[Intel-gfx] [PATCH 2/2] drm/i915: Add the darkscreen debugfs under crtc
Nemesa Garg
nemesa.garg at intel.com
Wed Oct 25 10:27:34 UTC 2023
Add debugfs entry for darkscreen to know the status
bpc and timer value .
Signed-off-by: Nemesa Garg <nemesa.garg at intel.com>
---
.../gpu/drm/i915/display/intel_darkscreen.c | 38 +++++++++++++++++++
.../drm/i915/display/intel_display_debugfs.c | 2 +
2 files changed, 40 insertions(+)
diff --git a/drivers/gpu/drm/i915/display/intel_darkscreen.c b/drivers/gpu/drm/i915/display/intel_darkscreen.c
index ef68dbc7a296..c6490c16fdb5 100644
--- a/drivers/gpu/drm/i915/display/intel_darkscreen.c
+++ b/drivers/gpu/drm/i915/display/intel_darkscreen.c
@@ -67,3 +67,41 @@ void dark_screen_enable(struct intel_crtc_state *crtc_state)
intel_de_rmw(dev_priv, DARK_SCREEN(crtc->config->cpu_transcoder), 0, DARK_SCREEN_DETECT |
DARK_SCREEN_DONE);
}
+
+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 (crtc_state)
+ dark_screen_enable(crtc_state);
+
+ return 0;
+}
+
+/*
+ * Check the status whether the darkscreen
+ * is enabled or not.
+ */
+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 2836826f8c05..27a6141eab3e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c
+++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c
@@ -33,6 +33,7 @@
#include "intel_psr.h"
#include "intel_psr_regs.h"
#include "intel_wm.h"
+#include "intel_darkscreen.h"
static inline struct drm_i915_private *node_to_i915(struct drm_info_node *node)
{
@@ -1539,6 +1540,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