aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
diff options
context:
space:
mode:
authorZhenyu Wang <zhenyuw@linux.intel.com>2010-03-29 04:38:44 -0400
committerEric Anholt <eric@anholt.net>2010-04-12 12:23:54 -0400
commit0c41ee2be6fff0fb3c933fc0ecfdfbce485620f0 (patch)
tree51d61fd0740cffae82f352e4c818d7efbc550986 /drivers/gpu/drm/i915
parentd2a82a6f1b5b1b90154c410674a889c9133ed029 (diff)
drm/i915: convert TV 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_tv.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index c8f67bfa22ed..081cb9014525 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -941,7 +941,8 @@ intel_tv_mode_find (struct intel_encoder *intel_encoder)
941static enum drm_mode_status 941static enum drm_mode_status
942intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) 942intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode)
943{ 943{
944 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 944 struct drm_encoder *encoder = intel_attached_encoder(connector);
945 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
945 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder); 946 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
946 947
947 /* Ensure TV refresh is close to desired refresh */ 948 /* Ensure TV refresh is close to desired refresh */
@@ -1313,7 +1314,8 @@ intel_tv_detect_type (struct drm_crtc *crtc, struct intel_encoder *intel_encoder
1313 */ 1314 */
1314static void intel_tv_find_better_format(struct drm_connector *connector) 1315static void intel_tv_find_better_format(struct drm_connector *connector)
1315{ 1316{
1316 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1317 struct drm_encoder *encoder = intel_attached_encoder(connector);
1318 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1317 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv; 1319 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1318 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder); 1320 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1319 int i; 1321 int i;
@@ -1347,9 +1349,9 @@ intel_tv_detect(struct drm_connector *connector)
1347{ 1349{
1348 struct drm_crtc *crtc; 1350 struct drm_crtc *crtc;
1349 struct drm_display_mode mode; 1351 struct drm_display_mode mode;
1350 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1352 struct drm_encoder *encoder = intel_attached_encoder(connector);
1353 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1351 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv; 1354 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1352 struct drm_encoder *encoder = &intel_encoder->enc;
1353 int dpms_mode; 1355 int dpms_mode;
1354 int type = tv_priv->type; 1356 int type = tv_priv->type;
1355 1357
@@ -1399,7 +1401,8 @@ static void
1399intel_tv_chose_preferred_modes(struct drm_connector *connector, 1401intel_tv_chose_preferred_modes(struct drm_connector *connector,
1400 struct drm_display_mode *mode_ptr) 1402 struct drm_display_mode *mode_ptr)
1401{ 1403{
1402 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1404 struct drm_encoder *encoder = intel_attached_encoder(connector);
1405 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1403 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder); 1406 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1404 1407
1405 if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480) 1408 if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480)
@@ -1424,7 +1427,8 @@ static int
1424intel_tv_get_modes(struct drm_connector *connector) 1427intel_tv_get_modes(struct drm_connector *connector)
1425{ 1428{
1426 struct drm_display_mode *mode_ptr; 1429 struct drm_display_mode *mode_ptr;
1427 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1430 struct drm_encoder *encoder = intel_attached_encoder(connector);
1431 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1428 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder); 1432 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1429 int j, count = 0; 1433 int j, count = 0;
1430 u64 tmp; 1434 u64 tmp;
@@ -1478,11 +1482,9 @@ intel_tv_get_modes(struct drm_connector *connector)
1478static void 1482static void
1479intel_tv_destroy (struct drm_connector *connector) 1483intel_tv_destroy (struct drm_connector *connector)
1480{ 1484{
1481 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1482
1483 drm_sysfs_connector_remove(connector); 1485 drm_sysfs_connector_remove(connector);
1484 drm_connector_cleanup(connector); 1486 drm_connector_cleanup(connector);
1485 kfree(intel_encoder); 1487 kfree(connector);
1486} 1488}
1487 1489
1488 1490
@@ -1491,9 +1493,9 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop
1491 uint64_t val) 1493 uint64_t val)
1492{ 1494{
1493 struct drm_device *dev = connector->dev; 1495 struct drm_device *dev = connector->dev;
1494 struct intel_encoder *intel_encoder = to_intel_encoder(connector); 1496 struct drm_encoder *encoder = intel_attached_encoder(connector);
1497 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1495 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv; 1498 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1496 struct drm_encoder *encoder = &intel_encoder->enc;
1497 struct drm_crtc *crtc = encoder->crtc; 1499 struct drm_crtc *crtc = encoder->crtc;
1498 int ret = 0; 1500 int ret = 0;
1499 bool changed = false; 1501 bool changed = false;
@@ -1559,12 +1561,15 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = {
1559static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = { 1561static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = {
1560 .mode_valid = intel_tv_mode_valid, 1562 .mode_valid = intel_tv_mode_valid,
1561 .get_modes = intel_tv_get_modes, 1563 .get_modes = intel_tv_get_modes,
1562 .best_encoder = intel_best_encoder, 1564 .best_encoder = intel_attached_encoder,
1563}; 1565};
1564 1566
1565static void intel_tv_enc_destroy(struct drm_encoder *encoder) 1567static void intel_tv_enc_destroy(struct drm_encoder *encoder)
1566{ 1568{
1569 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1570
1567 drm_encoder_cleanup(encoder); 1571 drm_encoder_cleanup(encoder);
1572 kfree(intel_encoder);
1568} 1573}
1569 1574
1570static const struct drm_encoder_funcs intel_tv_enc_funcs = { 1575static const struct drm_encoder_funcs intel_tv_enc_funcs = {
@@ -1613,6 +1618,7 @@ intel_tv_init(struct drm_device *dev)
1613 struct drm_i915_private *dev_priv = dev->dev_private; 1618 struct drm_i915_private *dev_priv = dev->dev_private;
1614 struct drm_connector *connector; 1619 struct drm_connector *connector;
1615 struct intel_encoder *intel_encoder; 1620 struct intel_encoder *intel_encoder;
1621 struct intel_connector *intel_connector;
1616 struct intel_tv_priv *tv_priv; 1622 struct intel_tv_priv *tv_priv;
1617 u32 tv_dac_on, tv_dac_off, save_tv_dac; 1623 u32 tv_dac_on, tv_dac_off, save_tv_dac;
1618 char **tv_format_names; 1624 char **tv_format_names;
@@ -1658,7 +1664,13 @@ intel_tv_init(struct drm_device *dev)
1658 return; 1664 return;
1659 } 1665 }
1660 1666
1661 connector = &intel_encoder->base; 1667 intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
1668 if (!intel_connector) {
1669 kfree(intel_encoder);
1670 return;
1671 }
1672
1673 connector = &intel_connector->base;
1662 1674
1663 drm_connector_init(dev, connector, &intel_tv_connector_funcs, 1675 drm_connector_init(dev, connector, &intel_tv_connector_funcs,
1664 DRM_MODE_CONNECTOR_SVIDEO); 1676 DRM_MODE_CONNECTOR_SVIDEO);
@@ -1666,7 +1678,7 @@ intel_tv_init(struct drm_device *dev)
1666 drm_encoder_init(dev, &intel_encoder->enc, &intel_tv_enc_funcs, 1678 drm_encoder_init(dev, &intel_encoder->enc, &intel_tv_enc_funcs,
1667 DRM_MODE_ENCODER_TVDAC); 1679 DRM_MODE_ENCODER_TVDAC);
1668 1680
1669 drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc); 1681 drm_mode_connector_attach_encoder(&intel_connector->base, &intel_encoder->enc);
1670 tv_priv = (struct intel_tv_priv *)(intel_encoder + 1); 1682 tv_priv = (struct intel_tv_priv *)(intel_encoder + 1);
1671 intel_encoder->type = INTEL_OUTPUT_TVOUT; 1683 intel_encoder->type = INTEL_OUTPUT_TVOUT;
1672 intel_encoder->crtc_mask = (1 << 0) | (1 << 1); 1684 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);