drm/i915: Check error return when converting pipe to connector
An error from intel_get_pipe_from_connector() would mean a bug somewhere else, but we still should check for it to prevent some other more obscure bug later. v2: - Fall back to a reasonable default instead of bailing out in case of error. (Jani) v3: - Fix s/PIPE_INVALID/INVALID_PIPE/ typo. (Jani) v4: - Fix bogus bracing around WARN() condition. (Ville) Cc: Jani Nikula <jani.nikula@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1494408113-379-5-git-send-email-imre.deak@intel.com
This commit is contained in:
parent
4519290aec
commit
0290cf3f9f
|
@ -888,10 +888,14 @@ static void pch_enable_backlight(struct intel_connector *connector)
|
||||||
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
|
struct drm_i915_private *dev_priv = to_i915(connector->base.dev);
|
||||||
struct intel_panel *panel = &connector->panel;
|
struct intel_panel *panel = &connector->panel;
|
||||||
enum pipe pipe = intel_get_pipe_from_connector(connector);
|
enum pipe pipe = intel_get_pipe_from_connector(connector);
|
||||||
enum transcoder cpu_transcoder =
|
enum transcoder cpu_transcoder;
|
||||||
intel_pipe_to_cpu_transcoder(dev_priv, pipe);
|
|
||||||
u32 cpu_ctl2, pch_ctl1, pch_ctl2;
|
u32 cpu_ctl2, pch_ctl1, pch_ctl2;
|
||||||
|
|
||||||
|
if (!WARN_ON_ONCE(pipe == INVALID_PIPE))
|
||||||
|
cpu_transcoder = intel_pipe_to_cpu_transcoder(dev_priv, pipe);
|
||||||
|
else
|
||||||
|
cpu_transcoder = TRANSCODER_EDP;
|
||||||
|
|
||||||
cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2);
|
cpu_ctl2 = I915_READ(BLC_PWM_CPU_CTL2);
|
||||||
if (cpu_ctl2 & BLM_PWM_ENABLE) {
|
if (cpu_ctl2 & BLM_PWM_ENABLE) {
|
||||||
DRM_DEBUG_KMS("cpu backlight already enabled\n");
|
DRM_DEBUG_KMS("cpu backlight already enabled\n");
|
||||||
|
@ -973,6 +977,9 @@ static void i965_enable_backlight(struct intel_connector *connector)
|
||||||
enum pipe pipe = intel_get_pipe_from_connector(connector);
|
enum pipe pipe = intel_get_pipe_from_connector(connector);
|
||||||
u32 ctl, ctl2, freq;
|
u32 ctl, ctl2, freq;
|
||||||
|
|
||||||
|
if (WARN_ON_ONCE(pipe == INVALID_PIPE))
|
||||||
|
pipe = PIPE_A;
|
||||||
|
|
||||||
ctl2 = I915_READ(BLC_PWM_CTL2);
|
ctl2 = I915_READ(BLC_PWM_CTL2);
|
||||||
if (ctl2 & BLM_PWM_ENABLE) {
|
if (ctl2 & BLM_PWM_ENABLE) {
|
||||||
DRM_DEBUG_KMS("backlight already enabled\n");
|
DRM_DEBUG_KMS("backlight already enabled\n");
|
||||||
|
@ -1037,6 +1044,9 @@ static void bxt_enable_backlight(struct intel_connector *connector)
|
||||||
enum pipe pipe = intel_get_pipe_from_connector(connector);
|
enum pipe pipe = intel_get_pipe_from_connector(connector);
|
||||||
u32 pwm_ctl, val;
|
u32 pwm_ctl, val;
|
||||||
|
|
||||||
|
if (WARN_ON_ONCE(pipe == INVALID_PIPE))
|
||||||
|
pipe = PIPE_A;
|
||||||
|
|
||||||
/* Controller 1 uses the utility pin. */
|
/* Controller 1 uses the utility pin. */
|
||||||
if (panel->backlight.controller == 1) {
|
if (panel->backlight.controller == 1) {
|
||||||
val = I915_READ(UTIL_PIN_CTL);
|
val = I915_READ(UTIL_PIN_CTL);
|
||||||
|
@ -1093,7 +1103,8 @@ void intel_panel_enable_backlight(struct intel_connector *connector)
|
||||||
if (!panel->backlight.present)
|
if (!panel->backlight.present)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
|
if (!WARN_ON_ONCE(pipe == INVALID_PIPE))
|
||||||
|
DRM_DEBUG_KMS("pipe %c\n", pipe_name(pipe));
|
||||||
|
|
||||||
mutex_lock(&dev_priv->backlight_lock);
|
mutex_lock(&dev_priv->backlight_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue