diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_tv.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_tv.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 12f15cb31dbb..267da3289263 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -903,6 +903,13 @@ static struct intel_tv *enc_to_intel_tv(struct drm_encoder *encoder) | |||
903 | return container_of(encoder, struct intel_tv, base.base); | 903 | return container_of(encoder, struct intel_tv, base.base); |
904 | } | 904 | } |
905 | 905 | ||
906 | static struct intel_tv *intel_attached_tv(struct drm_connector *connector) | ||
907 | { | ||
908 | return container_of(intel_attached_encoder(connector), | ||
909 | struct intel_tv, | ||
910 | base); | ||
911 | } | ||
912 | |||
906 | static void | 913 | static void |
907 | intel_tv_dpms(struct drm_encoder *encoder, int mode) | 914 | intel_tv_dpms(struct drm_encoder *encoder, int mode) |
908 | { | 915 | { |
@@ -945,8 +952,7 @@ static enum drm_mode_status | |||
945 | intel_tv_mode_valid(struct drm_connector *connector, | 952 | intel_tv_mode_valid(struct drm_connector *connector, |
946 | struct drm_display_mode *mode) | 953 | struct drm_display_mode *mode) |
947 | { | 954 | { |
948 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 955 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
949 | struct intel_tv *intel_tv = enc_to_intel_tv(encoder); | ||
950 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); | 956 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); |
951 | 957 | ||
952 | /* Ensure TV refresh is close to desired refresh */ | 958 | /* Ensure TV refresh is close to desired refresh */ |
@@ -1306,8 +1312,7 @@ intel_tv_detect_type (struct intel_tv *intel_tv) | |||
1306 | */ | 1312 | */ |
1307 | static void intel_tv_find_better_format(struct drm_connector *connector) | 1313 | static void intel_tv_find_better_format(struct drm_connector *connector) |
1308 | { | 1314 | { |
1309 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1315 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1310 | struct intel_tv *intel_tv = enc_to_intel_tv(encoder); | ||
1311 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); | 1316 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); |
1312 | int i; | 1317 | int i; |
1313 | 1318 | ||
@@ -1339,14 +1344,13 @@ static enum drm_connector_status | |||
1339 | intel_tv_detect(struct drm_connector *connector) | 1344 | intel_tv_detect(struct drm_connector *connector) |
1340 | { | 1345 | { |
1341 | struct drm_display_mode mode; | 1346 | struct drm_display_mode mode; |
1342 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1347 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1343 | struct intel_tv *intel_tv = enc_to_intel_tv(encoder); | ||
1344 | int type; | 1348 | int type; |
1345 | 1349 | ||
1346 | mode = reported_modes[0]; | 1350 | mode = reported_modes[0]; |
1347 | drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V); | 1351 | drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V); |
1348 | 1352 | ||
1349 | if (encoder->crtc && encoder->crtc->enabled) { | 1353 | if (intel_tv->base.base.crtc && intel_tv->base.base.crtc->enabled) { |
1350 | type = intel_tv_detect_type(intel_tv); | 1354 | type = intel_tv_detect_type(intel_tv); |
1351 | } else { | 1355 | } else { |
1352 | struct drm_crtc *crtc; | 1356 | struct drm_crtc *crtc; |
@@ -1391,8 +1395,7 @@ static void | |||
1391 | intel_tv_chose_preferred_modes(struct drm_connector *connector, | 1395 | intel_tv_chose_preferred_modes(struct drm_connector *connector, |
1392 | struct drm_display_mode *mode_ptr) | 1396 | struct drm_display_mode *mode_ptr) |
1393 | { | 1397 | { |
1394 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1398 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1395 | struct intel_tv *intel_tv = enc_to_intel_tv(encoder); | ||
1396 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); | 1399 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); |
1397 | 1400 | ||
1398 | if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480) | 1401 | if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480) |
@@ -1417,8 +1420,7 @@ static int | |||
1417 | intel_tv_get_modes(struct drm_connector *connector) | 1420 | intel_tv_get_modes(struct drm_connector *connector) |
1418 | { | 1421 | { |
1419 | struct drm_display_mode *mode_ptr; | 1422 | struct drm_display_mode *mode_ptr; |
1420 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1423 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1421 | struct intel_tv *intel_tv = enc_to_intel_tv(encoder); | ||
1422 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); | 1424 | const struct tv_mode *tv_mode = intel_tv_mode_find(intel_tv); |
1423 | int j, count = 0; | 1425 | int j, count = 0; |
1424 | u64 tmp; | 1426 | u64 tmp; |
@@ -1483,9 +1485,8 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop | |||
1483 | uint64_t val) | 1485 | uint64_t val) |
1484 | { | 1486 | { |
1485 | struct drm_device *dev = connector->dev; | 1487 | struct drm_device *dev = connector->dev; |
1486 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1488 | struct intel_tv *intel_tv = intel_attached_tv(connector); |
1487 | struct intel_tv *intel_tv = enc_to_intel_tv(encoder); | 1489 | struct drm_crtc *crtc = intel_tv->base.base.crtc; |
1488 | struct drm_crtc *crtc = encoder->crtc; | ||
1489 | int ret = 0; | 1490 | int ret = 0; |
1490 | bool changed = false; | 1491 | bool changed = false; |
1491 | 1492 | ||
@@ -1550,7 +1551,7 @@ static const struct drm_connector_funcs intel_tv_connector_funcs = { | |||
1550 | static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = { | 1551 | static const struct drm_connector_helper_funcs intel_tv_connector_helper_funcs = { |
1551 | .mode_valid = intel_tv_mode_valid, | 1552 | .mode_valid = intel_tv_mode_valid, |
1552 | .get_modes = intel_tv_get_modes, | 1553 | .get_modes = intel_tv_get_modes, |
1553 | .best_encoder = intel_attached_encoder, | 1554 | .best_encoder = intel_best_encoder, |
1554 | }; | 1555 | }; |
1555 | 1556 | ||
1556 | static const struct drm_encoder_funcs intel_tv_enc_funcs = { | 1557 | static const struct drm_encoder_funcs intel_tv_enc_funcs = { |
@@ -1659,8 +1660,7 @@ intel_tv_init(struct drm_device *dev) | |||
1659 | drm_encoder_init(dev, &intel_encoder->base, &intel_tv_enc_funcs, | 1660 | drm_encoder_init(dev, &intel_encoder->base, &intel_tv_enc_funcs, |
1660 | DRM_MODE_ENCODER_TVDAC); | 1661 | DRM_MODE_ENCODER_TVDAC); |
1661 | 1662 | ||
1662 | drm_mode_connector_attach_encoder(&intel_connector->base, | 1663 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
1663 | &intel_encoder->base); | ||
1664 | intel_encoder->type = INTEL_OUTPUT_TVOUT; | 1664 | intel_encoder->type = INTEL_OUTPUT_TVOUT; |
1665 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); | 1665 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); |
1666 | intel_encoder->clone_mask = (1 << INTEL_TV_CLONE_BIT); | 1666 | intel_encoder->clone_mask = (1 << INTEL_TV_CLONE_BIT); |