Subversion Repositories Kolibri OS

Rev

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

Rev 6103 Rev 6937
Line 72... Line 72...
72
	u8 slave_addr;
72
	u8 slave_addr;
Line 73... Line 73...
73
 
73
 
Line 74... Line 74...
74
	struct i2c_adapter ddc;
74
	struct i2c_adapter ddc;
75
 
75
 
Line 76... Line 76...
76
	/* Register for the SDVO device: SDVOB or SDVOC */
76
	/* Register for the SDVO device: SDVOB or SDVOC */
77
	uint32_t sdvo_reg;
77
	i915_reg_t sdvo_reg;
Line 78... Line 78...
78
 
78
 
Line 118... Line 118...
118
	 * to decide this for us, the S-Video output on our HDMI+S-Video card
118
	 * to decide this for us, the S-Video output on our HDMI+S-Video card
119
	 * shows up as RGB1 (VGA).
119
	 * shows up as RGB1 (VGA).
120
	 */
120
	 */
121
	bool is_tv;
121
	bool is_tv;
Line 122... Line -...
122
 
-
 
123
	/* On different gens SDVOB is at different places. */
122
 
Line 124... Line 123...
124
	bool is_sdvob;
123
	enum port port;
125
 
124
 
Line 126... Line 125...
126
	/* This is for current tv format name */
125
	/* This is for current tv format name */
Line 243... Line 242...
243
	struct drm_device *dev = intel_sdvo->base.base.dev;
242
	struct drm_device *dev = intel_sdvo->base.base.dev;
244
	struct drm_i915_private *dev_priv = dev->dev_private;
243
	struct drm_i915_private *dev_priv = dev->dev_private;
245
	u32 bval = val, cval = val;
244
	u32 bval = val, cval = val;
246
	int i;
245
	int i;
Line 247... Line 246...
247
 
246
 
248
	if (intel_sdvo->sdvo_reg == PCH_SDVOB) {
247
	if (HAS_PCH_SPLIT(dev_priv)) {
249
		I915_WRITE(intel_sdvo->sdvo_reg, val);
248
		I915_WRITE(intel_sdvo->sdvo_reg, val);
250
		POSTING_READ(intel_sdvo->sdvo_reg);
249
		POSTING_READ(intel_sdvo->sdvo_reg);
251
		/*
250
		/*
252
		 * HW workaround, need to write this twice for issue
251
		 * HW workaround, need to write this twice for issue
Line 257... Line 256...
257
			POSTING_READ(intel_sdvo->sdvo_reg);
256
			POSTING_READ(intel_sdvo->sdvo_reg);
258
		}
257
		}
259
		return;
258
		return;
260
	}
259
	}
Line 261... Line 260...
261
 
260
 
262
	if (intel_sdvo->sdvo_reg == GEN3_SDVOB)
261
	if (intel_sdvo->port == PORT_B)
263
		cval = I915_READ(GEN3_SDVOC);
262
		cval = I915_READ(GEN3_SDVOC);
264
	else
263
	else
Line 265... Line 264...
265
		bval = I915_READ(GEN3_SDVOB);
264
		bval = I915_READ(GEN3_SDVOB);
Line 420... Line 419...
420
	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_TXRATE),
419
	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_TXRATE),
421
	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_DATA),
420
	SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_DATA),
422
	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_DATA),
421
	SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_DATA),
423
};
422
};
Line 424... Line 423...
424
 
423
 
Line 425... Line 424...
425
#define SDVO_NAME(svdo) ((svdo)->is_sdvob ? "SDVOB" : "SDVOC")
424
#define SDVO_NAME(svdo) ((svdo)->port == PORT_B ? "SDVOB" : "SDVOC")
426
 
425
 
427
static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
426
static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
428
				   const void *args, int args_len)
427
				   const void *args, int args_len)
Line 1280... Line 1279...
1280
			sdvox |= HDMI_COLOR_RANGE_16_235;
1279
			sdvox |= HDMI_COLOR_RANGE_16_235;
1281
		if (INTEL_INFO(dev)->gen < 5)
1280
		if (INTEL_INFO(dev)->gen < 5)
1282
			sdvox |= SDVO_BORDER_ENABLE;
1281
			sdvox |= SDVO_BORDER_ENABLE;
1283
	} else {
1282
	} else {
1284
		sdvox = I915_READ(intel_sdvo->sdvo_reg);
1283
		sdvox = I915_READ(intel_sdvo->sdvo_reg);
1285
		switch (intel_sdvo->sdvo_reg) {
1284
		if (intel_sdvo->port == PORT_B)
1286
		case GEN3_SDVOB:
-
 
1287
			sdvox &= SDVOB_PRESERVE_MASK;
1285
			sdvox &= SDVOB_PRESERVE_MASK;
1288
			break;
1286
		else
1289
		case GEN3_SDVOC:
-
 
1290
			sdvox &= SDVOC_PRESERVE_MASK;
1287
			sdvox &= SDVOC_PRESERVE_MASK;
1291
			break;
-
 
1292
		}
-
 
1293
		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
1288
		sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
1294
	}
1289
	}
Line 1295... Line 1290...
1295
 
1290
 
1296
	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
1291
	if (INTEL_PCH_TYPE(dev) >= PCH_CPT)
Line 1462... Line 1457...
1462
	 * HW workaround for IBX, we need to move the port
1457
	 * HW workaround for IBX, we need to move the port
1463
	 * to transcoder A after disabling it to allow the
1458
	 * to transcoder A after disabling it to allow the
1464
	 * matching DP port to be enabled on transcoder A.
1459
	 * matching DP port to be enabled on transcoder A.
1465
	 */
1460
	 */
1466
	if (HAS_PCH_IBX(dev_priv) && crtc->pipe == PIPE_B) {
1461
	if (HAS_PCH_IBX(dev_priv) && crtc->pipe == PIPE_B) {
-
 
1462
		/*
-
 
1463
		 * We get CPU/PCH FIFO underruns on the other pipe when
-
 
1464
		 * doing the workaround. Sweep them under the rug.
-
 
1465
		 */
-
 
1466
		intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, false);
-
 
1467
		intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, false);
-
 
1468
 
1467
		temp &= ~SDVO_PIPE_B_SELECT;
1469
		temp &= ~SDVO_PIPE_B_SELECT;
1468
		temp |= SDVO_ENABLE;
1470
		temp |= SDVO_ENABLE;
1469
		intel_sdvo_write_sdvox(intel_sdvo, temp);
1471
		intel_sdvo_write_sdvox(intel_sdvo, temp);
Line 1470... Line 1472...
1470
 
1472
 
1471
		temp &= ~SDVO_ENABLE;
1473
		temp &= ~SDVO_ENABLE;
-
 
1474
		intel_sdvo_write_sdvox(intel_sdvo, temp);
-
 
1475
 
-
 
1476
		intel_wait_for_vblank_if_active(dev_priv->dev, PIPE_A);
-
 
1477
		intel_set_cpu_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1472
		intel_sdvo_write_sdvox(intel_sdvo, temp);
1478
		intel_set_pch_fifo_underrun_reporting(dev_priv, PIPE_A, true);
1473
	}
1479
	}
Line 1474... Line 1480...
1474
}
1480
}
1475
 
1481
 
Line 2249... Line 2255...
2249
intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv,
2255
intel_sdvo_select_ddc_bus(struct drm_i915_private *dev_priv,
2250
			  struct intel_sdvo *sdvo)
2256
			  struct intel_sdvo *sdvo)
2251
{
2257
{
2252
	struct sdvo_device_mapping *mapping;
2258
	struct sdvo_device_mapping *mapping;
Line 2253... Line 2259...
2253
 
2259
 
2254
	if (sdvo->is_sdvob)
2260
	if (sdvo->port == PORT_B)
2255
		mapping = &(dev_priv->sdvo_mappings[0]);
2261
		mapping = &(dev_priv->sdvo_mappings[0]);
2256
	else
2262
	else
Line 2257... Line 2263...
2257
		mapping = &(dev_priv->sdvo_mappings[1]);
2263
		mapping = &(dev_priv->sdvo_mappings[1]);
Line 2267... Line 2273...
2267
			  struct intel_sdvo *sdvo)
2273
			  struct intel_sdvo *sdvo)
2268
{
2274
{
2269
	struct sdvo_device_mapping *mapping;
2275
	struct sdvo_device_mapping *mapping;
2270
	u8 pin;
2276
	u8 pin;
Line 2271... Line 2277...
2271
 
2277
 
2272
	if (sdvo->is_sdvob)
2278
	if (sdvo->port == PORT_B)
2273
		mapping = &dev_priv->sdvo_mappings[0];
2279
		mapping = &dev_priv->sdvo_mappings[0];
2274
	else
2280
	else
Line 2275... Line 2281...
2275
		mapping = &dev_priv->sdvo_mappings[1];
2281
		mapping = &dev_priv->sdvo_mappings[1];
Line 2305... Line 2311...
2305
intel_sdvo_get_slave_addr(struct drm_device *dev, struct intel_sdvo *sdvo)
2311
intel_sdvo_get_slave_addr(struct drm_device *dev, struct intel_sdvo *sdvo)
2306
{
2312
{
2307
	struct drm_i915_private *dev_priv = dev->dev_private;
2313
	struct drm_i915_private *dev_priv = dev->dev_private;
2308
	struct sdvo_device_mapping *my_mapping, *other_mapping;
2314
	struct sdvo_device_mapping *my_mapping, *other_mapping;
Line 2309... Line 2315...
2309
 
2315
 
2310
	if (sdvo->is_sdvob) {
2316
	if (sdvo->port == PORT_B) {
2311
		my_mapping = &dev_priv->sdvo_mappings[0];
2317
		my_mapping = &dev_priv->sdvo_mappings[0];
2312
		other_mapping = &dev_priv->sdvo_mappings[1];
2318
		other_mapping = &dev_priv->sdvo_mappings[1];
2313
	} else {
2319
	} else {
2314
		my_mapping = &dev_priv->sdvo_mappings[1];
2320
		my_mapping = &dev_priv->sdvo_mappings[1];
Line 2330... Line 2336...
2330
	}
2336
	}
Line 2331... Line 2337...
2331
 
2337
 
2332
	/* No SDVO device info is found for another DVO port,
2338
	/* No SDVO device info is found for another DVO port,
2333
	 * so use mapping assumption we had before BIOS parsing.
2339
	 * so use mapping assumption we had before BIOS parsing.
2334
	 */
2340
	 */
2335
	if (sdvo->is_sdvob)
2341
	if (sdvo->port == PORT_B)
2336
		return 0x70;
2342
		return 0x70;
2337
	else
2343
	else
2338
		return 0x72;
2344
		return 0x72;
Line 2937... Line 2943...
2937
	sdvo->ddc.algo = &intel_sdvo_ddc_proxy;
2943
	sdvo->ddc.algo = &intel_sdvo_ddc_proxy;
Line 2938... Line 2944...
2938
 
2944
 
2939
	return i2c_add_adapter(&sdvo->ddc) == 0;
2945
	return i2c_add_adapter(&sdvo->ddc) == 0;
Line -... Line 2946...
-
 
2946
}
-
 
2947
 
-
 
2948
static void assert_sdvo_port_valid(const struct drm_i915_private *dev_priv,
-
 
2949
				   enum port port)
-
 
2950
{
-
 
2951
	if (HAS_PCH_SPLIT(dev_priv))
-
 
2952
		WARN_ON(port != PORT_B);
-
 
2953
	else
-
 
2954
		WARN_ON(port != PORT_B && port != PORT_C);
2940
}
2955
}
-
 
2956
 
2941
 
2957
bool intel_sdvo_init(struct drm_device *dev,
2942
bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2958
		     i915_reg_t sdvo_reg, enum port port)
2943
{
2959
{
2944
	struct drm_i915_private *dev_priv = dev->dev_private;
2960
	struct drm_i915_private *dev_priv = dev->dev_private;
2945
	struct intel_encoder *intel_encoder;
2961
	struct intel_encoder *intel_encoder;
-
 
2962
	struct intel_sdvo *intel_sdvo;
-
 
2963
	int i;
-
 
2964
 
2946
	struct intel_sdvo *intel_sdvo;
2965
	assert_sdvo_port_valid(dev_priv, port);
2947
	int i;
2966
 
2948
	intel_sdvo = kzalloc(sizeof(*intel_sdvo), GFP_KERNEL);
2967
	intel_sdvo = kzalloc(sizeof(*intel_sdvo), GFP_KERNEL);
Line 2949... Line 2968...
2949
	if (!intel_sdvo)
2968
	if (!intel_sdvo)
2950
		return false;
2969
		return false;
2951
 
2970
 
2952
	intel_sdvo->sdvo_reg = sdvo_reg;
2971
	intel_sdvo->sdvo_reg = sdvo_reg;
2953
	intel_sdvo->is_sdvob = is_sdvob;
2972
	intel_sdvo->port = port;
2954
	intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(dev, intel_sdvo) >> 1;
2973
	intel_sdvo->slave_addr = intel_sdvo_get_slave_addr(dev, intel_sdvo) >> 1;
Line 2955... Line 2974...
2955
	intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo);
2974
	intel_sdvo_select_i2c_bus(dev_priv, intel_sdvo);
2956
	if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev))
2975
	if (!intel_sdvo_init_ddc_proxy(intel_sdvo, dev))
2957
		goto err_i2c_bus;
2976
		goto err_i2c_bus;
2958
 
2977
 
-
 
2978
	/* encoder type will be decided later */
Line 2959... Line 2979...
2959
	/* encoder type will be decided later */
2979
	intel_encoder = &intel_sdvo->base;
2960
	intel_encoder = &intel_sdvo->base;
2980
	intel_encoder->type = INTEL_OUTPUT_SDVO;
2961
	intel_encoder->type = INTEL_OUTPUT_SDVO;
2981
	drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0,
Line 2998... Line 3018...
2998
 
3018
 
2999
	/* Only enable the hotplug irq if we need it, to work around noisy
3019
	/* Only enable the hotplug irq if we need it, to work around noisy
3000
	 * hotplug lines.
3020
	 * hotplug lines.
3001
	 */
3021
	 */
-
 
3022
	if (intel_sdvo->hotplug_active) {
3002
	if (intel_sdvo->hotplug_active) {
3023
		if (intel_sdvo->port == PORT_B)
-
 
3024
			intel_encoder->hpd_pin = HPD_SDVO_B;
3003
		intel_encoder->hpd_pin =
3025
		else
3004
			intel_sdvo->is_sdvob ?  HPD_SDVO_B : HPD_SDVO_C;
3026
			intel_encoder->hpd_pin = HPD_SDVO_C;
Line 3005... Line 3027...
3005
	}
3027
	}
3006
 
3028
 
3007
	/*
3029
	/*