[PATCH] properly enable the blc controller on the right pipe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 26, 2012 at 07:25:32PM +0200, Daniel Vetter wrote:
> Depending upon how things are set up, this might help. If not, please
> install intel-gpu-tools and grab the output of intel_reg_dumper both
> when booting with nomodeset and when booting with kms.
> 
> Thanks, Daniel

btw, all these stuff is in the public documentation at

http://intellinuxgraphics.org/documentation.html

The backlight stuff is in volume three: display registers.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_drv.h   |    3 ++-
>  drivers/gpu/drm/i915/intel_lvds.c  |    3 ++-
>  drivers/gpu/drm/i915/intel_panel.c |   15 ++++++++++++++-
>  3 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 715afa1..5a021ce 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -323,7 +323,8 @@ extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
>  extern u32 intel_panel_get_backlight(struct drm_device *dev);
>  extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
>  extern int intel_panel_setup_backlight(struct drm_device *dev);
> -extern void intel_panel_enable_backlight(struct drm_device *dev);
> +extern void intel_panel_enable_backlight(struct drm_device *dev,
> +					 enum pipe pipe);
>  extern void intel_panel_disable_backlight(struct drm_device *dev);
>  extern void intel_panel_destroy_backlight(struct drm_device *dev);
>  extern enum drm_connector_status intel_panel_detect(struct drm_device *dev);
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 30e2c82..3e71b86 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -71,6 +71,7 @@ static struct intel_lvds *intel_attached_lvds(struct drm_connector *connector)
>  static void intel_lvds_enable(struct intel_lvds *intel_lvds)
>  {
>  	struct drm_device *dev = intel_lvds->base.base.dev;
> +	struct intel_crtc *intel_crtc = to_intel_crtc(intel_lvds->base.base.crtc);
>  	struct drm_i915_private *dev_priv = dev->dev_private;
>  	u32 ctl_reg, lvds_reg, stat_reg;
>  
> @@ -107,7 +108,7 @@ static void intel_lvds_enable(struct intel_lvds *intel_lvds)
>  	if (wait_for((I915_READ(stat_reg) & PP_ON) != 0, 1000))
>  		DRM_ERROR("timed out waiting for panel to power on\n");
>  
> -	intel_panel_enable_backlight(dev);
> +	intel_panel_enable_backlight(dev, intel_crtc->pipe);
>  }
>  
>  static void intel_lvds_disable(struct intel_lvds *intel_lvds)
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 48177ec..486cf92 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -261,17 +261,30 @@ void intel_panel_disable_backlight(struct drm_device *dev)
>  
>  	dev_priv->backlight_enabled = false;
>  	intel_panel_actually_set_backlight(dev, 0);
> +
> +	/*disable the blc*/
> +	I915_WRITE(BLC_PWM_CTL2,
> +		   I915_READ(BLC_PWM_CTL2) & ~(1<<31));
>  }
>  
> -void intel_panel_enable_backlight(struct drm_device *dev)
> +void intel_panel_enable_backlight(struct drm_device *dev,
> +				  enum pipe pipe)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> +	u32 tmp;
>  
>  	if (dev_priv->backlight_level == 0)
>  		dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
>  
>  	dev_priv->backlight_enabled = true;
>  	intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
> +
> +	/*enable the blc on the right pipe*/
> +	tmp = I915_READ(BLC_PWM_CTL2);
> +	tmp &= ~(1<<29); /* pipe select */
> +	tmp |= pipe == PIPE_A ? 0 : 1;
> +	I915_WRITE(BLC_PWM_CTL2,
> +		   I915_READ(BLC_PWM_CTL2) & ~(1<<31));
>  }
>  
>  static void intel_panel_init_backlight(struct drm_device *dev)
> -- 
> 1.7.10
> 

-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux