drm/i915: Make backlight setup debugs consistent
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 15 Feb 2023 13:56:16 +0000 (15:56 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 16 Feb 2023 10:01:33 +0000 (12:01 +0200)
It's confusing to debug backlight issues when one can't
easily even tell what kind of backlight control was
selected. Sprinkle uniform debug messages to all the
backlight setup functions.

Also the one that was already there (ext_pwm) was
using drm_info() for some reason. I don't think that's
warranted so switch it to drm_dbg_kms() as well.

v2: Deal with AUX backlights too (Jani)
    Move the VLV/CHV initial pipe debug there too (Jani)

Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230215135616.30411-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_backlight.c
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
drivers/gpu/drm/i915/display/intel_dsi_dcs_backlight.c

index a4e4b7f79e4d4e217026623c9d18a80a63570209..cb1e4423decb2c00f07884c4cc4e7e77d0f1a0bf 100644 (file)
@@ -1270,6 +1270,10 @@ static int lpt_setup_backlight(struct intel_connector *connector, enum pipe unus
                               cpu_ctl2 & ~BLM_PWM_ENABLE);
        }
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PCH PWM for backlight control\n",
+                   connector->base.base.id, connector->base.name);
+
        return 0;
 }
 
@@ -1297,6 +1301,10 @@ static int pch_setup_backlight(struct intel_connector *connector, enum pipe unus
        panel->backlight.pwm_enabled = (cpu_ctl2 & BLM_PWM_ENABLE) &&
                (pch_ctl1 & BLM_PCH_PWM_ENABLE);
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PCH PWM for backlight control\n",
+                   connector->base.base.id, connector->base.name);
+
        return 0;
 }
 
@@ -1335,6 +1343,10 @@ static int i9xx_setup_backlight(struct intel_connector *connector, enum pipe unu
 
        panel->backlight.pwm_enabled = val != 0;
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PWM for backlight control\n",
+                   connector->base.base.id, connector->base.name);
+
        return 0;
 }
 
@@ -1364,6 +1376,10 @@ static int i965_setup_backlight(struct intel_connector *connector, enum pipe unu
 
        panel->backlight.pwm_enabled = ctl2 & BLM_PWM_ENABLE;
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PWM for backlight control\n",
+                   connector->base.base.id, connector->base.name);
+
        return 0;
 }
 
@@ -1392,6 +1408,10 @@ static int vlv_setup_backlight(struct intel_connector *connector, enum pipe pipe
 
        panel->backlight.pwm_enabled = ctl2 & BLM_PWM_ENABLE;
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PWM for backlight control (on pipe %c)\n",
+                   connector->base.base.id, connector->base.name, pipe_name(pipe));
+
        return 0;
 }
 
@@ -1428,6 +1448,11 @@ bxt_setup_backlight(struct intel_connector *connector, enum pipe unused)
 
        panel->backlight.pwm_enabled = pwm_ctl & BXT_BLC_PWM_ENABLE;
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PWM for backlight control (controller=%d)\n",
+                   connector->base.base.id, connector->base.name,
+                   panel->backlight.controller);
+
        return 0;
 }
 
@@ -1490,6 +1515,11 @@ cnp_setup_backlight(struct intel_connector *connector, enum pipe unused)
 
        panel->backlight.pwm_enabled = pwm_ctl & BXT_BLC_PWM_ENABLE;
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using native PCH PWM for backlight control (controller=%d)\n",
+                   connector->base.base.id, connector->base.name,
+                   panel->backlight.controller);
+
        return 0;
 }
 
@@ -1538,8 +1568,10 @@ static int ext_pwm_setup_backlight(struct intel_connector *connector,
                        NSEC_PER_SEC / get_vbt_pwm_freq(connector);
        }
 
-       drm_info(&i915->drm, "Using %s PWM for LCD backlight control\n",
-                desc);
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using %s PWM for backlight control\n",
+                   connector->base.base.id, connector->base.name, desc);
+
        return 0;
 }
 
index b92e0b0f5369d459e53a5e68aa71111dbacf92b1..717be9a9ef5bcbf1e24706c75f9a11527bc946e2 100644 (file)
@@ -5256,11 +5256,6 @@ static void intel_edp_backlight_setup(struct intel_dp *intel_dp,
 
                if (pipe != PIPE_A && pipe != PIPE_B)
                        pipe = PIPE_A;
-
-               drm_dbg_kms(&i915->drm,
-                           "[CONNECTOR:%d:%s] using pipe %c for initial backlight setup\n",
-                           connector->base.base.id, connector->base.name,
-                           pipe_name(pipe));
        }
 
        intel_backlight_setup(connector, pipe);
index 83af95bce98dd0f83dddce04c49d2aa338e64ba6..8670b6956feebfc413b6787e187e29f0c1ba7867 100644 (file)
@@ -273,6 +273,11 @@ intel_dp_aux_hdr_disable_backlight(const struct drm_connector_state *conn_state,
        panel->backlight.pwm_funcs->disable(conn_state, intel_backlight_invert_pwm_level(connector, 0));
 }
 
+static const char *dpcd_vs_pwm_str(bool aux)
+{
+       return aux ? "DPCD" : "PWM";
+}
+
 static int
 intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pipe)
 {
@@ -282,11 +287,11 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi
                &connector->base.display_info.luminance_range;
        int ret;
 
-       if (panel->backlight.edp.intel.sdr_uses_aux) {
-               drm_dbg_kms(&i915->drm, "SDR backlight is controlled through DPCD\n");
-       } else {
-               drm_dbg_kms(&i915->drm, "SDR backlight is controlled through PWM\n");
+       drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] SDR backlight is controlled through %s\n",
+                   connector->base.base.id, connector->base.name,
+                   dpcd_vs_pwm_str(panel->backlight.edp.intel.sdr_uses_aux));
 
+       if (!panel->backlight.edp.intel.sdr_uses_aux) {
                ret = panel->backlight.pwm_funcs->setup(connector, pipe);
                if (ret < 0) {
                        drm_err(&i915->drm,
@@ -303,8 +308,10 @@ intel_dp_aux_hdr_setup_backlight(struct intel_connector *connector, enum pipe pi
                panel->backlight.min = 0;
        }
 
-       drm_dbg_kms(&i915->drm, "Using backlight range %d..%d\n", panel->backlight.min,
-                   panel->backlight.max);
+       drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] Using AUX HDR interface for backlight control (range %d..%d)\n",
+                   connector->base.base.id, connector->base.name,
+                   panel->backlight.min, panel->backlight.max);
+
 
        panel->backlight.level = intel_dp_aux_hdr_get_backlight(connector, pipe);
        panel->backlight.enabled = panel->backlight.level != 0;
@@ -386,6 +393,13 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
        if (ret < 0)
                return ret;
 
+       drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] AUX VESA backlight enable is controlled through %s\n",
+                   connector->base.base.id, connector->base.name,
+                   dpcd_vs_pwm_str(panel->backlight.edp.vesa.info.aux_enable));
+       drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] AUX VESA backlight level is controlled through %s\n",
+                   connector->base.base.id, connector->base.name,
+                   dpcd_vs_pwm_str(panel->backlight.edp.vesa.info.aux_set));
+
        if (!panel->backlight.edp.vesa.info.aux_set || !panel->backlight.edp.vesa.info.aux_enable) {
                ret = panel->backlight.pwm_funcs->setup(connector, pipe);
                if (ret < 0) {
@@ -418,6 +432,9 @@ static int intel_dp_aux_vesa_setup_backlight(struct intel_connector *connector,
                }
        }
 
+       drm_dbg_kms(&i915->drm, "[CONNECTOR:%d:%s] Using AUX VESA interface for backlight control\n",
+                   connector->base.base.id, connector->base.name);
+
        return 0;
 }
 
index 20e466d843ce07359da03e4b10ddb8f83afe24a5..0494432453101d0c722e8b5fc5321a9f2ccbdcbd 100644 (file)
@@ -162,6 +162,7 @@ static void dcs_enable_backlight(const struct intel_crtc_state *crtc_state,
 static int dcs_setup_backlight(struct intel_connector *connector,
                               enum pipe unused)
 {
+       struct drm_i915_private *i915 = to_i915(connector->base.dev);
        struct intel_panel *panel = &connector->panel;
 
        if (panel->vbt.backlight.brightness_precision_bits > 8)
@@ -171,6 +172,10 @@ static int dcs_setup_backlight(struct intel_connector *connector,
 
        panel->backlight.level = panel->backlight.max;
 
+       drm_dbg_kms(&i915->drm,
+                   "[CONNECTOR:%d:%s] Using DCS for backlight control\n",
+                   connector->base.base.id, connector->base.name);
+
        return 0;
 }