diff mbox series

[2/2] drm/i915: Add the darkscreen debugfs under crtc

Message ID 20231025102734.2783492-3-nemesa.garg@intel.com (mailing list archive)
State New, archived
Headers show
Series Enable Darkscreen Feature | expand

Commit Message

Garg, Nemesa Oct. 25, 2023, 10:27 a.m. UTC
Add debugfs entry for darkscreen to know the status
bpc and timer value .

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

Comments

Jani Nikula Oct. 25, 2023, 11:21 a.m. UTC | #1
On Wed, 25 Oct 2023, Nemesa Garg <nemesa.garg@intel.com> wrote:
> Add debugfs entry for darkscreen to know the status
> bpc and timer value .

Superfluous space before '.'.

>
> Signed-off-by: Nemesa Garg <nemesa.garg@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);

Can it be enabled on the fly?

The function returns early if !enable. So how do you *disable* this
thing?

> +
> +	return 0;
> +}
> +
> +/*
> + * Check the status whether the darkscreen
> + * is enabled or not.
> + */

Useless comment.

> +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);
diff mbox series

Patch

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);