aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2010-03-29 09:22:55 -0400
committerEric Anholt <eric@anholt.net>2010-04-12 12:23:53 -0400
commitd2a82a6f1b5b1b90154c410674a889c9133ed029 (patch)
tree679afae16a1d030fa3baca88330212923d60fc06 /drivers/gpu/drm/i915
parent599be16c6ef70f349edaef43a0ee2712c1af7328 (diff)
drm/i915: convert SDVO driver to new encoder/connector structure
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c160
1 files changed, 94 insertions, 66 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 5534704c151a..602056a88dd0 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -156,7 +156,9 @@ struct intel_sdvo_priv {
156}; 156};
157 157
158static bool 158static bool
159intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags); 159intel_sdvo_output_setup(struct intel_encoder *intel_encoder,
160 struct intel_connector *intel_connector,
161 uint16_t flags);
160 162
161/** 163/**
162 * Writes the SDVOB or SDVOC with the given value, but always writes both 164 * Writes the SDVOB or SDVOC with the given value, but always writes both
@@ -165,7 +167,7 @@ intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags);
165 */ 167 */
166static void intel_sdvo_write_sdvox(struct intel_encoder *intel_encoder, u32 val) 168static void intel_sdvo_write_sdvox(struct intel_encoder *intel_encoder, u32 val)
167{ 169{
168 struct drm_device *dev = intel_encoder->base.dev; 170 struct drm_device *dev = intel_encoder->enc.dev;
169 struct drm_i915_private *dev_priv = dev->dev_private; 171 struct drm_i915_private *dev_priv = dev->dev_private;
170 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 172 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
171 u32 bval = val, cval = val; 173 u32 bval = val, cval = val;
@@ -1292,7 +1294,8 @@ static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
1292static int intel_sdvo_mode_valid(struct drm_connector *connector, 1294static int intel_sdvo_mode_valid(struct drm_connector *connector,
1293 struct drm_display_mode *mode) 1295 struct drm_display_mode *mode)
1294{ 1296{
1295 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1297 struct drm_encoder *encoder = intel_attached_encoder(connector);
1298 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1296 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1299 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1297 1300
1298 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 1301 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
@@ -1330,6 +1333,8 @@ static bool intel_sdvo_get_capabilities(struct intel_encoder *intel_encoder, str
1330 return true; 1333 return true;
1331} 1334}
1332 1335
1336/* No use! */
1337#if 0
1333struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB) 1338struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB)
1334{ 1339{
1335 struct drm_connector *connector = NULL; 1340 struct drm_connector *connector = NULL;
@@ -1400,6 +1405,7 @@ void intel_sdvo_set_hotplug(struct drm_connector *connector, int on)
1400 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0); 1405 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0);
1401 intel_sdvo_read_response(intel_encoder, &response, 2); 1406 intel_sdvo_read_response(intel_encoder, &response, 2);
1402} 1407}
1408#endif
1403 1409
1404static bool 1410static bool
1405intel_sdvo_multifunc_encoder(struct intel_encoder *intel_encoder) 1411intel_sdvo_multifunc_encoder(struct intel_encoder *intel_encoder)
@@ -1438,12 +1444,17 @@ static struct drm_connector *
1438intel_find_analog_connector(struct drm_device *dev) 1444intel_find_analog_connector(struct drm_device *dev)
1439{ 1445{
1440 struct drm_connector *connector; 1446 struct drm_connector *connector;
1447 struct drm_encoder *encoder;
1441 struct intel_encoder *intel_encoder; 1448 struct intel_encoder *intel_encoder;
1442 1449
1443 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 1450 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
1444 intel_encoder = to_intel_encoder(connector); 1451 intel_encoder = enc_to_intel_encoder(encoder);
1445 if (intel_encoder->type == INTEL_OUTPUT_ANALOG) 1452 if (intel_encoder->type == INTEL_OUTPUT_ANALOG) {
1446 return connector; 1453 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
1454 if (connector && encoder == intel_attached_encoder(connector))
1455 return connector;
1456 }
1457 }
1447 } 1458 }
1448 return NULL; 1459 return NULL;
1449} 1460}
@@ -1467,12 +1478,13 @@ intel_analog_is_connected(struct drm_device *dev)
1467enum drm_connector_status 1478enum drm_connector_status
1468intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response) 1479intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1469{ 1480{
1470 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1481 struct drm_encoder *encoder = intel_attached_encoder(connector);
1482 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1471 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1483 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1472 enum drm_connector_status status = connector_status_connected; 1484 enum drm_connector_status status = connector_status_connected;
1473 struct edid *edid = NULL; 1485 struct edid *edid = NULL;
1474 1486
1475 edid = drm_get_edid(&intel_encoder->base, 1487 edid = drm_get_edid(connector,
1476 intel_encoder->ddc_bus); 1488 intel_encoder->ddc_bus);
1477 1489
1478 /* This is only applied to SDVO cards with multiple outputs */ 1490 /* This is only applied to SDVO cards with multiple outputs */
@@ -1486,7 +1498,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1486 */ 1498 */
1487 while(temp_ddc > 1) { 1499 while(temp_ddc > 1) {
1488 sdvo_priv->ddc_bus = temp_ddc; 1500 sdvo_priv->ddc_bus = temp_ddc;
1489 edid = drm_get_edid(&intel_encoder->base, 1501 edid = drm_get_edid(connector,
1490 intel_encoder->ddc_bus); 1502 intel_encoder->ddc_bus);
1491 if (edid) { 1503 if (edid) {
1492 /* 1504 /*
@@ -1506,8 +1518,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1506 */ 1518 */
1507 if (edid == NULL && 1519 if (edid == NULL &&
1508 sdvo_priv->analog_ddc_bus && 1520 sdvo_priv->analog_ddc_bus &&
1509 !intel_analog_is_connected(intel_encoder->base.dev)) 1521 !intel_analog_is_connected(connector->dev))
1510 edid = drm_get_edid(&intel_encoder->base, 1522 edid = drm_get_edid(connector,
1511 sdvo_priv->analog_ddc_bus); 1523 sdvo_priv->analog_ddc_bus);
1512 if (edid != NULL) { 1524 if (edid != NULL) {
1513 /* Don't report the output as connected if it's a DVI-I 1525 /* Don't report the output as connected if it's a DVI-I
@@ -1522,7 +1534,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1522 } 1534 }
1523 1535
1524 kfree(edid); 1536 kfree(edid);
1525 intel_encoder->base.display_info.raw_edid = NULL; 1537 connector->display_info.raw_edid = NULL;
1526 1538
1527 } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) 1539 } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1))
1528 status = connector_status_disconnected; 1540 status = connector_status_disconnected;
@@ -1534,7 +1546,9 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
1534{ 1546{
1535 uint16_t response; 1547 uint16_t response;
1536 u8 status; 1548 u8 status;
1537 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1549 struct drm_encoder *encoder = intel_attached_encoder(connector);
1550 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1551 struct intel_connector *intel_connector = to_intel_connector(connector);
1538 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1552 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1539 1553
1540 intel_sdvo_write_cmd(intel_encoder, 1554 intel_sdvo_write_cmd(intel_encoder,
@@ -1556,7 +1570,8 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
1556 if (intel_sdvo_multifunc_encoder(intel_encoder) && 1570 if (intel_sdvo_multifunc_encoder(intel_encoder) &&
1557 sdvo_priv->attached_output != response) { 1571 sdvo_priv->attached_output != response) {
1558 if (sdvo_priv->controlled_output != response && 1572 if (sdvo_priv->controlled_output != response &&
1559 intel_sdvo_output_setup(intel_encoder, response) != true) 1573 intel_sdvo_output_setup(intel_encoder, intel_connector,
1574 response) != true)
1560 return connector_status_unknown; 1575 return connector_status_unknown;
1561 sdvo_priv->attached_output = response; 1576 sdvo_priv->attached_output = response;
1562 } 1577 }
@@ -1565,7 +1580,8 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
1565 1580
1566static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) 1581static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
1567{ 1582{
1568 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1583 struct drm_encoder *encoder = intel_attached_encoder(connector);
1584 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1569 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1585 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1570 int num_modes; 1586 int num_modes;
1571 1587
@@ -1580,7 +1596,7 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
1580 */ 1596 */
1581 if (num_modes == 0 && 1597 if (num_modes == 0 &&
1582 sdvo_priv->analog_ddc_bus && 1598 sdvo_priv->analog_ddc_bus &&
1583 !intel_analog_is_connected(intel_encoder->base.dev)) { 1599 !intel_analog_is_connected(connector->dev)) {
1584 /* Switch to the analog ddc bus and try that 1600 /* Switch to the analog ddc bus and try that
1585 */ 1601 */
1586 (void) intel_ddc_get_modes(connector, sdvo_priv->analog_ddc_bus); 1602 (void) intel_ddc_get_modes(connector, sdvo_priv->analog_ddc_bus);
@@ -1654,8 +1670,9 @@ struct drm_display_mode sdvo_tv_modes[] = {
1654 1670
1655static void intel_sdvo_get_tv_modes(struct drm_connector *connector) 1671static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
1656{ 1672{
1657 struct intel_encoder *output = to_intel_encoder(connector); 1673 struct drm_encoder *encoder = intel_attached_encoder(connector);
1658 struct intel_sdvo_priv *sdvo_priv = output->dev_priv; 1674 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1675 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1659 struct intel_sdvo_sdtv_resolution_request tv_res; 1676 struct intel_sdvo_sdtv_resolution_request tv_res;
1660 uint32_t reply = 0, format_map = 0; 1677 uint32_t reply = 0, format_map = 0;
1661 int i; 1678 int i;
@@ -1675,11 +1692,11 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
1675 sizeof(format_map) ? sizeof(format_map) : 1692 sizeof(format_map) ? sizeof(format_map) :
1676 sizeof(struct intel_sdvo_sdtv_resolution_request)); 1693 sizeof(struct intel_sdvo_sdtv_resolution_request));
1677 1694
1678 intel_sdvo_set_target_output(output, sdvo_priv->controlled_output); 1695 intel_sdvo_set_target_output(intel_encoder, sdvo_priv->controlled_output);
1679 1696
1680 intel_sdvo_write_cmd(output, SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT, 1697 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT,
1681 &tv_res, sizeof(tv_res)); 1698 &tv_res, sizeof(tv_res));
1682 status = intel_sdvo_read_response(output, &reply, 3); 1699 status = intel_sdvo_read_response(intel_encoder, &reply, 3);
1683 if (status != SDVO_CMD_STATUS_SUCCESS) 1700 if (status != SDVO_CMD_STATUS_SUCCESS)
1684 return; 1701 return;
1685 1702
@@ -1696,7 +1713,8 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
1696 1713
1697static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) 1714static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
1698{ 1715{
1699 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1716 struct drm_encoder *encoder = intel_attached_encoder(connector);
1717 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1700 struct drm_i915_private *dev_priv = connector->dev->dev_private; 1718 struct drm_i915_private *dev_priv = connector->dev->dev_private;
1701 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1719 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1702 struct drm_display_mode *newmode; 1720 struct drm_display_mode *newmode;
@@ -1735,8 +1753,9 @@ end:
1735 1753
1736static int intel_sdvo_get_modes(struct drm_connector *connector) 1754static int intel_sdvo_get_modes(struct drm_connector *connector)
1737{ 1755{
1738 struct intel_encoder *output = to_intel_encoder(connector); 1756 struct drm_encoder *encoder = intel_attached_encoder(connector);
1739 struct intel_sdvo_priv *sdvo_priv = output->dev_priv; 1757 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1758 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1740 1759
1741 if (sdvo_priv->is_tv) 1760 if (sdvo_priv->is_tv)
1742 intel_sdvo_get_tv_modes(connector); 1761 intel_sdvo_get_tv_modes(connector);
@@ -1753,9 +1772,10 @@ static int intel_sdvo_get_modes(struct drm_connector *connector)
1753static 1772static
1754void intel_sdvo_destroy_enhance_property(struct drm_connector *connector) 1773void intel_sdvo_destroy_enhance_property(struct drm_connector *connector)
1755{ 1774{
1756 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1775 struct drm_encoder *encoder = intel_attached_encoder(connector);
1776 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1757 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1777 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1758 struct drm_device *dev = connector->dev; 1778 struct drm_device *dev = encoder->dev;
1759 1779
1760 if (sdvo_priv->is_tv) { 1780 if (sdvo_priv->is_tv) {
1761 if (sdvo_priv->left_property) 1781 if (sdvo_priv->left_property)
@@ -1791,31 +1811,10 @@ void intel_sdvo_destroy_enhance_property(struct drm_connector *connector)
1791 1811
1792static void intel_sdvo_destroy(struct drm_connector *connector) 1812static void intel_sdvo_destroy(struct drm_connector *connector)
1793{ 1813{
1794 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1814 intel_sdvo_destroy_enhance_property(connector);
1795 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1796
1797 if (intel_encoder->i2c_bus)
1798 intel_i2c_destroy(intel_encoder->i2c_bus);
1799 if (intel_encoder->ddc_bus)
1800 intel_i2c_destroy(intel_encoder->ddc_bus);
1801 if (sdvo_priv->analog_ddc_bus)
1802 intel_i2c_destroy(sdvo_priv->analog_ddc_bus);
1803
1804 if (sdvo_priv->sdvo_lvds_fixed_mode != NULL)
1805 drm_mode_destroy(connector->dev,
1806 sdvo_priv->sdvo_lvds_fixed_mode);
1807
1808 if (sdvo_priv->tv_format_property)
1809 drm_property_destroy(connector->dev,
1810 sdvo_priv->tv_format_property);
1811
1812 if (sdvo_priv->is_tv || sdvo_priv->is_lvds)
1813 intel_sdvo_destroy_enhance_property(connector);
1814
1815 drm_sysfs_connector_remove(connector); 1815 drm_sysfs_connector_remove(connector);
1816 drm_connector_cleanup(connector); 1816 drm_connector_cleanup(connector);
1817 1817 kfree(connector);
1818 kfree(intel_encoder);
1819} 1818}
1820 1819
1821static int 1820static int
@@ -1823,9 +1822,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
1823 struct drm_property *property, 1822 struct drm_property *property,
1824 uint64_t val) 1823 uint64_t val)
1825{ 1824{
1826 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1825 struct drm_encoder *encoder = intel_attached_encoder(connector);
1826 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1827 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 1827 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1828 struct drm_encoder *encoder = &intel_encoder->enc;
1829 struct drm_crtc *crtc = encoder->crtc; 1828 struct drm_crtc *crtc = encoder->crtc;
1830 int ret = 0; 1829 int ret = 0;
1831 bool changed = false; 1830 bool changed = false;
@@ -1969,12 +1968,31 @@ static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
1969static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = { 1968static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcs = {
1970 .get_modes = intel_sdvo_get_modes, 1969 .get_modes = intel_sdvo_get_modes,
1971 .mode_valid = intel_sdvo_mode_valid, 1970 .mode_valid = intel_sdvo_mode_valid,
1972 .best_encoder = intel_best_encoder, 1971 .best_encoder = intel_attached_encoder,
1973}; 1972};
1974 1973
1975static void intel_sdvo_enc_destroy(struct drm_encoder *encoder) 1974static void intel_sdvo_enc_destroy(struct drm_encoder *encoder)
1976{ 1975{
1976 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1977 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1978
1979 if (intel_encoder->i2c_bus)
1980 intel_i2c_destroy(intel_encoder->i2c_bus);
1981 if (intel_encoder->ddc_bus)
1982 intel_i2c_destroy(intel_encoder->ddc_bus);
1983 if (sdvo_priv->analog_ddc_bus)
1984 intel_i2c_destroy(sdvo_priv->analog_ddc_bus);
1985
1986 if (sdvo_priv->sdvo_lvds_fixed_mode != NULL)
1987 drm_mode_destroy(encoder->dev,
1988 sdvo_priv->sdvo_lvds_fixed_mode);
1989
1990 if (sdvo_priv->tv_format_property)
1991 drm_property_destroy(encoder->dev,
1992 sdvo_priv->tv_format_property);
1993
1977 drm_encoder_cleanup(encoder); 1994 drm_encoder_cleanup(encoder);
1995 kfree(intel_encoder);
1978} 1996}
1979 1997
1980static const struct drm_encoder_funcs intel_sdvo_enc_funcs = { 1998static const struct drm_encoder_funcs intel_sdvo_enc_funcs = {
@@ -2045,15 +2063,13 @@ static struct intel_encoder *
2045intel_sdvo_chan_to_intel_encoder(struct intel_i2c_chan *chan) 2063intel_sdvo_chan_to_intel_encoder(struct intel_i2c_chan *chan)
2046{ 2064{
2047 struct drm_device *dev = chan->drm_dev; 2065 struct drm_device *dev = chan->drm_dev;
2048 struct drm_connector *connector; 2066 struct drm_encoder *encoder;
2049 struct intel_encoder *intel_encoder = NULL; 2067 struct intel_encoder *intel_encoder = NULL;
2050 2068
2051 list_for_each_entry(connector, 2069 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
2052 &dev->mode_config.connector_list, head) { 2070 intel_encoder = enc_to_intel_encoder(encoder);
2053 if (to_intel_encoder(connector)->ddc_bus == &chan->adapter) { 2071 if (intel_encoder->ddc_bus == &chan->adapter)
2054 intel_encoder = to_intel_encoder(connector);
2055 break; 2072 break;
2056 }
2057 } 2073 }
2058 return intel_encoder; 2074 return intel_encoder;
2059} 2075}
@@ -2141,9 +2157,11 @@ static struct dmi_system_id intel_sdvo_bad_tv[] = {
2141}; 2157};
2142 2158
2143static bool 2159static bool
2144intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags) 2160intel_sdvo_output_setup(struct intel_encoder *intel_encoder,
2161 struct intel_connector *intel_connector,
2162 uint16_t flags)
2145{ 2163{
2146 struct drm_connector *connector = &intel_encoder->base; 2164 struct drm_connector *connector = &intel_connector->base;
2147 struct drm_encoder *encoder = &intel_encoder->enc; 2165 struct drm_encoder *encoder = &intel_encoder->enc;
2148 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 2166 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
2149 bool ret = true, registered = false; 2167 bool ret = true, registered = false;
@@ -2250,7 +2268,8 @@ intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags)
2250 2268
2251static void intel_sdvo_tv_create_property(struct drm_connector *connector) 2269static void intel_sdvo_tv_create_property(struct drm_connector *connector)
2252{ 2270{
2253 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 2271 struct drm_encoder *encoder = intel_attached_encoder(connector);
2272 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
2254 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 2273 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
2255 struct intel_sdvo_tv_format format; 2274 struct intel_sdvo_tv_format format;
2256 uint32_t format_map, i; 2275 uint32_t format_map, i;
@@ -2299,7 +2318,8 @@ static void intel_sdvo_tv_create_property(struct drm_connector *connector)
2299 2318
2300static void intel_sdvo_create_enhance_property(struct drm_connector *connector) 2319static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2301{ 2320{
2302 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 2321 struct drm_encoder *encoder = intel_attached_encoder(connector);
2322 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
2303 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv; 2323 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
2304 struct intel_sdvo_enhancements_reply sdvo_data; 2324 struct intel_sdvo_enhancements_reply sdvo_data;
2305 struct drm_device *dev = connector->dev; 2325 struct drm_device *dev = connector->dev;
@@ -2606,6 +2626,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2606 struct drm_i915_private *dev_priv = dev->dev_private; 2626 struct drm_i915_private *dev_priv = dev->dev_private;
2607 struct drm_connector *connector; 2627 struct drm_connector *connector;
2608 struct intel_encoder *intel_encoder; 2628 struct intel_encoder *intel_encoder;
2629 struct intel_connector *intel_connector;
2609 struct intel_sdvo_priv *sdvo_priv; 2630 struct intel_sdvo_priv *sdvo_priv;
2610 2631
2611 u8 ch[0x40]; 2632 u8 ch[0x40];
@@ -2616,6 +2637,12 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2616 return false; 2637 return false;
2617 } 2638 }
2618 2639
2640 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
2641 if (!intel_connector) {
2642 kfree(intel_encoder);
2643 return false;
2644 }
2645
2619 sdvo_priv = (struct intel_sdvo_priv *)(intel_encoder + 1); 2646 sdvo_priv = (struct intel_sdvo_priv *)(intel_encoder + 1);
2620 sdvo_priv->sdvo_reg = sdvo_reg; 2647 sdvo_priv->sdvo_reg = sdvo_reg;
2621 2648
@@ -2667,7 +2694,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2667 /* In default case sdvo lvds is false */ 2694 /* In default case sdvo lvds is false */
2668 intel_sdvo_get_capabilities(intel_encoder, &sdvo_priv->caps); 2695 intel_sdvo_get_capabilities(intel_encoder, &sdvo_priv->caps);
2669 2696
2670 if (intel_sdvo_output_setup(intel_encoder, 2697 if (intel_sdvo_output_setup(intel_encoder, intel_connector,
2671 sdvo_priv->caps.output_flags) != true) { 2698 sdvo_priv->caps.output_flags) != true) {
2672 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", 2699 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n",
2673 sdvo_reg == SDVOB ? 'B' : 'C'); 2700 sdvo_reg == SDVOB ? 'B' : 'C');
@@ -2675,7 +2702,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2675 } 2702 }
2676 2703
2677 2704
2678 connector = &intel_encoder->base; 2705 connector = &intel_connector->base;
2679 drm_connector_init(dev, connector, &intel_sdvo_connector_funcs, 2706 drm_connector_init(dev, connector, &intel_sdvo_connector_funcs,
2680 connector->connector_type); 2707 connector->connector_type);
2681 2708
@@ -2689,7 +2716,7 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg)
2689 2716
2690 drm_encoder_helper_add(&intel_encoder->enc, &intel_sdvo_helper_funcs); 2717 drm_encoder_helper_add(&intel_encoder->enc, &intel_sdvo_helper_funcs);
2691 2718
2692 drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc); 2719 drm_mode_connector_attach_encoder(&intel_connector->base, &intel_encoder->enc);
2693 if (sdvo_priv->is_tv) 2720 if (sdvo_priv->is_tv)
2694 intel_sdvo_tv_create_property(connector); 2721 intel_sdvo_tv_create_property(connector);
2695 2722
@@ -2736,6 +2763,7 @@ err_i2c:
2736 intel_i2c_destroy(intel_encoder->i2c_bus); 2763 intel_i2c_destroy(intel_encoder->i2c_bus);
2737err_inteloutput: 2764err_inteloutput:
2738 kfree(intel_encoder); 2765 kfree(intel_encoder);
2766 kfree(intel_connector);
2739 2767
2740 return false; 2768 return false;
2741} 2769}