diff options
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 6739a7455174..de158b76bcd5 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -120,12 +120,6 @@ struct intel_sdvo { | |||
120 | */ | 120 | */ |
121 | struct drm_display_mode *sdvo_lvds_fixed_mode; | 121 | struct drm_display_mode *sdvo_lvds_fixed_mode; |
122 | 122 | ||
123 | /* | ||
124 | * supported encoding mode, used to determine whether HDMI is | ||
125 | * supported | ||
126 | */ | ||
127 | struct intel_sdvo_encode encode; | ||
128 | |||
129 | /* DDC bus used by this SDVO encoder */ | 123 | /* DDC bus used by this SDVO encoder */ |
130 | uint8_t ddc_bus; | 124 | uint8_t ddc_bus; |
131 | 125 | ||
@@ -799,17 +793,13 @@ static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode, | |||
799 | mode->flags |= DRM_MODE_FLAG_PVSYNC; | 793 | mode->flags |= DRM_MODE_FLAG_PVSYNC; |
800 | } | 794 | } |
801 | 795 | ||
802 | static bool intel_sdvo_get_supp_encode(struct intel_sdvo *intel_sdvo, | 796 | static bool intel_sdvo_check_supp_encode(struct intel_sdvo *intel_sdvo) |
803 | struct intel_sdvo_encode *encode) | ||
804 | { | 797 | { |
805 | if (intel_sdvo_get_value(intel_sdvo, | 798 | struct intel_sdvo_encode encode; |
806 | SDVO_CMD_GET_SUPP_ENCODE, | ||
807 | encode, sizeof(*encode))) | ||
808 | return true; | ||
809 | 799 | ||
810 | /* non-support means DVI */ | 800 | return intel_sdvo_get_value(intel_sdvo, |
811 | memset(encode, 0, sizeof(*encode)); | 801 | SDVO_CMD_GET_SUPP_ENCODE, |
812 | return false; | 802 | &encode, sizeof(encode)); |
813 | } | 803 | } |
814 | 804 | ||
815 | static bool intel_sdvo_set_encode(struct intel_sdvo *intel_sdvo, | 805 | static bool intel_sdvo_set_encode(struct intel_sdvo *intel_sdvo, |
@@ -1958,12 +1948,22 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv, | |||
1958 | } | 1948 | } |
1959 | 1949 | ||
1960 | static bool | 1950 | static bool |
1961 | intel_sdvo_get_digital_encoding_mode(struct intel_sdvo *intel_sdvo, int device) | 1951 | intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device) |
1962 | { | 1952 | { |
1963 | return intel_sdvo_set_target_output(intel_sdvo, | 1953 | int is_hdmi; |
1964 | device == 0 ? SDVO_OUTPUT_TMDS0 : SDVO_OUTPUT_TMDS1) && | 1954 | |
1965 | intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE, | 1955 | if (!intel_sdvo_check_supp_encode(intel_sdvo)) |
1966 | &intel_sdvo->is_hdmi, 1); | 1956 | return false; |
1957 | |||
1958 | if (!intel_sdvo_set_target_output(intel_sdvo, | ||
1959 | device == 0 ? SDVO_OUTPUT_TMDS0 : SDVO_OUTPUT_TMDS1)) | ||
1960 | return false; | ||
1961 | |||
1962 | is_hdmi = 0; | ||
1963 | if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE, &is_hdmi, 1)) | ||
1964 | return false; | ||
1965 | |||
1966 | return !!is_hdmi; | ||
1967 | } | 1967 | } |
1968 | 1968 | ||
1969 | static u8 | 1969 | static u8 |
@@ -2064,14 +2064,13 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) | |||
2064 | encoder->encoder_type = DRM_MODE_ENCODER_TMDS; | 2064 | encoder->encoder_type = DRM_MODE_ENCODER_TMDS; |
2065 | connector->connector_type = DRM_MODE_CONNECTOR_DVID; | 2065 | connector->connector_type = DRM_MODE_CONNECTOR_DVID; |
2066 | 2066 | ||
2067 | if (intel_sdvo_get_supp_encode(intel_sdvo, &intel_sdvo->encode) | 2067 | if (intel_sdvo_is_hdmi_connector(intel_sdvo, device)) { |
2068 | && intel_sdvo_get_digital_encoding_mode(intel_sdvo, device) | ||
2069 | && intel_sdvo->is_hdmi) { | ||
2070 | /* enable hdmi encoding mode if supported */ | 2068 | /* enable hdmi encoding mode if supported */ |
2071 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); | 2069 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); |
2072 | intel_sdvo_set_colorimetry(intel_sdvo, | 2070 | intel_sdvo_set_colorimetry(intel_sdvo, |
2073 | SDVO_COLORIMETRY_RGB256); | 2071 | SDVO_COLORIMETRY_RGB256); |
2074 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; | 2072 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; |
2073 | intel_sdvo->is_hdmi = true; | ||
2075 | } | 2074 | } |
2076 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | 2075 | intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | |
2077 | (1 << INTEL_ANALOG_CLONE_BIT)); | 2076 | (1 << INTEL_ANALOG_CLONE_BIT)); |