Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit e3cb536f63bd8e7e0220b801e37434fc13a2df2d
- Author: Dan Yang <dsyang92 (at) gmail (dot) com>
- Date: Sat Apr 7 17:58:33 2012 -0400
- Implement manual override of LVDS single/dual channel mode (updated)
- diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
- index d04597d..2bee604 100644
- --- a/drivers/gpu/drm/i915/i915_drv.c
- +++ b/drivers/gpu/drm/i915/i915_drv.c
- @@ -74,6 +74,10 @@ MODULE_PARM_DESC(i915_enable_fbc,
- "Enable frame buffer compression for power savings "
- "(default: -1 (use per-chip default))");
- +unsigned int i915_lvds_channels __read_mostly = 0;
- +module_param_named(lvds_channels, i915_lvds_channels, int, 0600);
- +MODULE_PARM_DESC(lvds_channels, "LVDS channels in use: 0=(default) prove hardware 1=single 2=dual");
- +
- unsigned int i915_lvds_downclock __read_mostly = 0;
- module_param_named(lvds_downclock, i915_lvds_downclock, int, 0400);
- MODULE_PARM_DESC(lvds_downclock,
- diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
- index ae294a0..6b1a198 100644
- --- a/drivers/gpu/drm/i915/i915_drv.h
- +++ b/drivers/gpu/drm/i915/i915_drv.h
- @@ -1010,6 +1010,7 @@ extern int i915_panel_ignore_lid __read_mostly;
- extern unsigned int i915_powersave __read_mostly;
- extern int i915_semaphores __read_mostly;
- extern unsigned int i915_lvds_downclock __read_mostly;
- +extern unsigned int i915_lvds_channels __read_mostly;
- extern int i915_panel_use_ssc __read_mostly;
- extern int i915_vbt_sdvo_panel_type __read_mostly;
- extern int i915_enable_rc6 __read_mostly;
- diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
- index 9ec9755..c3dbb35 100644
- --- a/drivers/gpu/drm/i915/intel_display.c
- +++ b/drivers/gpu/drm/i915/intel_display.c
- @@ -356,6 +356,19 @@ static const intel_limit_t intel_limits_ironlake_display_port = {
- .find_pll = intel_find_pll_ironlake_dp,
- };
- +static int intel_is_dual_channel_mode(struct drm_crtc *crtc)
- +{
- + struct drm_device *dev = crtc->dev;
- + struct drm_i915_private *dev_priv = dev->dev_private;
- + if(i915_lvds_channels) {
- + /* user specified desired channel mode */
- + return (i915_lvds_channels == 2);
- + }
- +
- + /* User did not specify mode so probe hardware */
- + return ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) == LVDS_CLKB_POWER_UP);
- +}
- +
- static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
- int refclk)
- {
- @@ -364,8 +377,7 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
- const intel_limit_t *limit;
- if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
- - if ((I915_READ(PCH_LVDS) & LVDS_CLKB_POWER_MASK) ==
- - LVDS_CLKB_POWER_UP) {
- + if (intel_is_dual_channel_mode(crtc)) {
- /* LVDS dual channel */
- if (refclk == 100000)
- limit = &intel_limits_ironlake_dual_lvds_100m;
- @@ -388,18 +400,16 @@ static const intel_limit_t *intel_ironlake_limit(struct drm_crtc *crtc,
- static const intel_limit_t *intel_g4x_limit(struct drm_crtc *crtc)
- {
- - struct drm_device *dev = crtc->dev;
- - struct drm_i915_private *dev_priv = dev->dev_private;
- const intel_limit_t *limit;
- if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
- - if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
- - LVDS_CLKB_POWER_UP)
- + if (intel_is_dual_channel_mode(crtc)) {
- /* LVDS with dual channel */
- limit = &intel_limits_g4x_dual_channel_lvds;
- - else
- - /* LVDS with dual channel */
- + } else {
- + /* LVDS with single channel */
- limit = &intel_limits_g4x_single_channel_lvds;
- + }
- } else if (intel_pipe_has_type(crtc, INTEL_OUTPUT_HDMI) ||
- intel_pipe_has_type(crtc, INTEL_OUTPUT_ANALOG)) {
- limit = &intel_limits_g4x_hdmi;
- @@ -531,8 +541,7 @@ intel_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
- * reliably set up different single/dual channel state, if we
- * even can.
- */
- - if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
- - LVDS_CLKB_POWER_UP)
- + if (intel_is_dual_channel_mode(crtc))
- clock.p2 = limit->p2.p2_fast;
- else
- clock.p2 = limit->p2.p2_slow;
- @@ -581,7 +590,6 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
- int target, int refclk, intel_clock_t *best_clock)
- {
- struct drm_device *dev = crtc->dev;
- - struct drm_i915_private *dev_priv = dev->dev_private;
- intel_clock_t clock;
- int max_n;
- bool found;
- @@ -596,8 +604,7 @@ intel_g4x_find_best_PLL(const intel_limit_t *limit, struct drm_crtc *crtc,
- lvds_reg = PCH_LVDS;
- else
- lvds_reg = LVDS;
- - if ((I915_READ(lvds_reg) & LVDS_CLKB_POWER_MASK) ==
- - LVDS_CLKB_POWER_UP)
- + if (intel_is_dual_channel_mode(crtc))
- clock.p2 = limit->p2.p2_fast;
- else
- clock.p2 = limit->p2.p2_slow;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement