Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318570
b: refs/heads/master
c: 24ded20
h: refs/heads/master
v: v3
  • Loading branch information
Daniel Vetter committed Jun 12, 2012
1 parent a915a9c commit ad503a3
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7cf4160148136deb31ee5f2802857dd935a38529
refs/heads/master: 24ded204429fa0f5501d37c63ee35c555c0b75ee
3 changes: 2 additions & 1 deletion trunk/drivers/gpu/drm/i915/intel_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,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);
Expand Down
32 changes: 6 additions & 26 deletions trunk/drivers/gpu/drm/i915/intel_lvds.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1074,35 +1075,14 @@ bool intel_lvds_init(struct drm_device *dev)
goto failed;

out:
/*
* Unlock registers and just
* leave them unlocked
*/
if (HAS_PCH_SPLIT(dev)) {
u32 pwm;

pipe = (I915_READ(PCH_LVDS) & LVDS_PIPEB_SELECT) ? 1 : 0;

/* make sure PWM is enabled and locked to the LVDS pipe */
pwm = I915_READ(BLC_PWM_CPU_CTL2);
if (pipe == 0 && (pwm & BLM_PIPE_B))
I915_WRITE(BLC_PWM_CPU_CTL2, pwm & ~BLM_PWM_ENABLE);
if (pipe)
pwm |= BLM_PIPE_B;
else
pwm &= ~BLM_PIPE_B;
I915_WRITE(BLC_PWM_CPU_CTL2, pwm | BLM_PWM_ENABLE);

pwm = I915_READ(BLC_PWM_PCH_CTL1);
pwm |= BLM_PCH_PWM_ENABLE;
I915_WRITE(BLC_PWM_PCH_CTL1, pwm);
/*
* Unlock registers and just
* leave them unlocked
*/
I915_WRITE(PCH_PP_CONTROL,
I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS);
} else {
/*
* Unlock registers and just
* leave them unlocked
*/
I915_WRITE(PP_CONTROL,
I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS);
}
Expand Down
38 changes: 37 additions & 1 deletion trunk/drivers/gpu/drm/i915/intel_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,18 @@ void intel_panel_disable_backlight(struct drm_device *dev)

dev_priv->backlight_enabled = false;
intel_panel_actually_set_backlight(dev, 0);

if (INTEL_INFO(dev)->gen >= 4) {
uint32_t reg;

reg = HAS_PCH_SPLIT(dev) ? BLC_PWM_CPU_CTL2 : BLC_PWM_CTL2;

I915_WRITE(reg, I915_READ(reg) & ~BLM_PWM_ENABLE);
}
}

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;

Expand All @@ -298,6 +307,33 @@ void intel_panel_enable_backlight(struct drm_device *dev)

dev_priv->backlight_enabled = true;
intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);

if (INTEL_INFO(dev)->gen >= 4) {
uint32_t reg, tmp;

reg = HAS_PCH_SPLIT(dev) ? BLC_PWM_CPU_CTL2 : BLC_PWM_CTL2;


tmp = I915_READ(reg);

/* Note that this can also get called through dpms changes. And
* we don't track the backlight dpms state, hence check whether
* we have to do anything first. */
if (tmp & BLM_PWM_ENABLE)
return;

if (dev_priv->num_pipe == 3)
tmp &= ~BLM_PIPE_SELECT_IVB;
else
tmp &= ~BLM_PIPE_SELECT;

tmp |= BLM_PIPE(pipe);
tmp &= ~BLM_PWM_ENABLE;

I915_WRITE(reg, tmp);
POSTING_READ(reg);
I915_WRITE(reg, tmp | BLM_PWM_ENABLE);
}
}

static void intel_panel_init_backlight(struct drm_device *dev)
Expand Down

0 comments on commit ad503a3

Please sign in to comment.