drm/i915/sdvo: Only set is_lvds if we have a valid fixed mode.

If we have failed to ascertain the fixed mode for the LVDS panel, then
trust the pixel clock ranges reported for the connection when determing
valid modes. This makes intel_sdvo_mode_valid() consistent with
intel_lvds_mode_valid() which is also a no-op is there is no fixed mode
defined. (Since the mode is both validated by SDVO and LVDS, why are
checking against an LVDS fixed mode in SDVO...)

By only defining is_lvds to be true when we actually have an LVDS output
with a fixed mode, we avoid various potential NULL deferences where the
assumption is made that all LVDS outputs have a fixed mode.

References:

Bug 29449 - [Q35] failure to read EDID/vbios for LVDS, no mode => no output
https://bugs.freedesktop.org/show_bug.cgi?id=29449

The primary failure in this bug is not finding the EDID and determining
the correct fixed panel mode. However, this patch should fix the
secondary issue of not enabling any of the standard modes for the panel
either.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Eric Anholt <eric@anholt.net>

authored by

Chris Wilson and committed by
Eric Anholt
8545423a aa40d6bb

+3 -7
+3 -7
drivers/gpu/drm/i915/intel_sdvo.c
··· 1274 1274 if (intel_sdvo->pixel_clock_max < mode->clock) 1275 1275 return MODE_CLOCK_HIGH; 1276 1276 1277 - if (intel_sdvo->is_lvds == true) { 1278 - if (intel_sdvo->sdvo_lvds_fixed_mode == NULL) 1279 - return MODE_PANEL; 1280 - 1277 + if (intel_sdvo->is_lvds) { 1281 1278 if (mode->hdisplay > intel_sdvo->sdvo_lvds_fixed_mode->hdisplay) 1282 1279 return MODE_PANEL; 1283 1280 ··· 1531 1534 intel_sdvo->base.needs_tv_clock = true; 1532 1535 } 1533 1536 if (response & SDVO_LVDS_MASK) 1534 - intel_sdvo->is_lvds = true; 1537 + intel_sdvo->is_lvds = intel_sdvo->sdvo_lvds_fixed_mode != NULL; 1535 1538 } 1536 1539 1537 1540 return ret; ··· 1694 1697 if (newmode->type & DRM_MODE_TYPE_PREFERRED) { 1695 1698 intel_sdvo->sdvo_lvds_fixed_mode = 1696 1699 drm_mode_duplicate(connector->dev, newmode); 1700 + intel_sdvo->is_lvds = true; 1697 1701 break; 1698 1702 } 1699 1703 } ··· 2187 2189 connector = &intel_connector->base; 2188 2190 encoder->encoder_type = DRM_MODE_ENCODER_LVDS; 2189 2191 connector->connector_type = DRM_MODE_CONNECTOR_LVDS; 2190 - 2191 - intel_sdvo->is_lvds = true; 2192 2192 2193 2193 if (device == 0) { 2194 2194 intel_sdvo->controlled_output |= SDVO_OUTPUT_LVDS0;