Commit 04514c14 authored by Jani Nikula's avatar Jani Nikula

drm/i915/display: stop using BUG()

Avoid bringing the entire machine down even if there's a bug that
shouldn't happen, but won't corrupt the system either. Log them loudly
and limp on.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220531162527.1062319-1-jani.nikula@intel.com
parent 4f543d66
...@@ -455,6 +455,9 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder, ...@@ -455,6 +455,9 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
temp |= TRANS_DDI_SELECT_PORT(port); temp |= TRANS_DDI_SELECT_PORT(port);
switch (crtc_state->pipe_bpp) { switch (crtc_state->pipe_bpp) {
default:
MISSING_CASE(crtc_state->pipe_bpp);
fallthrough;
case 18: case 18:
temp |= TRANS_DDI_BPC_6; temp |= TRANS_DDI_BPC_6;
break; break;
...@@ -467,8 +470,6 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder, ...@@ -467,8 +470,6 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
case 36: case 36:
temp |= TRANS_DDI_BPC_12; temp |= TRANS_DDI_BPC_12;
break; break;
default:
BUG();
} }
if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_PVSYNC) if (crtc_state->hw.adjusted_mode.flags & DRM_MODE_FLAG_PVSYNC)
...@@ -478,6 +479,9 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder, ...@@ -478,6 +479,9 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
if (cpu_transcoder == TRANSCODER_EDP) { if (cpu_transcoder == TRANSCODER_EDP) {
switch (pipe) { switch (pipe) {
default:
MISSING_CASE(pipe);
fallthrough;
case PIPE_A: case PIPE_A:
/* On Haswell, can only use the always-on power well for /* On Haswell, can only use the always-on power well for
* eDP when not using the panel fitter, and when not * eDP when not using the panel fitter, and when not
...@@ -494,9 +498,6 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder, ...@@ -494,9 +498,6 @@ intel_ddi_transcoder_func_reg_val_get(struct intel_encoder *encoder,
case PIPE_C: case PIPE_C:
temp |= TRANS_DDI_EDP_INPUT_C_ONOFF; temp |= TRANS_DDI_EDP_INPUT_C_ONOFF;
break; break;
default:
BUG();
break;
} }
} }
......
...@@ -500,6 +500,9 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, ...@@ -500,6 +500,9 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
i915_reg_t dpll_reg; i915_reg_t dpll_reg;
switch (dig_port->base.port) { switch (dig_port->base.port) {
default:
MISSING_CASE(dig_port->base.port);
fallthrough;
case PORT_B: case PORT_B:
port_mask = DPLL_PORTB_READY_MASK; port_mask = DPLL_PORTB_READY_MASK;
dpll_reg = DPLL(0); dpll_reg = DPLL(0);
...@@ -513,8 +516,6 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, ...@@ -513,8 +516,6 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
port_mask = DPLL_PORTD_READY_MASK; port_mask = DPLL_PORTD_READY_MASK;
dpll_reg = DPIO_PHY_STATUS; dpll_reg = DPIO_PHY_STATUS;
break; break;
default:
BUG();
} }
if (intel_de_wait_for_register(dev_priv, dpll_reg, if (intel_de_wait_for_register(dev_priv, dpll_reg,
...@@ -3159,6 +3160,10 @@ static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state) ...@@ -3159,6 +3160,10 @@ static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state)
PIPECONF_DITHER_TYPE_SP; PIPECONF_DITHER_TYPE_SP;
switch (crtc_state->pipe_bpp) { switch (crtc_state->pipe_bpp) {
default:
/* Case prevented by intel_choose_pipe_bpp_dither. */
MISSING_CASE(crtc_state->pipe_bpp);
fallthrough;
case 18: case 18:
pipeconf |= PIPECONF_BPC_6; pipeconf |= PIPECONF_BPC_6;
break; break;
...@@ -3168,9 +3173,6 @@ static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state) ...@@ -3168,9 +3173,6 @@ static void i9xx_set_pipeconf(const struct intel_crtc_state *crtc_state)
case 30: case 30:
pipeconf |= PIPECONF_BPC_10; pipeconf |= PIPECONF_BPC_10;
break; break;
default:
/* Case prevented by intel_choose_pipe_bpp_dither. */
BUG();
} }
} }
...@@ -3466,6 +3468,10 @@ static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state) ...@@ -3466,6 +3468,10 @@ static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state)
val = 0; val = 0;
switch (crtc_state->pipe_bpp) { switch (crtc_state->pipe_bpp) {
default:
/* Case prevented by intel_choose_pipe_bpp_dither. */
MISSING_CASE(crtc_state->pipe_bpp);
fallthrough;
case 18: case 18:
val |= PIPECONF_BPC_6; val |= PIPECONF_BPC_6;
break; break;
...@@ -3478,9 +3484,6 @@ static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state) ...@@ -3478,9 +3484,6 @@ static void ilk_set_pipeconf(const struct intel_crtc_state *crtc_state)
case 36: case 36:
val |= PIPECONF_BPC_12; val |= PIPECONF_BPC_12;
break; break;
default:
/* Case prevented by intel_choose_pipe_bpp_dither. */
BUG();
} }
if (crtc_state->dither) if (crtc_state->dither)
......
...@@ -1798,13 +1798,14 @@ static inline enum dpio_channel ...@@ -1798,13 +1798,14 @@ static inline enum dpio_channel
vlv_dig_port_to_channel(struct intel_digital_port *dig_port) vlv_dig_port_to_channel(struct intel_digital_port *dig_port)
{ {
switch (dig_port->base.port) { switch (dig_port->base.port) {
default:
MISSING_CASE(dig_port->base.port);
fallthrough;
case PORT_B: case PORT_B:
case PORT_D: case PORT_D:
return DPIO_CH0; return DPIO_CH0;
case PORT_C: case PORT_C:
return DPIO_CH1; return DPIO_CH1;
default:
BUG();
} }
} }
...@@ -1812,13 +1813,14 @@ static inline enum dpio_phy ...@@ -1812,13 +1813,14 @@ static inline enum dpio_phy
vlv_dig_port_to_phy(struct intel_digital_port *dig_port) vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
{ {
switch (dig_port->base.port) { switch (dig_port->base.port) {
default:
MISSING_CASE(dig_port->base.port);
fallthrough;
case PORT_B: case PORT_B:
case PORT_C: case PORT_C:
return DPIO_PHY0; return DPIO_PHY0;
case PORT_D: case PORT_D:
return DPIO_PHY1; return DPIO_PHY1;
default:
BUG();
} }
} }
...@@ -1826,13 +1828,14 @@ static inline enum dpio_channel ...@@ -1826,13 +1828,14 @@ static inline enum dpio_channel
vlv_pipe_to_channel(enum pipe pipe) vlv_pipe_to_channel(enum pipe pipe)
{ {
switch (pipe) { switch (pipe) {
default:
MISSING_CASE(pipe);
fallthrough;
case PIPE_A: case PIPE_A:
case PIPE_C: case PIPE_C:
return DPIO_CH0; return DPIO_CH0;
case PIPE_B: case PIPE_B:
return DPIO_CH1; return DPIO_CH1;
default:
BUG();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment