Subversion Repositories Kolibri OS

Rev

Rev 3482 | Rev 4560 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3482 Rev 3746
Line 244... Line 244...
244
		I915_WRITE(intel_sdvo->sdvo_reg, val);
244
		I915_WRITE(intel_sdvo->sdvo_reg, val);
245
		I915_READ(intel_sdvo->sdvo_reg);
245
		I915_READ(intel_sdvo->sdvo_reg);
246
		return;
246
		return;
247
	}
247
	}
Line 248... Line 248...
248
 
248
 
249
	if (intel_sdvo->sdvo_reg == SDVOB) {
249
	if (intel_sdvo->sdvo_reg == GEN3_SDVOB)
250
		cval = I915_READ(SDVOC);
250
		cval = I915_READ(GEN3_SDVOC);
251
	} else {
251
	else
252
		bval = I915_READ(SDVOB);
252
		bval = I915_READ(GEN3_SDVOB);
253
	}
253
 
254
	/*
254
	/*
255
	 * Write the registers twice for luck. Sometimes,
255
	 * Write the registers twice for luck. Sometimes,
256
	 * writing them only once doesn't appear to 'stick'.
256
	 * writing them only once doesn't appear to 'stick'.
257
	 * The BIOS does this too. Yay, magic
257
	 * The BIOS does this too. Yay, magic
258
	 */
258
	 */
259
	for (i = 0; i < 2; i++)
259
	for (i = 0; i < 2; i++)
260
	{
260
	{
261
		I915_WRITE(SDVOB, bval);
261
		I915_WRITE(GEN3_SDVOB, bval);
262
		I915_READ(SDVOB);
262
		I915_READ(GEN3_SDVOB);
263
		I915_WRITE(SDVOC, cval);
263
		I915_WRITE(GEN3_SDVOC, cval);
264
		I915_READ(SDVOC);
264
		I915_READ(GEN3_SDVOC);
265
	}
265
	}
Line 266... Line 266...
266
}
266
}
267
 
267
 
Line 449... Line 449...
449
	u8 *buf, status;
449
	u8 *buf, status;
450
	struct i2c_msg *msgs;
450
	struct i2c_msg *msgs;
451
	int i, ret = true;
451
	int i, ret = true;
Line 452... Line 452...
452
 
452
 
453
        /* Would be simpler to allocate both in one go ? */        
453
        /* Would be simpler to allocate both in one go ? */        
454
	buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL);
454
	buf = kzalloc(args_len * 2 + 2, GFP_KERNEL);
455
	if (!buf)
455
	if (!buf)
Line 456... Line 456...
456
		return false;
456
		return false;
457
 
457
 
Line 786... Line 786...
786
 
786
 
787
	h_sync_offset = mode->hsync_start - mode->hdisplay;
787
	h_sync_offset = mode->hsync_start - mode->hdisplay;
Line 788... Line 788...
788
	v_sync_offset = mode->vsync_start - mode->vdisplay;
788
	v_sync_offset = mode->vsync_start - mode->vdisplay;
789
 
-
 
790
	mode_clock = mode->clock;
789
 
791
	mode_clock /= intel_mode_get_pixel_multiplier(mode) ?: 1;
790
	mode_clock = mode->clock;
Line 792... Line 791...
792
	mode_clock /= 10;
791
	mode_clock /= 10;
793
	dtd->part1.clock = mode_clock;
792
	dtd->part1.clock = mode_clock;
Line 955... Line 954...
955
		.type = DIP_TYPE_AVI,
954
		.type = DIP_TYPE_AVI,
956
		.ver = DIP_VERSION_AVI,
955
		.ver = DIP_VERSION_AVI,
957
		.len = DIP_LEN_AVI,
956
		.len = DIP_LEN_AVI,
958
	};
957
	};
959
	uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];
958
	uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];
-
 
959
	struct intel_crtc *intel_crtc = to_intel_crtc(intel_sdvo->base.base.crtc);
Line 960... Line 960...
960
 
960
 
961
	if (intel_sdvo->rgb_quant_range_selectable) {
961
	if (intel_sdvo->rgb_quant_range_selectable) {
962
		if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE)
962
		if (intel_crtc->config.limited_color_range)
963
			avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_LIMITED;
963
			avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_LIMITED;
964
		else
964
		else
965
			avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_FULL;
965
			avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_FULL;
Line -... Line 966...
-
 
966
	}
-
 
967
 
966
	}
968
	avi_if.body.avi.VIC = drm_match_cea_mode(adjusted_mode);
Line 967... Line 969...
967
 
969
 
968
	intel_dip_infoframe_csum(&avi_if);
970
	intel_dip_infoframe_csum(&avi_if);
969
 
971
 
Line 1037... Line 1039...
1037
	intel_sdvo->dtd_sdvo_flags = input_dtd.part2.sdvo_flags;
1039
	intel_sdvo->dtd_sdvo_flags = input_dtd.part2.sdvo_flags;
Line 1038... Line 1040...
1038
 
1040
 
1039
	return true;
1041
	return true;
Line 1040... Line 1042...
1040
}
1042
}
1041
 
-
 
1042
static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder,
1043
 
1043
				  const struct drm_display_mode *mode,
1044
static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
1044
				  struct drm_display_mode *adjusted_mode)
1045
				      struct intel_crtc_config *pipe_config)
-
 
1046
{
-
 
1047
	struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base);
-
 
1048
	struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;
-
 
1049
	struct drm_display_mode *mode = &pipe_config->requested_mode;
1045
{
1050
 
-
 
1051
	DRM_DEBUG_KMS("forcing bpc to 8 for SDVO\n");
-
 
1052
	pipe_config->pipe_bpp = 8*3;
-
 
1053
 
Line 1046... Line 1054...
1046
	struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder);
1054
	if (HAS_PCH_SPLIT(encoder->base.dev))
1047
	int multiplier;
1055
		pipe_config->has_pch_encoder = true;
1048
 
1056
 
1049
	/* We need to construct preferred input timings based on our
1057
	/* We need to construct preferred input timings based on our
Line 1069... Line 1077...
1069
	}
1077
	}
Line 1070... Line 1078...
1070
 
1078
 
1071
	/* Make the CRTC code factor in the SDVO pixel multiplier.  The
1079
	/* Make the CRTC code factor in the SDVO pixel multiplier.  The
1072
	 * SDVO device will factor out the multiplier during mode_set.
1080
	 * SDVO device will factor out the multiplier during mode_set.
-
 
1081
	 */
1073
	 */
1082
	pipe_config->pixel_multiplier =
1074
	multiplier = intel_sdvo_get_pixel_multiplier(adjusted_mode);
1083
		intel_sdvo_get_pixel_multiplier(adjusted_mode);
Line 1075... Line 1084...
1075
	intel_mode_set_pixel_multiplier(adjusted_mode, multiplier);
1084
	adjusted_mode->clock *= pipe_config->pixel_multiplier;
1076
 
1085
 
-
 
1086
	if (intel_sdvo->color_range_auto) {
-
 
1087
		/* See CEA-861-E - 5.1 Default Encoding Parameters */
1077
	if (intel_sdvo->color_range_auto) {
1088
		/* FIXME: This bit is only valid when using TMDS encoding and 8
1078
		/* See CEA-861-E - 5.1 Default Encoding Parameters */
1089
		 * bit per color mode. */
1079
		if (intel_sdvo->has_hdmi_monitor &&
1090
		if (intel_sdvo->has_hdmi_monitor &&
1080
		    drm_match_cea_mode(adjusted_mode) > 1)
1091
		    drm_match_cea_mode(adjusted_mode) > 1)
1081
			intel_sdvo->color_range = SDVO_COLOR_RANGE_16_235;
1092
			intel_sdvo->color_range = HDMI_COLOR_RANGE_16_235;
1082
		else
1093
		else
Line 1083... Line 1094...
1083
			intel_sdvo->color_range = 0;
1094
			intel_sdvo->color_range = 0;
1084
	}
1095
	}
Line 1085... Line 1096...
1085
 
1096
 
1086
	if (intel_sdvo->color_range)
1097
	if (intel_sdvo->color_range)
Line 1087... Line 1098...
1087
		adjusted_mode->private_flags |= INTEL_MODE_LIMITED_COLOR_RANGE;
1098
		pipe_config->limited_color_range = true;
1088
 
-
 
1089
	return true;
-
 
1090
}
1099
 
1091
 
1100
	return true;
1092
static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1101
}
1093
				struct drm_display_mode *mode,
1102
 
1094
				struct drm_display_mode *adjusted_mode)
1103
static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
-
 
1104
{
-
 
1105
	struct drm_device *dev = intel_encoder->base.dev;
-
 
1106
	struct drm_i915_private *dev_priv = dev->dev_private;
1095
{
1107
	struct drm_crtc *crtc = intel_encoder->base.crtc;
1096
	struct drm_device *dev = encoder->dev;
1108
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1097
	struct drm_i915_private *dev_priv = dev->dev_private;
1109
	struct drm_display_mode *adjusted_mode =
1098
	struct drm_crtc *crtc = encoder->crtc;
1110
		&intel_crtc->config.adjusted_mode;
1099
	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-
 
1100
	struct intel_sdvo *intel_sdvo = to_intel_sdvo(encoder);
1111
	struct drm_display_mode *mode = &intel_crtc->config.requested_mode;
Line 1101... Line 1112...
1101
	u32 sdvox;
1112
	struct intel_sdvo *intel_sdvo = to_intel_sdvo(&intel_encoder->base);
1102
	struct intel_sdvo_in_out_map in_out;
1113
	u32 sdvox;
Line 1159... Line 1170...
1159
		input_dtd.part2.sdvo_flags = intel_sdvo->dtd_sdvo_flags;
1170
		input_dtd.part2.sdvo_flags = intel_sdvo->dtd_sdvo_flags;
1160
	if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd))
1171
	if (!intel_sdvo_set_input_timing(intel_sdvo, &input_dtd))
1161
		DRM_INFO("Setting input timings on %s failed\n",
1172
		DRM_INFO("Setting input timings on %s failed\n",
1162
			 SDVO_NAME(intel_sdvo));
1173
			 SDVO_NAME(intel_sdvo));
Line 1163... Line 1174...
1163
 
1174
 
1164
	switch (pixel_multiplier) {
1175
	switch (intel_crtc->config.pixel_multiplier) {
1165
	default:
1176
	default:
1166
	case 1: rate = SDVO_CLOCK_RATE_MULT_1X; break;
1177
	case 1: rate = SDVO_CLOCK_RATE_MULT_1X; break;
1167
	case 2: rate = SDVO_CLOCK_RATE_MULT_2X; break;
1178
	case 2: rate = SDVO_CLOCK_RATE_MULT_2X; break;
1168
	case 4: rate = SDVO_CLOCK_RATE_MULT_4X; break;
1179
	case 4: rate = SDVO_CLOCK_RATE_MULT_4X; break;
Line 1180... Line 1191...
1180
		if (INTEL_INFO(dev)->gen < 5)
1191
		if (INTEL_INFO(dev)->gen < 5)
1181
			sdvox |= SDVO_BORDER_ENABLE;
1192
			sdvox |= SDVO_BORDER_ENABLE;
1182
	} else {
1193
	} else {
1183
		sdvox = I915_READ(intel_sdvo->sdvo_reg);
1194
		sdvox = I915_READ(intel_sdvo->sdvo_reg);
1184
		switch (intel_sdvo->sdvo_reg) {
1195
		switch (intel_sdvo->sdvo_reg) {
1185
		case SDVOB:
1196
		case GEN3_SDVOB:
1186
			sdvox &= SDVOB_PRESERVE_MASK;
1197
			sdvox &= SDVOB_PRESERVE_MASK;
1187
			break;
1198
			break;
1188
		case SDVOC:
1199
		case GEN3_SDVOC:
1189
			sdvox &= SDVOC_PRESERVE_MASK;
1200
			sdvox &= SDVOC_PRESERVE_MASK;
1190
			break;
1201
			break;
1191
		}
1202
		}
1192
		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
1203
		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
1193
	}
1204
	}
Line 1194... Line 1205...
1194
 
1205
 
1195
	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
1206
	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
1196
		sdvox |= TRANSCODER_CPT(intel_crtc->pipe);
1207
		sdvox |= SDVO_PIPE_SEL_CPT(intel_crtc->pipe);
1197
	else
1208
	else
Line 1198... Line 1209...
1198
		sdvox |= TRANSCODER(intel_crtc->pipe);
1209
		sdvox |= SDVO_PIPE_SEL(intel_crtc->pipe);
1199
 
1210
 
Line 1200... Line 1211...
1200
	if (intel_sdvo->has_hdmi_audio)
1211
	if (intel_sdvo->has_hdmi_audio)
1201
		sdvox |= SDVO_AUDIO_ENABLE;
1212
		sdvox |= SDVO_AUDIO_ENABLE;
1202
 
1213
 
1203
	if (INTEL_INFO(dev)->gen >= 4) {
1214
	if (INTEL_INFO(dev)->gen >= 4) {
1204
		/* done in crtc_mode_set as the dpll_md reg must be written early */
1215
		/* done in crtc_mode_set as the dpll_md reg must be written early */
-
 
1216
	} else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) {
1205
	} else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) {
1217
		/* done in crtc_mode_set as it lives inside the dpll register */
1206
		/* done in crtc_mode_set as it lives inside the dpll register */
1218
	} else {
Line 1207... Line 1219...
1207
	} else {
1219
		sdvox |= (intel_crtc->config.pixel_multiplier - 1)
1208
		sdvox |= (pixel_multiplier - 1) << SDVO_PORT_MULTIPLY_SHIFT;
1220
			<< SDVO_PORT_MULTIPLY_SHIFT;
1209
	}
1221
	}
Line 1233... Line 1245...
1233
				    enum pipe *pipe)
1245
				    enum pipe *pipe)
1234
{
1246
{
1235
	struct drm_device *dev = encoder->base.dev;
1247
	struct drm_device *dev = encoder->base.dev;
1236
	struct drm_i915_private *dev_priv = dev->dev_private;
1248
	struct drm_i915_private *dev_priv = dev->dev_private;
1237
	struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base);
1249
	struct intel_sdvo *intel_sdvo = to_intel_sdvo(&encoder->base);
-
 
1250
	u16 active_outputs;
1238
	u32 tmp;
1251
	u32 tmp;
Line 1239... Line 1252...
1239
 
1252
 
-
 
1253
	tmp = I915_READ(intel_sdvo->sdvo_reg);
Line 1240... Line 1254...
1240
	tmp = I915_READ(intel_sdvo->sdvo_reg);
1254
	intel_sdvo_get_active_outputs(intel_sdvo, &active_outputs);
1241
 
1255
 
Line 1242... Line 1256...
1242
	if (!(tmp & SDVO_ENABLE))
1256
	if (!(tmp & SDVO_ENABLE) && (active_outputs == 0))
1243
		return false;
1257
		return false;
1244
 
1258
 
Line 1303... Line 1317...
1303
		u8 status;
1317
		u8 status;
Line 1304... Line 1318...
1304
 
1318
 
1305
		temp = I915_READ(intel_sdvo->sdvo_reg);
1319
		temp = I915_READ(intel_sdvo->sdvo_reg);
1306
	if ((temp & SDVO_ENABLE) == 0) {
1320
	if ((temp & SDVO_ENABLE) == 0) {
1307
		/* HW workaround for IBX, we need to move the port
1321
		/* HW workaround for IBX, we need to move the port
1308
		 * to transcoder A before disabling it. */
1322
		 * to transcoder A before disabling it, so restore it here. */
1309
		if (HAS_PCH_IBX(dev)) {
-
 
1310
			struct drm_crtc *crtc = encoder->base.crtc;
-
 
1311
			int pipe = crtc ? to_intel_crtc(crtc)->pipe : -1;
-
 
1312
 
-
 
1313
			/* Restore the transcoder select bit. */
-
 
1314
			if (pipe == PIPE_B)
1323
		if (HAS_PCH_IBX(dev))
1315
				temp |= SDVO_PIPE_B_SELECT;
-
 
Line 1316... Line 1324...
1316
		}
1324
			temp |= SDVO_PIPE_SEL(intel_crtc->pipe);
1317
 
1325
 
1318
			intel_sdvo_write_sdvox(intel_sdvo, temp | SDVO_ENABLE);
1326
			intel_sdvo_write_sdvox(intel_sdvo, temp | SDVO_ENABLE);
1319
	}
1327
	}
Line 1766... Line 1774...
1766
	/*
1774
	/*
1767
	 * Attempt to get the mode list from DDC.
1775
	 * Attempt to get the mode list from DDC.
1768
	 * Assume that the preferred modes are
1776
	 * Assume that the preferred modes are
1769
	 * arranged in priority order.
1777
	 * arranged in priority order.
1770
	 */
1778
	 */
1771
	intel_ddc_get_modes(connector, intel_sdvo->i2c);
1779
	intel_ddc_get_modes(connector, &intel_sdvo->ddc);
1772
	if (list_empty(&connector->probed_modes) == false)
-
 
1773
		goto end;
-
 
Line -... Line 1780...
-
 
1780
 
1774
 
1781
	/*
-
 
1782
	 * Fetch modes from VBT. For SDVO prefer the VBT mode since some
-
 
1783
	 * SDVO->LVDS transcoders can't cope with the EDID mode. Since
-
 
1784
	 * drm_mode_probed_add adds the mode at the head of the list we add it
-
 
1785
	 * last.
1775
	/* Fetch modes from VBT */
1786
	 */
1776
	if (dev_priv->sdvo_lvds_vbt_mode != NULL) {
1787
	if (dev_priv->sdvo_lvds_vbt_mode != NULL) {
1777
		newmode = drm_mode_duplicate(connector->dev,
1788
		newmode = drm_mode_duplicate(connector->dev,
1778
					     dev_priv->sdvo_lvds_vbt_mode);
1789
					     dev_priv->sdvo_lvds_vbt_mode);
1779
		if (newmode != NULL) {
1790
		if (newmode != NULL) {
Line 1782... Line 1793...
1782
					 DRM_MODE_TYPE_DRIVER);
1793
					 DRM_MODE_TYPE_DRIVER);
1783
			drm_mode_probed_add(connector, newmode);
1794
			drm_mode_probed_add(connector, newmode);
1784
		}
1795
		}
1785
	}
1796
	}
Line 1786... Line -...
1786
 
-
 
1787
end:
1797
 
1788
	list_for_each_entry(newmode, &connector->probed_modes, head) {
1798
	list_for_each_entry(newmode, &connector->probed_modes, head) {
1789
		if (newmode->type & DRM_MODE_TYPE_PREFERRED) {
1799
		if (newmode->type & DRM_MODE_TYPE_PREFERRED) {
1790
			intel_sdvo->sdvo_lvds_fixed_mode =
1800
			intel_sdvo->sdvo_lvds_fixed_mode =
Line 1920... Line 1930...
1920
		intel_sdvo->has_hdmi_audio = has_audio;
1930
		intel_sdvo->has_hdmi_audio = has_audio;
1921
		goto done;
1931
		goto done;
1922
	}
1932
	}
Line 1923... Line 1933...
1923
 
1933
 
-
 
1934
	if (property == dev_priv->broadcast_rgb_property) {
-
 
1935
		bool old_auto = intel_sdvo->color_range_auto;
-
 
1936
		uint32_t old_range = intel_sdvo->color_range;
1924
	if (property == dev_priv->broadcast_rgb_property) {
1937
 
1925
		switch (val) {
1938
		switch (val) {
1926
		case INTEL_BROADCAST_RGB_AUTO:
1939
		case INTEL_BROADCAST_RGB_AUTO:
1927
			intel_sdvo->color_range_auto = true;
1940
			intel_sdvo->color_range_auto = true;
1928
			break;
1941
			break;
1929
		case INTEL_BROADCAST_RGB_FULL:
1942
		case INTEL_BROADCAST_RGB_FULL:
1930
			intel_sdvo->color_range_auto = false;
1943
			intel_sdvo->color_range_auto = false;
1931
			intel_sdvo->color_range = 0;
1944
			intel_sdvo->color_range = 0;
1932
			break;
1945
			break;
1933
		case INTEL_BROADCAST_RGB_LIMITED:
1946
		case INTEL_BROADCAST_RGB_LIMITED:
-
 
1947
			intel_sdvo->color_range_auto = false;
-
 
1948
			/* FIXME: this bit is only valid when using TMDS
1934
			intel_sdvo->color_range_auto = false;
1949
			 * encoding and 8 bit per color mode. */
1935
			intel_sdvo->color_range = SDVO_COLOR_RANGE_16_235;
1950
			intel_sdvo->color_range = HDMI_COLOR_RANGE_16_235;
1936
			break;
1951
			break;
1937
		default:
1952
		default:
1938
			return -EINVAL;
1953
			return -EINVAL;
-
 
1954
		}
-
 
1955
 
-
 
1956
		if (old_auto == intel_sdvo->color_range_auto &&
-
 
1957
		    old_range == intel_sdvo->color_range)
-
 
1958
			return 0;
1939
		}
1959
 
1940
		goto done;
1960
		goto done;
Line 1941... Line 1961...
1941
	}
1961
	}
1942
 
1962
 
Line 2038... Line 2058...
2038
 
2058
 
2039
	return 0;
2059
	return 0;
2040
#undef CHECK_PROPERTY
2060
#undef CHECK_PROPERTY
Line 2041... Line -...
2041
}
-
 
2042
 
-
 
2043
static const struct drm_encoder_helper_funcs intel_sdvo_helper_funcs = {
-
 
2044
	.mode_fixup = intel_sdvo_mode_fixup,
-
 
2045
	.mode_set = intel_sdvo_mode_set,
-
 
2046
};
2061
}
2047
 
2062
 
2048
static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
2063
static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
2049
	.dpms = intel_sdvo_dpms,
2064
	.dpms = intel_sdvo_dpms,
2050
	.detect = intel_sdvo_detect,
2065
	.detect = intel_sdvo_detect,
Line 2267... Line 2282...
2267
 
2282
 
2268
	intel_connector = &intel_sdvo_connector->base;
2283
	intel_connector = &intel_sdvo_connector->base;
2269
	connector = &intel_connector->base;
2284
	connector = &intel_connector->base;
2270
	if (intel_sdvo_get_hotplug_support(intel_sdvo) &
2285
	if (intel_sdvo_get_hotplug_support(intel_sdvo) &
2271
		intel_sdvo_connector->output_flag) {
-
 
2272
		connector->polled = DRM_CONNECTOR_POLL_HPD;
2286
		intel_sdvo_connector->output_flag) {
2273
		intel_sdvo->hotplug_active |= intel_sdvo_connector->output_flag;
2287
		intel_sdvo->hotplug_active |= intel_sdvo_connector->output_flag;
2274
		/* Some SDVO devices have one-shot hotplug interrupts.
2288
		/* Some SDVO devices have one-shot hotplug interrupts.
2275
		 * Ensure that they get re-enabled when an interrupt happens.
2289
		 * Ensure that they get re-enabled when an interrupt happens.
2276
		 */
2290
		 */
2277
		intel_encoder->hot_plug = intel_sdvo_enable_hotplug;
2291
		intel_encoder->hot_plug = intel_sdvo_enable_hotplug;
2278
		intel_sdvo_enable_hotplug(intel_encoder);
2292
		intel_sdvo_enable_hotplug(intel_encoder);
2279
	} else {
2293
	} else {
2280
		connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
2294
		intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;
2281
	}
2295
	}
2282
	encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
2296
	encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
Line 2283... Line 2297...
2283
	connector->connector_type = DRM_MODE_CONNECTOR_DVID;
2297
	connector->connector_type = DRM_MODE_CONNECTOR_DVID;
Line 2344... Line 2358...
2344
	if (!intel_sdvo_connector)
2358
	if (!intel_sdvo_connector)
2345
		return false;
2359
		return false;
Line 2346... Line 2360...
2346
 
2360
 
2347
	intel_connector = &intel_sdvo_connector->base;
2361
	intel_connector = &intel_sdvo_connector->base;
2348
	connector = &intel_connector->base;
2362
	connector = &intel_connector->base;
2349
	connector->polled = DRM_CONNECTOR_POLL_CONNECT;
2363
	intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT;
2350
	encoder->encoder_type = DRM_MODE_ENCODER_DAC;
2364
	encoder->encoder_type = DRM_MODE_ENCODER_DAC;
Line 2351... Line 2365...
2351
	connector->connector_type = DRM_MODE_CONNECTOR_VGA;
2365
	connector->connector_type = DRM_MODE_CONNECTOR_VGA;
2352
 
2366
 
Line 2737... Line 2751...
2737
    struct drm_i915_private *dev_priv = dev->dev_private;
2751
    struct drm_i915_private *dev_priv = dev->dev_private;
2738
    struct intel_encoder *intel_encoder;
2752
    struct intel_encoder *intel_encoder;
2739
    struct intel_sdvo *intel_sdvo;
2753
    struct intel_sdvo *intel_sdvo;
2740
	u32 hotplug_mask;
2754
	u32 hotplug_mask;
2741
    int i;
2755
    int i;
2742
 
-
 
2743
    intel_sdvo = kzalloc(sizeof(struct intel_sdvo), GFP_KERNEL);
2756
    intel_sdvo = kzalloc(sizeof(struct intel_sdvo), GFP_KERNEL);
2744
    if (!intel_sdvo)
2757
    if (!intel_sdvo)
2745
        return false;
2758
        return false;
Line 2746... Line 2759...
2746
 
2759
 
Line 2777... Line 2790...
2777
	} else {
2790
	} else {
2778
		hotplug_mask = intel_sdvo->is_sdvob ?
2791
		hotplug_mask = intel_sdvo->is_sdvob ?
2779
			SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915;
2792
			SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915;
2780
	}
2793
	}
Line 2781... Line 2794...
2781
 
2794
 
2782
    drm_encoder_helper_add(&intel_encoder->base, &intel_sdvo_helper_funcs);
-
 
2783
 
2795
	intel_encoder->compute_config = intel_sdvo_compute_config;
-
 
2796
	intel_encoder->disable = intel_disable_sdvo;
2784
	intel_encoder->disable = intel_disable_sdvo;
2797
	intel_encoder->mode_set = intel_sdvo_mode_set;
2785
	intel_encoder->enable = intel_enable_sdvo;
2798
	intel_encoder->enable = intel_enable_sdvo;
Line 2786... Line 2799...
2786
	intel_encoder->get_hw_state = intel_sdvo_get_hw_state;
2799
	intel_encoder->get_hw_state = intel_sdvo_get_hw_state;
2787
 
2800
 
Line 2795... Line 2808...
2795
			      SDVO_NAME(intel_sdvo));
2808
			      SDVO_NAME(intel_sdvo));
2796
		/* Output_setup can leave behind connectors! */
2809
		/* Output_setup can leave behind connectors! */
2797
		goto err_output;
2810
		goto err_output;
2798
    }
2811
    }
Line -... Line 2812...
-
 
2812
 
-
 
2813
	/* Only enable the hotplug irq if we need it, to work around noisy
-
 
2814
	 * hotplug lines.
-
 
2815
	 */
-
 
2816
	if (intel_sdvo->hotplug_active) {
-
 
2817
		intel_encoder->hpd_pin =
-
 
2818
			intel_sdvo->is_sdvob ?  HPD_SDVO_B : HPD_SDVO_C;
-
 
2819
	}
2799
 
2820
 
2800
	/*
2821
	/*
2801
	 * Cloning SDVO with anything is often impossible, since the SDVO
2822
	 * Cloning SDVO with anything is often impossible, since the SDVO
2802
	 * encoder can request a special input timing mode. And even if that's
2823
	 * encoder can request a special input timing mode. And even if that's
2803
	 * not the case we have evidence that cloning a plain unscaled mode with
2824
	 * not the case we have evidence that cloning a plain unscaled mode with
2804
	 * VGA doesn't really work. Furthermore the cloning flags are way too
2825
	 * VGA doesn't really work. Furthermore the cloning flags are way too
2805
	 * simplistic anyway to express such constraints, so just give up on
2826
	 * simplistic anyway to express such constraints, so just give up on
2806
	 * cloning for SDVO encoders.
2827
	 * cloning for SDVO encoders.
2807
	 */
2828
	 */
Line 2808... Line -...
2808
	intel_sdvo->base.cloneable = false;
-
 
2809
 
-
 
2810
	/* Only enable the hotplug irq if we need it, to work around noisy
-
 
2811
	 * hotplug lines.
-
 
2812
	 */
-
 
2813
	if (intel_sdvo->hotplug_active)
-
 
2814
		dev_priv->hotplug_supported_mask |= hotplug_mask;
2829
	intel_sdvo->base.cloneable = false;
Line 2815... Line 2830...
2815
 
2830
 
2816
    intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg);
2831
    intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg);
2817
 
2832