diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 5805ec1aba12..4a03b7f67dd5 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -103,7 +103,6 @@ struct intel_sdvo { | |||
103 | 103 | ||
104 | bool has_hdmi_monitor; | 104 | bool has_hdmi_monitor; |
105 | bool has_hdmi_audio; | 105 | bool has_hdmi_audio; |
106 | bool rgb_quant_range_selectable; | ||
107 | 106 | ||
108 | /* DDC bus used by this SDVO encoder */ | 107 | /* DDC bus used by this SDVO encoder */ |
109 | uint8_t ddc_bus; | 108 | uint8_t ddc_bus; |
@@ -981,29 +980,30 @@ static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo, | |||
981 | } | 980 | } |
982 | 981 | ||
983 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo, | 982 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo, |
984 | const struct intel_crtc_state *pipe_config) | 983 | const struct intel_crtc_state *pipe_config, |
984 | const struct drm_connector_state *conn_state) | ||
985 | { | 985 | { |
986 | const struct drm_display_mode *adjusted_mode = | ||
987 | &pipe_config->base.adjusted_mode; | ||
986 | uint8_t sdvo_data[HDMI_INFOFRAME_SIZE(AVI)]; | 988 | uint8_t sdvo_data[HDMI_INFOFRAME_SIZE(AVI)]; |
987 | union hdmi_infoframe frame; | 989 | union hdmi_infoframe frame; |
988 | int ret; | 990 | int ret; |
989 | ssize_t len; | 991 | ssize_t len; |
990 | 992 | ||
991 | ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, | 993 | ret = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, |
992 | &pipe_config->base.adjusted_mode, | 994 | conn_state->connector, |
993 | false); | 995 | adjusted_mode); |
994 | if (ret < 0) { | 996 | if (ret < 0) { |
995 | DRM_ERROR("couldn't fill AVI infoframe\n"); | 997 | DRM_ERROR("couldn't fill AVI infoframe\n"); |
996 | return false; | 998 | return false; |
997 | } | 999 | } |
998 | 1000 | ||
999 | if (intel_sdvo->rgb_quant_range_selectable) { | 1001 | drm_hdmi_avi_infoframe_quant_range(&frame.avi, |
1000 | if (pipe_config->limited_color_range) | 1002 | conn_state->connector, |
1001 | frame.avi.quantization_range = | 1003 | adjusted_mode, |
1002 | HDMI_QUANTIZATION_RANGE_LIMITED; | 1004 | pipe_config->limited_color_range ? |
1003 | else | 1005 | HDMI_QUANTIZATION_RANGE_LIMITED : |
1004 | frame.avi.quantization_range = | 1006 | HDMI_QUANTIZATION_RANGE_FULL); |
1005 | HDMI_QUANTIZATION_RANGE_FULL; | ||
1006 | } | ||
1007 | 1007 | ||
1008 | len = hdmi_infoframe_pack(&frame, sdvo_data, sizeof(sdvo_data)); | 1008 | len = hdmi_infoframe_pack(&frame, sdvo_data, sizeof(sdvo_data)); |
1009 | if (len < 0) | 1009 | if (len < 0) |
@@ -1108,9 +1108,9 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config) | |||
1108 | pipe_config->clock_set = true; | 1108 | pipe_config->clock_set = true; |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | static bool intel_sdvo_compute_config(struct intel_encoder *encoder, | 1111 | static int intel_sdvo_compute_config(struct intel_encoder *encoder, |
1112 | struct intel_crtc_state *pipe_config, | 1112 | struct intel_crtc_state *pipe_config, |
1113 | struct drm_connector_state *conn_state) | 1113 | struct drm_connector_state *conn_state) |
1114 | { | 1114 | { |
1115 | struct intel_sdvo *intel_sdvo = to_sdvo(encoder); | 1115 | struct intel_sdvo *intel_sdvo = to_sdvo(encoder); |
1116 | struct intel_sdvo_connector_state *intel_sdvo_state = | 1116 | struct intel_sdvo_connector_state *intel_sdvo_state = |
@@ -1135,7 +1135,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, | |||
1135 | */ | 1135 | */ |
1136 | if (IS_TV(intel_sdvo_connector)) { | 1136 | if (IS_TV(intel_sdvo_connector)) { |
1137 | if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode)) | 1137 | if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, mode)) |
1138 | return false; | 1138 | return -EINVAL; |
1139 | 1139 | ||
1140 | (void) intel_sdvo_get_preferred_input_mode(intel_sdvo, | 1140 | (void) intel_sdvo_get_preferred_input_mode(intel_sdvo, |
1141 | intel_sdvo_connector, | 1141 | intel_sdvo_connector, |
@@ -1145,7 +1145,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, | |||
1145 | } else if (IS_LVDS(intel_sdvo_connector)) { | 1145 | } else if (IS_LVDS(intel_sdvo_connector)) { |
1146 | if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, | 1146 | if (!intel_sdvo_set_output_timings_from_mode(intel_sdvo, |
1147 | intel_sdvo_connector->base.panel.fixed_mode)) | 1147 | intel_sdvo_connector->base.panel.fixed_mode)) |
1148 | return false; | 1148 | return -EINVAL; |
1149 | 1149 | ||
1150 | (void) intel_sdvo_get_preferred_input_mode(intel_sdvo, | 1150 | (void) intel_sdvo_get_preferred_input_mode(intel_sdvo, |
1151 | intel_sdvo_connector, | 1151 | intel_sdvo_connector, |
@@ -1154,7 +1154,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, | |||
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) | 1156 | if (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN) |
1157 | return false; | 1157 | return -EINVAL; |
1158 | 1158 | ||
1159 | /* | 1159 | /* |
1160 | * Make the CRTC code factor in the SDVO pixel multiplier. The | 1160 | * Make the CRTC code factor in the SDVO pixel multiplier. The |
@@ -1194,7 +1194,7 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder, | |||
1194 | if (intel_sdvo_connector->is_hdmi) | 1194 | if (intel_sdvo_connector->is_hdmi) |
1195 | adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio; | 1195 | adjusted_mode->picture_aspect_ratio = conn_state->picture_aspect_ratio; |
1196 | 1196 | ||
1197 | return true; | 1197 | return 0; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | #define UPDATE_PROPERTY(input, NAME) \ | 1200 | #define UPDATE_PROPERTY(input, NAME) \ |
@@ -1316,7 +1316,8 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder, | |||
1316 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); | 1316 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); |
1317 | intel_sdvo_set_colorimetry(intel_sdvo, | 1317 | intel_sdvo_set_colorimetry(intel_sdvo, |
1318 | SDVO_COLORIMETRY_RGB256); | 1318 | SDVO_COLORIMETRY_RGB256); |
1319 | intel_sdvo_set_avi_infoframe(intel_sdvo, crtc_state); | 1319 | intel_sdvo_set_avi_infoframe(intel_sdvo, |
1320 | crtc_state, conn_state); | ||
1320 | } else | 1321 | } else |
1321 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI); | 1322 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI); |
1322 | 1323 | ||
@@ -1802,8 +1803,6 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector) | |||
1802 | if (intel_sdvo_connector->is_hdmi) { | 1803 | if (intel_sdvo_connector->is_hdmi) { |
1803 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); | 1804 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); |
1804 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); | 1805 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); |
1805 | intel_sdvo->rgb_quant_range_selectable = | ||
1806 | drm_rgb_quant_range_selectable(edid); | ||
1807 | } | 1806 | } |
1808 | } else | 1807 | } else |
1809 | status = connector_status_disconnected; | 1808 | status = connector_status_disconnected; |
@@ -1852,7 +1851,6 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) | |||
1852 | 1851 | ||
1853 | intel_sdvo->has_hdmi_monitor = false; | 1852 | intel_sdvo->has_hdmi_monitor = false; |
1854 | intel_sdvo->has_hdmi_audio = false; | 1853 | intel_sdvo->has_hdmi_audio = false; |
1855 | intel_sdvo->rgb_quant_range_selectable = false; | ||
1856 | 1854 | ||
1857 | if ((intel_sdvo_connector->output_flag & response) == 0) | 1855 | if ((intel_sdvo_connector->output_flag & response) == 0) |
1858 | ret = connector_status_disconnected; | 1856 | ret = connector_status_disconnected; |