drm/i915/debugfs: clean up LPSP status
authorJani Nikula <jani.nikula@intel.com>
Mon, 30 Aug 2021 12:53:40 +0000 (15:53 +0300)
committerJani Nikula <jani.nikula@intel.com>
Thu, 2 Sep 2021 11:11:59 +0000 (14:11 +0300)
Clean up the LPSP status printout. No functional changes.

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c7c2db4e1434ed9a3545f2561a03dc593db5e674.1630327990.git.jani.nikula@intel.com
drivers/gpu/drm/i915/display/intel_display_debugfs.c

index ca819f9..a501c02 100644 (file)
@@ -1324,9 +1324,6 @@ static int i915_drrs_status(struct seq_file *m, void *unused)
        return 0;
 }
 
-#define LPSP_STATUS(COND) (COND ? seq_puts(m, "LPSP: enabled\n") : \
-                               seq_puts(m, "LPSP: disabled\n"))
-
 static bool
 intel_lpsp_power_well_enabled(struct drm_i915_private *i915,
                              enum i915_power_well_id power_well_id)
@@ -1345,32 +1342,20 @@ intel_lpsp_power_well_enabled(struct drm_i915_private *i915,
 static int i915_lpsp_status(struct seq_file *m, void *unused)
 {
        struct drm_i915_private *i915 = node_to_i915(m->private);
-
-       if (DISPLAY_VER(i915) >= 13) {
-               LPSP_STATUS(!intel_lpsp_power_well_enabled(i915,
-                                                          SKL_DISP_PW_2));
+       bool lpsp_enabled = false;
+
+       if (DISPLAY_VER(i915) >= 13 || IS_DISPLAY_VER(i915, 9, 10)) {
+               lpsp_enabled = !intel_lpsp_power_well_enabled(i915, SKL_DISP_PW_2);
+       } else if (IS_DISPLAY_VER(i915, 11, 12)) {
+               lpsp_enabled = !intel_lpsp_power_well_enabled(i915, ICL_DISP_PW_3);
+       } else if (IS_HASWELL(i915) || IS_BROADWELL(i915)) {
+               lpsp_enabled = !intel_lpsp_power_well_enabled(i915, HSW_DISP_PW_GLOBAL);
+       } else {
+               seq_puts(m, "LPSP: not supported\n");
                return 0;
        }
 
-       switch (DISPLAY_VER(i915)) {
-       case 12:
-       case 11:
-               LPSP_STATUS(!intel_lpsp_power_well_enabled(i915, ICL_DISP_PW_3));
-               break;
-       case 10:
-       case 9:
-               LPSP_STATUS(!intel_lpsp_power_well_enabled(i915, SKL_DISP_PW_2));
-               break;
-       default:
-               /*
-                * Apart from HASWELL/BROADWELL other legacy platform doesn't
-                * support lpsp.
-                */
-               if (IS_HASWELL(i915) || IS_BROADWELL(i915))
-                       LPSP_STATUS(!intel_lpsp_power_well_enabled(i915, HSW_DISP_PW_GLOBAL));
-               else
-                       seq_puts(m, "LPSP: not supported\n");
-       }
+       seq_printf(m, "LPSP: %s\n", enableddisabled(lpsp_enabled));
 
        return 0;
 }