Subversion Repositories Kolibri OS

Rev

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

Rev 6660 Rev 6935
Line 1329... Line 1329...
1329
	kfree(to_intel_connector(connector)->detect_edid);
1329
	kfree(to_intel_connector(connector)->detect_edid);
1330
	to_intel_connector(connector)->detect_edid = NULL;
1330
	to_intel_connector(connector)->detect_edid = NULL;
1331
}
1331
}
Line 1332... Line 1332...
1332
 
1332
 
1333
static bool
1333
static bool
1334
intel_hdmi_set_edid(struct drm_connector *connector, bool force)
1334
intel_hdmi_set_edid(struct drm_connector *connector)
1335
{
1335
{
1336
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
1336
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
1337
	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1337
	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1338
	struct edid *edid = NULL;
1338
	struct edid *edid;
Line 1339... Line 1339...
1339
	bool connected = false;
1339
	bool connected = false;
Line 1340... Line -...
1340
 
-
 
1341
	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1340
 
1342
 
1341
	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
1343
	if (force)
1342
 
Line 1344... Line 1343...
1344
		edid = drm_get_edid(connector,
1343
		edid = drm_get_edid(connector,
Line 1369... Line 1368...
1369
 
1368
 
1370
static enum drm_connector_status
1369
static enum drm_connector_status
1371
intel_hdmi_detect(struct drm_connector *connector, bool force)
1370
intel_hdmi_detect(struct drm_connector *connector, bool force)
1372
{
1371
{
1373
	enum drm_connector_status status;
-
 
1374
	struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
1372
	enum drm_connector_status status;
1375
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
-
 
1376
	bool live_status = false;
-
 
Line 1377... Line 1373...
1377
	unsigned int try;
1373
	struct drm_i915_private *dev_priv = to_i915(connector->dev);
1378
 
1374
 
Line 1379... Line 1375...
1379
	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1375
	DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
Line 1380... Line -...
1380
		      connector->base.id, connector->name);
-
 
1381
 
-
 
1382
	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
-
 
1383
 
-
 
1384
	for (try = 0; !live_status && try < 9; try++) {
-
 
1385
		if (try)
-
 
1386
			msleep(10);
-
 
1387
		live_status = intel_digital_port_connected(dev_priv,
-
 
1388
				hdmi_to_dig_port(intel_hdmi));
-
 
1389
	}
-
 
1390
 
-
 
1391
	if (!live_status) {
-
 
1392
		DRM_DEBUG_KMS("HDMI live status down\n");
-
 
1393
		/*
-
 
1394
		 * Live status register is not reliable on all intel platforms.
-
 
1395
		 * So consider live_status only for certain platforms, for
-
 
1396
		 * others, read EDID to determine presence of sink.
-
 
1397
		 */
-
 
1398
		if (INTEL_INFO(dev_priv)->gen < 7 || IS_IVYBRIDGE(dev_priv))
1376
		      connector->base.id, connector->name);
Line 1399... Line 1377...
1399
			live_status = true;
1377
 
1400
	}
1378
	intel_display_power_get(dev_priv, POWER_DOMAIN_GMBUS);
Line 1401... Line 1379...
1401
 
1379
 
1402
	intel_hdmi_unset_edid(connector);
1380
	intel_hdmi_unset_edid(connector);
1403
 
1381
 
Line 1425... Line 1403...
1425
	intel_hdmi_unset_edid(connector);
1403
	intel_hdmi_unset_edid(connector);
Line 1426... Line 1404...
1426
 
1404
 
1427
	if (connector->status != connector_status_connected)
1405
	if (connector->status != connector_status_connected)
Line 1428... Line 1406...
1428
		return;
1406
		return;
1429
 
1407
 
1430
	intel_hdmi_set_edid(connector, true);
1408
	intel_hdmi_set_edid(connector);
Line 1431... Line 1409...
1431
	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
1409
	hdmi_to_dig_port(intel_hdmi)->base.type = INTEL_OUTPUT_HDMI;
1432
}
1410
}
Line 2017... Line 1995...
2017
	intel_hdmi->color_range_auto = true;
1995
	intel_hdmi->color_range_auto = true;
2018
	intel_attach_aspect_ratio_property(connector);
1996
	intel_attach_aspect_ratio_property(connector);
2019
	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
1997
	intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
2020
}
1998
}
Line -... Line 1999...
-
 
1999
 
-
 
2000
static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,
-
 
2001
			     enum port port)
-
 
2002
{
-
 
2003
	const struct ddi_vbt_port_info *info =
-
 
2004
		&dev_priv->vbt.ddi_port_info[port];
-
 
2005
	u8 ddc_pin;
-
 
2006
 
-
 
2007
	if (info->alternate_ddc_pin) {
-
 
2008
		DRM_DEBUG_KMS("Using DDC pin 0x%x for port %c (VBT)\n",
-
 
2009
			      info->alternate_ddc_pin, port_name(port));
-
 
2010
		return info->alternate_ddc_pin;
-
 
2011
	}
-
 
2012
 
-
 
2013
	switch (port) {
-
 
2014
	case PORT_B:
-
 
2015
		if (IS_BROXTON(dev_priv))
-
 
2016
			ddc_pin = GMBUS_PIN_1_BXT;
-
 
2017
		else
-
 
2018
			ddc_pin = GMBUS_PIN_DPB;
-
 
2019
		break;
-
 
2020
	case PORT_C:
-
 
2021
		if (IS_BROXTON(dev_priv))
-
 
2022
			ddc_pin = GMBUS_PIN_2_BXT;
-
 
2023
		else
-
 
2024
			ddc_pin = GMBUS_PIN_DPC;
-
 
2025
		break;
-
 
2026
	case PORT_D:
-
 
2027
		if (IS_CHERRYVIEW(dev_priv))
-
 
2028
			ddc_pin = GMBUS_PIN_DPD_CHV;
-
 
2029
		else
-
 
2030
			ddc_pin = GMBUS_PIN_DPD;
-
 
2031
		break;
-
 
2032
	default:
-
 
2033
		MISSING_CASE(port);
-
 
2034
		ddc_pin = GMBUS_PIN_DPB;
-
 
2035
		break;
-
 
2036
	}
-
 
2037
 
-
 
2038
	DRM_DEBUG_KMS("Using DDC pin 0x%x for port %c (platform default)\n",
-
 
2039
		      ddc_pin, port_name(port));
-
 
2040
 
-
 
2041
	return ddc_pin;
-
 
2042
}
2021
 
2043
 
2022
void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
2044
void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
2023
			       struct intel_connector *intel_connector)
2045
			       struct intel_connector *intel_connector)
2024
{
2046
{
2025
	struct drm_connector *connector = &intel_connector->base;
2047
	struct drm_connector *connector = &intel_connector->base;
2026
	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
2048
	struct intel_hdmi *intel_hdmi = &intel_dig_port->hdmi;
2027
	struct intel_encoder *intel_encoder = &intel_dig_port->base;
2049
	struct intel_encoder *intel_encoder = &intel_dig_port->base;
2028
	struct drm_device *dev = intel_encoder->base.dev;
2050
	struct drm_device *dev = intel_encoder->base.dev;
2029
	struct drm_i915_private *dev_priv = dev->dev_private;
2051
	struct drm_i915_private *dev_priv = dev->dev_private;
2030
	enum port port = intel_dig_port->port;
-
 
Line 2031... Line 2052...
2031
	uint8_t alternate_ddc_pin;
2052
	enum port port = intel_dig_port->port;
2032
 
2053
 
Line 2033... Line 2054...
2033
	DRM_DEBUG_KMS("Adding HDMI connector on port %c\n",
2054
	DRM_DEBUG_KMS("Adding HDMI connector on port %c\n",
Line 2039... Line 2060...
2039
 
2060
 
2040
	connector->interlace_allowed = 1;
2061
	connector->interlace_allowed = 1;
2041
	connector->doublescan_allowed = 0;
2062
	connector->doublescan_allowed = 0;
Line -... Line 2063...
-
 
2063
	connector->stereo_allowed = 1;
-
 
2064
 
2042
	connector->stereo_allowed = 1;
2065
	intel_hdmi->ddc_bus = intel_hdmi_ddc_pin(dev_priv, port);
2043
 
2066
 
2044
	switch (port) {
-
 
2045
	case PORT_B:
-
 
2046
		if (IS_BROXTON(dev_priv))
-
 
2047
			intel_hdmi->ddc_bus = GMBUS_PIN_1_BXT;
-
 
2048
		else
2067
	switch (port) {
2049
			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
2068
	case PORT_B:
2050
		/*
2069
		/*
2051
		 * On BXT A0/A1, sw needs to activate DDIA HPD logic and
2070
		 * On BXT A0/A1, sw needs to activate DDIA HPD logic and
2052
		 * interrupts to check the external panel connection.
2071
		 * interrupts to check the external panel connection.
2053
		 */
2072
		 */
2054
		if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0))
2073
		if (IS_BROXTON(dev_priv) && (INTEL_REVID(dev) < BXT_REVID_B0))
2055
			intel_encoder->hpd_pin = HPD_PORT_A;
2074
			intel_encoder->hpd_pin = HPD_PORT_A;
2056
		else
2075
		else
2057
			intel_encoder->hpd_pin = HPD_PORT_B;
2076
			intel_encoder->hpd_pin = HPD_PORT_B;
2058
		break;
-
 
2059
	case PORT_C:
-
 
2060
		if (IS_BROXTON(dev_priv))
-
 
2061
			intel_hdmi->ddc_bus = GMBUS_PIN_2_BXT;
-
 
2062
		else
2077
		break;
2063
			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
2078
	case PORT_C:
2064
		intel_encoder->hpd_pin = HPD_PORT_C;
2079
		intel_encoder->hpd_pin = HPD_PORT_C;
2065
		break;
-
 
2066
	case PORT_D:
-
 
2067
		if (WARN_ON(IS_BROXTON(dev_priv)))
-
 
2068
			intel_hdmi->ddc_bus = GMBUS_PIN_DISABLED;
-
 
2069
		else if (IS_CHERRYVIEW(dev_priv))
-
 
2070
			intel_hdmi->ddc_bus = GMBUS_PIN_DPD_CHV;
-
 
2071
		else
2080
		break;
2072
			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
2081
	case PORT_D:
2073
		intel_encoder->hpd_pin = HPD_PORT_D;
2082
		intel_encoder->hpd_pin = HPD_PORT_D;
2074
		break;
-
 
2075
	case PORT_E:
-
 
2076
		/* On SKL PORT E doesn't have seperate GMBUS pin
-
 
2077
		 *  We rely on VBT to set a proper alternate GMBUS pin. */
-
 
2078
		alternate_ddc_pin =
-
 
2079
			dev_priv->vbt.ddi_port_info[PORT_E].alternate_ddc_pin;
-
 
2080
		switch (alternate_ddc_pin) {
-
 
2081
		case DDC_PIN_B:
-
 
2082
			intel_hdmi->ddc_bus = GMBUS_PIN_DPB;
-
 
2083
			break;
-
 
2084
		case DDC_PIN_C:
-
 
2085
			intel_hdmi->ddc_bus = GMBUS_PIN_DPC;
-
 
2086
			break;
-
 
2087
		case DDC_PIN_D:
-
 
2088
			intel_hdmi->ddc_bus = GMBUS_PIN_DPD;
-
 
2089
			break;
-
 
2090
		default:
-
 
2091
			MISSING_CASE(alternate_ddc_pin);
2083
		break;
2092
		}
2084
	case PORT_E:
2093
		intel_encoder->hpd_pin = HPD_PORT_E;
-
 
2094
		break;
-
 
2095
	case PORT_A:
-
 
2096
		intel_encoder->hpd_pin = HPD_PORT_A;
2085
		intel_encoder->hpd_pin = HPD_PORT_E;
-
 
2086
		break;
2097
		/* Internal port only for eDP. */
2087
	default:
2098
	default:
2088
		MISSING_CASE(port);
Line 2099... Line 2089...
2099
		BUG();
2089
		return;
2100
	}
2090
	}
2101
 
2091