aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-05 04:07:09 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-06-12 13:25:46 -0400
commit7cf4160148136deb31ee5f2802857dd935a38529 (patch)
treea6b8cc7e267b0e5a08b83fe0432474fc21a6892d /drivers
parent534b5a5341cb7e16a98d44623d8fce9464ebf22c (diff)
drm/i915: clear up backlight #define confusion on gen4+
- Regroup definitions for BLC_PWM_CTL so that they're all together and and ordered according to the bitfields. - Add all missing definitions for BLC_PWM_CTL2. - Use the BLM_ (for backlight modulation) prefix consistently. - Note that combination mode (i.e. also taking the legacy backlight control value from pci config space into account) is gen4 only. - Move the new registers for PCH-split machines up, they're an almost match for the gen4 defitions. Prefix the special PCH-only bits with BLM_PCH_. Also add the pipe C select bit for ivb. - Rip out the second pair of PCH polarity definitions - they're only valid on early (pre-production) ilk silicon. - Adapt the existing code to use the new definitions. This has the nice benefit of killing a magic (1 << 30) left behind be Jesse Barnes. No functional changes in this patch. Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h55
-rw-r--r--drivers/gpu/drm/i915/intel_display.c4
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c12
3 files changed, 43 insertions, 28 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 20244b971fc6..c4b1a2b45bb4 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1807,18 +1807,35 @@
1807#define PFIT_AUTO_RATIOS 0x61238 1807#define PFIT_AUTO_RATIOS 0x61238
1808 1808
1809/* Backlight control */ 1809/* Backlight control */
1810#define BLC_PWM_CTL 0x61254
1811#define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
1812#define BLC_PWM_CTL2 0x61250 /* 965+ only */ 1810#define BLC_PWM_CTL2 0x61250 /* 965+ only */
1813#define BLM_COMBINATION_MODE (1 << 30) 1811#define BLM_PWM_ENABLE (1 << 31)
1812#define BLM_COMBINATION_MODE (1 << 30) /* gen4 only */
1813#define BLM_PIPE_SELECT (1 << 29)
1814#define BLM_PIPE_SELECT_IVB (3 << 29)
1815#define BLM_PIPE_A (0 << 29)
1816#define BLM_PIPE_B (1 << 29)
1817#define BLM_PIPE_C (2 << 29) /* ivb + */
1818#define BLM_PIPE(pipe) ((pipe) << 29)
1819#define BLM_POLARITY_I965 (1 << 28) /* gen4 only */
1820#define BLM_PHASE_IN_INTERUPT_STATUS (1 << 26)
1821#define BLM_PHASE_IN_ENABLE (1 << 25)
1822#define BLM_PHASE_IN_INTERUPT_ENABL (1 << 24)
1823#define BLM_PHASE_IN_TIME_BASE_SHIFT (16)
1824#define BLM_PHASE_IN_TIME_BASE_MASK (0xff << 16)
1825#define BLM_PHASE_IN_COUNT_SHIFT (8)
1826#define BLM_PHASE_IN_COUNT_MASK (0xff << 8)
1827#define BLM_PHASE_IN_INCR_SHIFT (0)
1828#define BLM_PHASE_IN_INCR_MASK (0xff << 0)
1829#define BLC_PWM_CTL 0x61254
1814/* 1830/*
1815 * This is the most significant 15 bits of the number of backlight cycles in a 1831 * This is the most significant 15 bits of the number of backlight cycles in a
1816 * complete cycle of the modulated backlight control. 1832 * complete cycle of the modulated backlight control.
1817 * 1833 *
1818 * The actual value is this field multiplied by two. 1834 * The actual value is this field multiplied by two.
1819 */ 1835 */
1820#define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17) 1836#define BACKLIGHT_MODULATION_FREQ_SHIFT (17)
1821#define BLM_LEGACY_MODE (1 << 16) 1837#define BACKLIGHT_MODULATION_FREQ_MASK (0x7fff << 17)
1838#define BLM_LEGACY_MODE (1 << 16) /* gen2 only */
1822/* 1839/*
1823 * This is the number of cycles out of the backlight modulation cycle for which 1840 * This is the number of cycles out of the backlight modulation cycle for which
1824 * the backlight is on. 1841 * the backlight is on.
@@ -1833,6 +1850,19 @@
1833 1850
1834#define BLC_HIST_CTL 0x61260 1851#define BLC_HIST_CTL 0x61260
1835 1852
1853/* New registers for PCH-split platforms. Safe where new bits show up, the
1854 * register layout machtes with gen4 BLC_PWM_CTL[12]. */
1855#define BLC_PWM_CPU_CTL2 0x48250
1856#define BLC_PWM_CPU_CTL 0x48254
1857
1858/* PCH CTL1 is totally different, all but the below bits are reserved. CTL2 is
1859 * like the normal CTL from gen4 and earlier. Hooray for confusing naming. */
1860#define BLC_PWM_PCH_CTL1 0xc8250
1861#define BLM_PCH_PWM_ENABLE (1 << 30)
1862#define BLM_PCH_OVERRIDE_ENABLE (1 << 30)
1863#define BLM_PCH_POLARITY (1 << 29)
1864#define BLC_PWM_PCH_CTL2 0xc8254
1865
1836/* TV port control */ 1866/* TV port control */
1837#define TV_CTL 0x68000 1867#define TV_CTL 0x68000
1838/** Enables the TV encoder */ 1868/** Enables the TV encoder */
@@ -3840,21 +3870,6 @@
3840#define PCH_LVDS 0xe1180 3870#define PCH_LVDS 0xe1180
3841#define LVDS_DETECTED (1 << 1) 3871#define LVDS_DETECTED (1 << 1)
3842 3872
3843#define BLC_PWM_CPU_CTL2 0x48250
3844#define PWM_ENABLE (1 << 31)
3845#define PWM_PIPE_A (0 << 29)
3846#define PWM_PIPE_B (1 << 29)
3847#define BLC_PWM_CPU_CTL 0x48254
3848
3849#define BLC_PWM_PCH_CTL1 0xc8250
3850#define PWM_PCH_ENABLE (1 << 31)
3851#define PWM_POLARITY_ACTIVE_LOW (1 << 29)
3852#define PWM_POLARITY_ACTIVE_HIGH (0 << 29)
3853#define PWM_POLARITY_ACTIVE_LOW2 (1 << 28)
3854#define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)
3855
3856#define BLC_PWM_PCH_CTL2 0xc8254
3857
3858#define PCH_PP_STATUS 0xc7200 3873#define PCH_PP_STATUS 0xc7200
3859#define PCH_PP_CONTROL 0xc7204 3874#define PCH_PP_CONTROL 0xc7204
3860#define PANEL_UNLOCK_REGS (0xabcd << 16) 3875#define PANEL_UNLOCK_REGS (0xabcd << 16)
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 5e760319c0f2..bad36e0b8045 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6895,9 +6895,9 @@ static void ivb_pch_pwm_override(struct drm_device *dev)
6895 * IVB has CPU eDP backlight regs too, set things up to let the 6895 * IVB has CPU eDP backlight regs too, set things up to let the
6896 * PCH regs control the backlight 6896 * PCH regs control the backlight
6897 */ 6897 */
6898 I915_WRITE(BLC_PWM_CPU_CTL2, PWM_ENABLE); 6898 I915_WRITE(BLC_PWM_CPU_CTL2, BLM_PWM_ENABLE);
6899 I915_WRITE(BLC_PWM_CPU_CTL, 0); 6899 I915_WRITE(BLC_PWM_CPU_CTL, 0);
6900 I915_WRITE(BLC_PWM_PCH_CTL1, PWM_ENABLE | (1<<30)); 6900 I915_WRITE(BLC_PWM_PCH_CTL1, BLM_PCH_PWM_ENABLE | BLM_PCH_OVERRIDE_ENABLE);
6901} 6901}
6902 6902
6903void intel_modeset_init_hw(struct drm_device *dev) 6903void intel_modeset_init_hw(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 08eb04c787e8..a7269e6b4bf7 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1081,16 +1081,16 @@ out:
1081 1081
1082 /* make sure PWM is enabled and locked to the LVDS pipe */ 1082 /* make sure PWM is enabled and locked to the LVDS pipe */
1083 pwm = I915_READ(BLC_PWM_CPU_CTL2); 1083 pwm = I915_READ(BLC_PWM_CPU_CTL2);
1084 if (pipe == 0 && (pwm & PWM_PIPE_B)) 1084 if (pipe == 0 && (pwm & BLM_PIPE_B))
1085 I915_WRITE(BLC_PWM_CPU_CTL2, pwm & ~PWM_ENABLE); 1085 I915_WRITE(BLC_PWM_CPU_CTL2, pwm & ~BLM_PWM_ENABLE);
1086 if (pipe) 1086 if (pipe)
1087 pwm |= PWM_PIPE_B; 1087 pwm |= BLM_PIPE_B;
1088 else 1088 else
1089 pwm &= ~PWM_PIPE_B; 1089 pwm &= ~BLM_PIPE_B;
1090 I915_WRITE(BLC_PWM_CPU_CTL2, pwm | PWM_ENABLE); 1090 I915_WRITE(BLC_PWM_CPU_CTL2, pwm | BLM_PWM_ENABLE);
1091 1091
1092 pwm = I915_READ(BLC_PWM_PCH_CTL1); 1092 pwm = I915_READ(BLC_PWM_PCH_CTL1);
1093 pwm |= PWM_PCH_ENABLE; 1093 pwm |= BLM_PCH_PWM_ENABLE;
1094 I915_WRITE(BLC_PWM_PCH_CTL1, pwm); 1094 I915_WRITE(BLC_PWM_PCH_CTL1, pwm);
1095 /* 1095 /*
1096 * Unlock registers and just 1096 * Unlock registers and just