aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/gma500/cdv_intel_crt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/gma500/cdv_intel_crt.c')
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_crt.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index a71a6cd95bdd..187422018601 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -67,8 +67,6 @@ static void cdv_intel_crt_dpms(struct drm_encoder *encoder, int mode)
67static int cdv_intel_crt_mode_valid(struct drm_connector *connector, 67static int cdv_intel_crt_mode_valid(struct drm_connector *connector,
68 struct drm_display_mode *mode) 68 struct drm_display_mode *mode)
69{ 69{
70 struct drm_psb_private *dev_priv = connector->dev->dev_private;
71 int max_clock = 0;
72 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 70 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
73 return MODE_NO_DBLESCAN; 71 return MODE_NO_DBLESCAN;
74 72
@@ -77,18 +75,9 @@ static int cdv_intel_crt_mode_valid(struct drm_connector *connector,
77 return MODE_CLOCK_LOW; 75 return MODE_CLOCK_LOW;
78 76
79 /* The max clock for CDV is 355 instead of 400 */ 77 /* The max clock for CDV is 355 instead of 400 */
80 max_clock = 355000; 78 if (mode->clock > 355000)
81 if (mode->clock > max_clock)
82 return MODE_CLOCK_HIGH; 79 return MODE_CLOCK_HIGH;
83 80
84 if (mode->hdisplay > 1680 || mode->vdisplay > 1050)
85 return MODE_PANEL;
86
87 /* We assume worst case scenario of 32 bpp here, since we don't know */
88 if ((ALIGN(mode->hdisplay * 4, 64) * mode->vdisplay) >
89 dev_priv->vram_stolen_size)
90 return MODE_MEM;
91
92 return MODE_OK; 81 return MODE_OK;
93} 82}
94 83
@@ -156,13 +145,7 @@ static bool cdv_intel_crt_detect_hotplug(struct drm_connector *connector,
156 struct drm_device *dev = connector->dev; 145 struct drm_device *dev = connector->dev;
157 u32 hotplug_en; 146 u32 hotplug_en;
158 int i, tries = 0, ret = false; 147 int i, tries = 0, ret = false;
159 u32 adpa_orig; 148 u32 orig;
160
161 /* disable the DAC when doing the hotplug detection */
162
163 adpa_orig = REG_READ(ADPA);
164
165 REG_WRITE(ADPA, adpa_orig & ~(ADPA_DAC_ENABLE));
166 149
167 /* 150 /*
168 * On a CDV thep, CRT detect sequence need to be done twice 151 * On a CDV thep, CRT detect sequence need to be done twice
@@ -170,7 +153,7 @@ static bool cdv_intel_crt_detect_hotplug(struct drm_connector *connector,
170 */ 153 */
171 tries = 2; 154 tries = 2;
172 155
173 hotplug_en = REG_READ(PORT_HOTPLUG_EN); 156 orig = hotplug_en = REG_READ(PORT_HOTPLUG_EN);
174 hotplug_en &= ~(CRT_HOTPLUG_DETECT_MASK); 157 hotplug_en &= ~(CRT_HOTPLUG_DETECT_MASK);
175 hotplug_en |= CRT_HOTPLUG_FORCE_DETECT; 158 hotplug_en |= CRT_HOTPLUG_FORCE_DETECT;
176 159
@@ -195,8 +178,11 @@ static bool cdv_intel_crt_detect_hotplug(struct drm_connector *connector,
195 CRT_HOTPLUG_MONITOR_NONE) 178 CRT_HOTPLUG_MONITOR_NONE)
196 ret = true; 179 ret = true;
197 180
198 /* Restore the saved ADPA */ 181 /* clear the interrupt we just generated, if any */
199 REG_WRITE(ADPA, adpa_orig); 182 REG_WRITE(PORT_HOTPLUG_STAT, CRT_HOTPLUG_INT_STATUS);
183
184 /* and put the bits back */
185 REG_WRITE(PORT_HOTPLUG_EN, orig);
200 return ret; 186 return ret;
201} 187}
202 188