diff mbox series

[v2,2/2] drm/i915/display: Add darkscreen debugfs entry under crtc

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

Commit Message

Nemesa Garg Oct. 27, 2023, 9:53 a.m. UTC
This is to set the enable/disable status.

v2: Addressed review comments (Jani)

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

Comments

Murthy, Arun R Dec. 12, 2023, 6:23 a.m. UTC | #1
> -----Original Message-----
> From: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org> On Behalf Of Nemesa
> Garg
> Sent: Friday, October 27, 2023 3:24 PM
> To: intel-gfx@lists.freedesktop.org
> Subject: [Intel-gfx] [v2 2/2] drm/i915/display: Add darkscreen debugfs entry
> under crtc
> 
> This is to set the enable/disable status.
> 
> v2: Addressed review comments (Jani)
> 
> Signed-off-by: Nemesa Garg <nemesa.garg@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>

Thanks and Regards,
Arun R Murthy
--------------------
> ---
>  .../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
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 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);