Commit 3e206b6a authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Tvrtko Ursulin

drm/i915/sdvo: Filter out invalid outputs more sensibly

We try to filter out the corresponding xxx1 output
if the xxx0 output is not present. But the way that is
being done is pretty awkward. Make it less so.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221026101134.20865-2-ville.syrjala@linux.intel.comReviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
(cherry picked from commit cc1e6639)
Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent d3f6bacf
...@@ -2926,16 +2926,33 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) ...@@ -2926,16 +2926,33 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
return false; return false;
} }
static u16 intel_sdvo_filter_output_flags(u16 flags)
{
flags &= SDVO_OUTPUT_MASK;
/* SDVO requires XXX1 function may not exist unless it has XXX0 function.*/
if (!(flags & SDVO_OUTPUT_TMDS0))
flags &= ~SDVO_OUTPUT_TMDS1;
if (!(flags & SDVO_OUTPUT_RGB0))
flags &= ~SDVO_OUTPUT_RGB1;
if (!(flags & SDVO_OUTPUT_LVDS0))
flags &= ~SDVO_OUTPUT_LVDS1;
return flags;
}
static bool static bool
intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags) intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags)
{ {
/* SDVO requires XXX1 function may not exist unless it has XXX0 function.*/ flags = intel_sdvo_filter_output_flags(flags);
if (flags & SDVO_OUTPUT_TMDS0) if (flags & SDVO_OUTPUT_TMDS0)
if (!intel_sdvo_dvi_init(intel_sdvo, 0)) if (!intel_sdvo_dvi_init(intel_sdvo, 0))
return false; return false;
if ((flags & SDVO_TMDS_MASK) == SDVO_TMDS_MASK) if (flags & SDVO_OUTPUT_TMDS1)
if (!intel_sdvo_dvi_init(intel_sdvo, 1)) if (!intel_sdvo_dvi_init(intel_sdvo, 1))
return false; return false;
...@@ -2956,7 +2973,7 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags) ...@@ -2956,7 +2973,7 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags)
if (!intel_sdvo_analog_init(intel_sdvo, 0)) if (!intel_sdvo_analog_init(intel_sdvo, 0))
return false; return false;
if ((flags & SDVO_RGB_MASK) == SDVO_RGB_MASK) if (flags & SDVO_OUTPUT_RGB1)
if (!intel_sdvo_analog_init(intel_sdvo, 1)) if (!intel_sdvo_analog_init(intel_sdvo, 1))
return false; return false;
...@@ -2964,11 +2981,11 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags) ...@@ -2964,11 +2981,11 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, u16 flags)
if (!intel_sdvo_lvds_init(intel_sdvo, 0)) if (!intel_sdvo_lvds_init(intel_sdvo, 0))
return false; return false;
if ((flags & SDVO_LVDS_MASK) == SDVO_LVDS_MASK) if (flags & SDVO_OUTPUT_LVDS1)
if (!intel_sdvo_lvds_init(intel_sdvo, 1)) if (!intel_sdvo_lvds_init(intel_sdvo, 1))
return false; return false;
if ((flags & SDVO_OUTPUT_MASK) == 0) { if (flags == 0) {
unsigned char bytes[2]; unsigned char bytes[2];
intel_sdvo->controlled_output = 0; intel_sdvo->controlled_output = 0;
......
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