diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 639450a..228378d 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -69,6 +69,8 @@ struct i830_lvds_priv { enum pfit_mode fitting_mode; uint32_t pfit_control; uint32_t pfit_pgm_ratios; + uint32_t max_clock; + uint32_t min_clock; }; #define BACKLIGHT_CLASS "/sys/class/backlight" @@ -1280,6 +1282,15 @@ static const xf86OutputFuncsRec i830_lvds_output_funcs = { #endif }; +static Bool +i830_lvds_valid_fixed_mode(struct i830_lvds_priv *dev_priv, + DisplayModePtr mode) +{ + if (dev_priv->max_clock < mode->Clock || + dev_priv->min_clock > mode->Clock) + return FALSE; + return TRUE; +} void i830_lvds_init(ScrnInfoPtr pScrn) { @@ -1315,6 +1326,15 @@ i830_lvds_init(ScrnInfoPtr pScrn) dev_priv = (struct i830_lvds_priv *) (intel_output + 1); intel_output->dev_priv = dev_priv; + if (INREG(LVDS) & LVDS_B0B3_POWER_MASK) { + /* dual channel KHZ*/ + dev_priv->max_clock = 224000; + dev_priv->min_clock = 80000; + } else { + /* single channel KHZ*/ + dev_priv->max_clock = 112000; + dev_priv->min_clock = 20000; + } /* * Mode detection algorithms for LFP: * 1) if EDID present, use it, done @@ -1343,6 +1363,8 @@ i830_lvds_init(ScrnInfoPtr pScrn) */ modes = i830_ddc_get_modes(output); for (scan = modes; scan != NULL; scan = scan->next) { + if (i830_lvds_valid_fixed_mode(dev_priv, scan) == FALSE) + continue; if (scan->type & M_T_PREFERRED) break; } @@ -1369,7 +1391,8 @@ i830_lvds_init(ScrnInfoPtr pScrn) * the BIOS being unavailable or broken, but lack the configuration options * for now. */ - if (pI830->lvds_fixed_mode) + if (pI830->lvds_fixed_mode && + i830_lvds_valid_fixed_mode(dev_priv, pI830->lvds_fixed_mode)) goto found_mode; /* If we *still* don't have a mode, try checking if the panel is already