diff options
author | Eugeni Dodonov <eugeni.dodonov@intel.com> | 2012-05-09 14:37:20 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2012-05-19 16:39:47 -0400 |
commit | 45244b87943b1173353b48854352bb9f4b065867 (patch) | |
tree | 50184c15fb25605c007ed5634c25476afe3d6528 | |
parent | 59c859d6f2e78344945e8a8406a194156176bc4e (diff) |
drm/i915: initialize DDI buffer translations
DDI is introduced starting with Haswell GPU generation. So to simplify its
management in the future, we also add intel_ddi.c to hold all the
DDI-related items.
Buffer translations for DDI links must be initialized prior to enablement.
For FDI and DP, first 9 pairs of values are used to select the connection
parameters. HDMI uses the last pair of values and ignores the first 9
pairs. So we program HDMI values in both cases, which allows HDMI to work
over both FDI and DP-friendly buffers.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/Makefile | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_ddi.c | 107 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 1 |
4 files changed, 111 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile index 8b8bbc70f86b..0ca7f7646ab5 100644 --- a/drivers/gpu/drm/i915/Makefile +++ b/drivers/gpu/drm/i915/Makefile | |||
@@ -19,6 +19,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \ | |||
19 | intel_crt.o \ | 19 | intel_crt.o \ |
20 | intel_lvds.o \ | 20 | intel_lvds.o \ |
21 | intel_bios.o \ | 21 | intel_bios.o \ |
22 | intel_ddi.o \ | ||
22 | intel_dp.o \ | 23 | intel_dp.o \ |
23 | intel_hdmi.o \ | 24 | intel_hdmi.o \ |
24 | intel_sdvo.o \ | 25 | intel_sdvo.o \ |
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c new file mode 100644 index 000000000000..08f210b8dafa --- /dev/null +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | * Copyright © 2012 Intel Corporation | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice (including the next | ||
12 | * paragraph) shall be included in all copies or substantial portions of the | ||
13 | * Software. | ||
14 | * | ||
15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
18 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
20 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
21 | * IN THE SOFTWARE. | ||
22 | * | ||
23 | * Authors: | ||
24 | * Eugeni Dodonov <eugeni.dodonov@intel.com> | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | #include "i915_drv.h" | ||
29 | #include "intel_drv.h" | ||
30 | |||
31 | /* HDMI/DVI modes ignore everything but the last 2 items. So we share | ||
32 | * them for both DP and FDI transports, allowing those ports to | ||
33 | * automatically adapt to HDMI connections as well | ||
34 | */ | ||
35 | static const u32 hsw_ddi_translations_dp[] = { | ||
36 | 0x00FFFFFF, 0x0006000E, /* DP parameters */ | ||
37 | 0x00D75FFF, 0x0005000A, | ||
38 | 0x00C30FFF, 0x00040006, | ||
39 | 0x80AAAFFF, 0x000B0000, | ||
40 | 0x00FFFFFF, 0x0005000A, | ||
41 | 0x00D75FFF, 0x000C0004, | ||
42 | 0x80C30FFF, 0x000B0000, | ||
43 | 0x00FFFFFF, 0x00040006, | ||
44 | 0x80D75FFF, 0x000B0000, | ||
45 | 0x00FFFFFF, 0x00040006 /* HDMI parameters */ | ||
46 | }; | ||
47 | |||
48 | static const u32 hsw_ddi_translations_fdi[] = { | ||
49 | 0x00FFFFFF, 0x0007000E, /* FDI parameters */ | ||
50 | 0x00D75FFF, 0x000F000A, | ||
51 | 0x00C30FFF, 0x00060006, | ||
52 | 0x00AAAFFF, 0x001E0000, | ||
53 | 0x00FFFFFF, 0x000F000A, | ||
54 | 0x00D75FFF, 0x00160004, | ||
55 | 0x00C30FFF, 0x001E0000, | ||
56 | 0x00FFFFFF, 0x00060006, | ||
57 | 0x00D75FFF, 0x001E0000, | ||
58 | 0x00FFFFFF, 0x00040006 /* HDMI parameters */ | ||
59 | }; | ||
60 | |||
61 | /* On Haswell, DDI port buffers must be programmed with correct values | ||
62 | * in advance. The buffer values are different for FDI and DP modes, | ||
63 | * but the HDMI/DVI fields are shared among those. So we program the DDI | ||
64 | * in either FDI or DP modes only, as HDMI connections will work with both | ||
65 | * of those | ||
66 | */ | ||
67 | void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port, bool use_fdi_mode) | ||
68 | { | ||
69 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
70 | u32 reg; | ||
71 | int i; | ||
72 | const u32 *ddi_translations = ((use_fdi_mode) ? | ||
73 | hsw_ddi_translations_fdi : | ||
74 | hsw_ddi_translations_dp); | ||
75 | |||
76 | DRM_DEBUG_DRIVER("Initializing DDI buffers for port %c in %s mode\n", | ||
77 | port_name(port), | ||
78 | use_fdi_mode ? "FDI" : "DP"); | ||
79 | |||
80 | WARN((use_fdi_mode && (port != PORT_E)), | ||
81 | "Programming port %c in FDI mode, this probably will not work.\n", | ||
82 | port_name(port)); | ||
83 | |||
84 | for (i=0, reg=DDI_BUF_TRANS(port); i < ARRAY_SIZE(hsw_ddi_translations_fdi); i++) { | ||
85 | I915_WRITE(reg, ddi_translations[i]); | ||
86 | reg += 4; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | /* Program DDI buffers translations for DP. By default, program ports A-D in DP | ||
91 | * mode and port E for FDI. | ||
92 | */ | ||
93 | void intel_prepare_ddi(struct drm_device *dev) | ||
94 | { | ||
95 | int port; | ||
96 | |||
97 | if (IS_HASWELL(dev)) { | ||
98 | for (port = PORT_A; port < PORT_E; port++) | ||
99 | intel_prepare_ddi_buffers(dev, port, false); | ||
100 | |||
101 | /* DDI E is the suggested one to work in FDI mode, so program is as such by | ||
102 | * default. It will have to be re-programmed in case a digital DP output | ||
103 | * will be detected on it | ||
104 | */ | ||
105 | intel_prepare_ddi_buffers(dev, PORT_E, true); | ||
106 | } | ||
107 | } | ||
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 101c4d458c33..096a1b1eaf46 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -6806,6 +6806,8 @@ void intel_modeset_init(struct drm_device *dev) | |||
6806 | 6806 | ||
6807 | intel_init_pm(dev); | 6807 | intel_init_pm(dev); |
6808 | 6808 | ||
6809 | intel_prepare_ddi(dev); | ||
6810 | |||
6809 | intel_init_display(dev); | 6811 | intel_init_display(dev); |
6810 | 6812 | ||
6811 | if (IS_GEN2(dev)) { | 6813 | if (IS_GEN2(dev)) { |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index e5ee166e2faf..e6ce02b57305 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -446,6 +446,7 @@ extern void intel_init_clock_gating(struct drm_device *dev); | |||
446 | extern void intel_write_eld(struct drm_encoder *encoder, | 446 | extern void intel_write_eld(struct drm_encoder *encoder, |
447 | struct drm_display_mode *mode); | 447 | struct drm_display_mode *mode); |
448 | extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe); | 448 | extern void intel_cpt_verify_modeset(struct drm_device *dev, int pipe); |
449 | extern void intel_prepare_ddi(struct drm_device *dev); | ||
449 | 450 | ||
450 | /* For use by IVB LP watermark workaround in intel_sprite.c */ | 451 | /* For use by IVB LP watermark workaround in intel_sprite.c */ |
451 | extern void intel_update_watermarks(struct drm_device *dev); | 452 | extern void intel_update_watermarks(struct drm_device *dev); |