drm/i915/debugfs: move IPS debugfs to hsw_ips.c
authorJani Nikula <jani.nikula@intel.com>
Thu, 2 Mar 2023 16:16:17 +0000 (18:16 +0200)
committerJani Nikula <jani.nikula@intel.com>
Tue, 14 Mar 2023 08:38:06 +0000 (10:38 +0200)
Follow the style of placing debugfs next to the implementation.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230302161617.2978821-1-jani.nikula@intel.com
drivers/gpu/drm/i915/display/hsw_ips.c
drivers/gpu/drm/i915/display/hsw_ips.h
drivers/gpu/drm/i915/display/intel_display_debugfs.c

index 83aa380..2910f5d 100644 (file)
@@ -267,3 +267,40 @@ void hsw_ips_get_config(struct intel_crtc_state *crtc_state)
                crtc_state->ips_enabled = true;
        }
 }
+
+static int hsw_ips_debugfs_status_show(struct seq_file *m, void *unused)
+{
+       struct drm_i915_private *i915 = m->private;
+       intel_wakeref_t wakeref;
+
+       if (!HAS_IPS(i915))
+               return -ENODEV;
+
+       wakeref = intel_runtime_pm_get(&i915->runtime_pm);
+
+       seq_printf(m, "Enabled by kernel parameter: %s\n",
+                  str_yes_no(i915->params.enable_ips));
+
+       if (DISPLAY_VER(i915) >= 8) {
+               seq_puts(m, "Currently: unknown\n");
+       } else {
+               if (intel_de_read(i915, IPS_CTL) & IPS_ENABLE)
+                       seq_puts(m, "Currently: enabled\n");
+               else
+                       seq_puts(m, "Currently: disabled\n");
+       }
+
+       intel_runtime_pm_put(&i915->runtime_pm, wakeref);
+
+       return 0;
+}
+
+DEFINE_SHOW_ATTRIBUTE(hsw_ips_debugfs_status);
+
+void hsw_ips_debugfs_register(struct drm_i915_private *i915)
+{
+       struct drm_minor *minor = i915->drm.primary;
+
+       debugfs_create_file("i915_ips_status", 0444, minor->debugfs_root,
+                           i915, &hsw_ips_debugfs_status_fops);
+}
index 4564dee..7ed6061 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/types.h>
 
+struct drm_i915_private;
 struct intel_atomic_state;
 struct intel_crtc;
 struct intel_crtc_state;
@@ -22,5 +23,6 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state);
 int hsw_ips_compute_config(struct intel_atomic_state *state,
                           struct intel_crtc *crtc);
 void hsw_ips_get_config(struct intel_crtc_state *crtc_state);
+void hsw_ips_debugfs_register(struct drm_i915_private *i915);
 
 #endif /* __HSW_IPS_H__ */
index 1e654dd..65585f1 100644 (file)
@@ -8,6 +8,7 @@
 #include <drm/drm_debugfs.h>
 #include <drm/drm_fourcc.h>
 
+#include "hsw_ips.h"
 #include "i915_debugfs.h"
 #include "i915_irq.h"
 #include "i915_reg.h"
@@ -48,33 +49,6 @@ static int i915_frontbuffer_tracking(struct seq_file *m, void *unused)
        return 0;
 }
 
-static int i915_ips_status(struct seq_file *m, void *unused)
-{
-       struct drm_i915_private *dev_priv = node_to_i915(m->private);
-       intel_wakeref_t wakeref;
-
-       if (!HAS_IPS(dev_priv))
-               return -ENODEV;
-
-       wakeref = intel_runtime_pm_get(&dev_priv->runtime_pm);
-
-       seq_printf(m, "Enabled by kernel parameter: %s\n",
-                  str_yes_no(dev_priv->params.enable_ips));
-
-       if (DISPLAY_VER(dev_priv) >= 8) {
-               seq_puts(m, "Currently: unknown\n");
-       } else {
-               if (intel_de_read(dev_priv, IPS_CTL) & IPS_ENABLE)
-                       seq_puts(m, "Currently: enabled\n");
-               else
-                       seq_puts(m, "Currently: disabled\n");
-       }
-
-       intel_runtime_pm_put(&dev_priv->runtime_pm, wakeref);
-
-       return 0;
-}
-
 static int i915_sr_status(struct seq_file *m, void *unused)
 {
        struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -1342,7 +1316,6 @@ static const struct file_operations i915_fifo_underrun_reset_ops = {
 
 static const struct drm_info_list intel_display_debugfs_list[] = {
        {"i915_frontbuffer_tracking", i915_frontbuffer_tracking, 0},
-       {"i915_ips_status", i915_ips_status, 0},
        {"i915_sr_status", i915_sr_status, 0},
        {"i915_opregion", i915_opregion, 0},
        {"i915_vbt", i915_vbt, 0},
@@ -1384,6 +1357,7 @@ void intel_display_debugfs_register(struct drm_i915_private *i915)
                                 ARRAY_SIZE(intel_display_debugfs_list),
                                 minor->debugfs_root, minor);
 
+       hsw_ips_debugfs_register(i915);
        intel_dmc_debugfs_register(i915);
        intel_fbc_debugfs_register(i915);
        intel_hpd_debugfs_register(i915);