Rev 3243 | Rev 3482 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3243 | Rev 3480 | ||
---|---|---|---|
Line 110... | Line 110... | ||
110 | /** |
110 | /** |
111 | * This is used to select the color range of RBG outputs in HDMI mode. |
111 | * This is used to select the color range of RBG outputs in HDMI mode. |
112 | * It is only valid when using TMDS encoding and 8 bit per color mode. |
112 | * It is only valid when using TMDS encoding and 8 bit per color mode. |
113 | */ |
113 | */ |
114 | uint32_t color_range; |
114 | uint32_t color_range; |
- | 115 | bool color_range_auto; |
|
Line 115... | Line 116... | ||
115 | 116 | ||
116 | /** |
117 | /** |
117 | * This is set if we're going to treat the device as TV-out. |
118 | * This is set if we're going to treat the device as TV-out. |
118 | * |
119 | * |
Line 132... | Line 133... | ||
132 | * This is set if we treat the device as HDMI, instead of DVI. |
133 | * This is set if we treat the device as HDMI, instead of DVI. |
133 | */ |
134 | */ |
134 | bool is_hdmi; |
135 | bool is_hdmi; |
135 | bool has_hdmi_monitor; |
136 | bool has_hdmi_monitor; |
136 | bool has_hdmi_audio; |
137 | bool has_hdmi_audio; |
- | 138 | bool rgb_quant_range_selectable; |
|
Line 137... | Line 139... | ||
137 | 139 | ||
138 | /** |
140 | /** |
139 | * This is set if we detect output of sdvo device as LVDS and |
141 | * This is set if we detect output of sdvo device as LVDS and |
140 | * have a valid fixed mode to use with the panel. |
142 | * have a valid fixed mode to use with the panel. |
Line 953... | Line 955... | ||
953 | return intel_sdvo_set_value(intel_sdvo, |
955 | return intel_sdvo_set_value(intel_sdvo, |
954 | SDVO_CMD_SET_HBUF_TXRATE, |
956 | SDVO_CMD_SET_HBUF_TXRATE, |
955 | &tx_rate, 1); |
957 | &tx_rate, 1); |
956 | } |
958 | } |
Line 957... | Line 959... | ||
957 | 959 | ||
- | 960 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo, |
|
958 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) |
961 | const struct drm_display_mode *adjusted_mode) |
959 | { |
962 | { |
960 | struct dip_infoframe avi_if = { |
963 | struct dip_infoframe avi_if = { |
961 | .type = DIP_TYPE_AVI, |
964 | .type = DIP_TYPE_AVI, |
962 | .ver = DIP_VERSION_AVI, |
965 | .ver = DIP_VERSION_AVI, |
963 | .len = DIP_LEN_AVI, |
966 | .len = DIP_LEN_AVI, |
964 | }; |
967 | }; |
Line -... | Line 968... | ||
- | 968 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; |
|
- | 969 | ||
- | 970 | if (intel_sdvo->rgb_quant_range_selectable) { |
|
- | 971 | if (adjusted_mode->private_flags & INTEL_MODE_LIMITED_COLOR_RANGE) |
|
- | 972 | avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_LIMITED; |
|
- | 973 | else |
|
- | 974 | avi_if.body.avi.ITC_EC_Q_SC |= DIP_AVI_RGB_QUANT_RANGE_FULL; |
|
965 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; |
975 | } |
Line 966... | Line 976... | ||
966 | 976 | ||
967 | intel_dip_infoframe_csum(&avi_if); |
977 | intel_dip_infoframe_csum(&avi_if); |
968 | 978 | ||
Line 1071... | Line 1081... | ||
1071 | * SDVO device will factor out the multiplier during mode_set. |
1081 | * SDVO device will factor out the multiplier during mode_set. |
1072 | */ |
1082 | */ |
1073 | multiplier = intel_sdvo_get_pixel_multiplier(adjusted_mode); |
1083 | multiplier = intel_sdvo_get_pixel_multiplier(adjusted_mode); |
1074 | intel_mode_set_pixel_multiplier(adjusted_mode, multiplier); |
1084 | intel_mode_set_pixel_multiplier(adjusted_mode, multiplier); |
Line -... | Line 1085... | ||
- | 1085 | ||
- | 1086 | if (intel_sdvo->color_range_auto) { |
|
- | 1087 | /* See CEA-861-E - 5.1 Default Encoding Parameters */ |
|
- | 1088 | if (intel_sdvo->has_hdmi_monitor && |
|
- | 1089 | drm_match_cea_mode(adjusted_mode) > 1) |
|
- | 1090 | intel_sdvo->color_range = SDVO_COLOR_RANGE_16_235; |
|
- | 1091 | else |
|
- | 1092 | intel_sdvo->color_range = 0; |
|
- | 1093 | } |
|
- | 1094 | ||
- | 1095 | if (intel_sdvo->color_range) |
|
- | 1096 | adjusted_mode->private_flags |= INTEL_MODE_LIMITED_COLOR_RANGE; |
|
1075 | 1097 | ||
1076 | return true; |
1098 | return true; |
Line 1077... | Line 1099... | ||
1077 | } |
1099 | } |
1078 | 1100 | ||
Line 1128... | Line 1150... | ||
1128 | 1150 | ||
1129 | if (intel_sdvo->has_hdmi_monitor) { |
1151 | if (intel_sdvo->has_hdmi_monitor) { |
1130 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); |
1152 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI); |
1131 | intel_sdvo_set_colorimetry(intel_sdvo, |
1153 | intel_sdvo_set_colorimetry(intel_sdvo, |
1132 | SDVO_COLORIMETRY_RGB256); |
1154 | SDVO_COLORIMETRY_RGB256); |
1133 | intel_sdvo_set_avi_infoframe(intel_sdvo); |
1155 | intel_sdvo_set_avi_infoframe(intel_sdvo, adjusted_mode); |
1134 | } else |
1156 | } else |
Line 1135... | Line 1157... | ||
1135 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI); |
1157 | intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI); |
1136 | 1158 | ||
Line 1160... | Line 1182... | ||
1160 | /* Set the SDVO control regs. */ |
1182 | /* Set the SDVO control regs. */ |
1161 | if (INTEL_INFO(dev)->gen >= 4) { |
1183 | if (INTEL_INFO(dev)->gen >= 4) { |
1162 | /* The real mode polarity is set by the SDVO commands, using |
1184 | /* The real mode polarity is set by the SDVO commands, using |
1163 | * struct intel_sdvo_dtd. */ |
1185 | * struct intel_sdvo_dtd. */ |
1164 | sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; |
1186 | sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH; |
1165 | if (intel_sdvo->is_hdmi) |
1187 | if (!HAS_PCH_SPLIT(dev) && intel_sdvo->is_hdmi) |
1166 | sdvox |= intel_sdvo->color_range; |
1188 | sdvox |= intel_sdvo->color_range; |
1167 | if (INTEL_INFO(dev)->gen < 5) |
1189 | if (INTEL_INFO(dev)->gen < 5) |
1168 | sdvox |= SDVO_BORDER_ENABLE; |
1190 | sdvox |= SDVO_BORDER_ENABLE; |
1169 | } else { |
1191 | } else { |
1170 | sdvox = I915_READ(intel_sdvo->sdvo_reg); |
1192 | sdvox = I915_READ(intel_sdvo->sdvo_reg); |
Line 1520... | Line 1542... | ||
1520 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { |
1542 | if (edid->input & DRM_EDID_INPUT_DIGITAL) { |
1521 | status = connector_status_connected; |
1543 | status = connector_status_connected; |
1522 | if (intel_sdvo->is_hdmi) { |
1544 | if (intel_sdvo->is_hdmi) { |
1523 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); |
1545 | intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid); |
1524 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); |
1546 | intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid); |
- | 1547 | intel_sdvo->rgb_quant_range_selectable = |
|
- | 1548 | drm_rgb_quant_range_selectable(edid); |
|
1525 | } |
1549 | } |
1526 | } else |
1550 | } else |
1527 | status = connector_status_disconnected; |
1551 | status = connector_status_disconnected; |
1528 | kfree(edid); |
1552 | kfree(edid); |
1529 | } |
1553 | } |
Line 1571... | Line 1595... | ||
1571 | 1595 | ||
Line 1572... | Line 1596... | ||
1572 | intel_sdvo->attached_output = response; |
1596 | intel_sdvo->attached_output = response; |
1573 | 1597 | ||
- | 1598 | intel_sdvo->has_hdmi_monitor = false; |
|
Line 1574... | Line 1599... | ||
1574 | intel_sdvo->has_hdmi_monitor = false; |
1599 | intel_sdvo->has_hdmi_audio = false; |
1575 | intel_sdvo->has_hdmi_audio = false; |
1600 | intel_sdvo->rgb_quant_range_selectable = false; |
1576 | 1601 | ||
1577 | if ((intel_sdvo_connector->output_flag & response) == 0) |
1602 | if ((intel_sdvo_connector->output_flag & response) == 0) |
Line 1882... | Line 1907... | ||
1882 | 1907 | ||
1883 | ret = drm_object_property_set_value(&connector->base, property, val); |
1908 | ret = drm_object_property_set_value(&connector->base, property, val); |
1884 | if (ret) |
1909 | if (ret) |
Line 1885... | Line -... | ||
1885 | return ret; |
- | |
1886 | 1910 | return ret; |
|
1887 | #if 0 |
1911 | |
1888 | if (property == dev_priv->force_audio_property) { |
1912 | if (property == dev_priv->force_audio_property) { |
Line 1889... | Line 1913... | ||
1889 | int i = val; |
1913 | int i = val; |
Line 1905... | Line 1929... | ||
1905 | intel_sdvo->has_hdmi_audio = has_audio; |
1929 | intel_sdvo->has_hdmi_audio = has_audio; |
1906 | goto done; |
1930 | goto done; |
1907 | } |
1931 | } |
Line 1908... | Line 1932... | ||
1908 | 1932 | ||
- | 1933 | if (property == dev_priv->broadcast_rgb_property) { |
|
- | 1934 | switch (val) { |
|
1909 | if (property == dev_priv->broadcast_rgb_property) { |
1935 | case INTEL_BROADCAST_RGB_AUTO: |
1910 | if (val == !!intel_sdvo->color_range) |
1936 | intel_sdvo->color_range_auto = true; |
- | 1937 | break; |
|
- | 1938 | case INTEL_BROADCAST_RGB_FULL: |
|
- | 1939 | intel_sdvo->color_range_auto = false; |
|
1911 | return 0; |
1940 | intel_sdvo->color_range = 0; |
- | 1941 | break; |
|
- | 1942 | case INTEL_BROADCAST_RGB_LIMITED: |
|
1912 | 1943 | intel_sdvo->color_range_auto = false; |
|
- | 1944 | intel_sdvo->color_range = SDVO_COLOR_RANGE_16_235; |
|
- | 1945 | break; |
|
- | 1946 | default: |
|
- | 1947 | return -EINVAL; |
|
1913 | intel_sdvo->color_range = val ? SDVO_COLOR_RANGE_16_235 : 0; |
1948 | } |
1914 | goto done; |
1949 | goto done; |
1915 | } |
- | |
Line 1916... | Line 1950... | ||
1916 | #endif |
1950 | } |
1917 | 1951 | ||
1918 | #define CHECK_PROPERTY(name, NAME) \ |
1952 | #define CHECK_PROPERTY(name, NAME) \ |
1919 | if (intel_sdvo_connector->name == property) { \ |
1953 | if (intel_sdvo_connector->name == property) { \ |
Line 2006... | Line 2040... | ||
2006 | if (!intel_sdvo_set_value(intel_sdvo, cmd, &temp_value, 2)) |
2040 | if (!intel_sdvo_set_value(intel_sdvo, cmd, &temp_value, 2)) |
2007 | return -EIO; |
2041 | return -EIO; |
Line 2008... | Line 2042... | ||
2008 | 2042 | ||
2009 | 2043 | ||
2010 | done: |
2044 | done: |
2011 | if (intel_sdvo->base.base.crtc) { |
- | |
2012 | struct drm_crtc *crtc = intel_sdvo->base.base.crtc; |
- | |
2013 | intel_set_mode(crtc, &crtc->mode, |
- | |
Line 2014... | Line 2045... | ||
2014 | crtc->x, crtc->y, crtc->fb); |
2045 | if (intel_sdvo->base.base.crtc) |
2015 | } |
2046 | intel_crtc_restore_mode(intel_sdvo->base.base.crtc); |
2016 | 2047 | ||
Line 2017... | Line 2048... | ||
2017 | return 0; |
2048 | return 0; |
2018 | #undef CHECK_PROPERTY |
2049 | #undef CHECK_PROPERTY |
2019 | } |
2050 | } |
2020 | - | ||
2021 | static const struct drm_encoder_helper_funcs intel_sdvo_helper_funcs = { |
2051 | |
Line 2022... | Line 2052... | ||
2022 | .mode_fixup = intel_sdvo_mode_fixup, |
2052 | static const struct drm_encoder_helper_funcs intel_sdvo_helper_funcs = { |
2023 | .mode_set = intel_sdvo_mode_set, |
2053 | .mode_fixup = intel_sdvo_mode_fixup, |
2024 | .disable = intel_encoder_noop, |
2054 | .mode_set = intel_sdvo_mode_set, |
Line 2209... | Line 2239... | ||
2209 | intel_connector_attach_encoder(&connector->base, &encoder->base); |
2239 | intel_connector_attach_encoder(&connector->base, &encoder->base); |
2210 | drm_sysfs_connector_add(&connector->base.base); |
2240 | drm_sysfs_connector_add(&connector->base.base); |
2211 | } |
2241 | } |
Line 2212... | Line 2242... | ||
2212 | 2242 | ||
2213 | static void |
2243 | static void |
- | 2244 | intel_sdvo_add_hdmi_properties(struct intel_sdvo *intel_sdvo, |
|
2214 | intel_sdvo_add_hdmi_properties(struct intel_sdvo_connector *connector) |
2245 | struct intel_sdvo_connector *connector) |
2215 | { |
2246 | { |
Line 2216... | Line 2247... | ||
2216 | struct drm_device *dev = connector->base.base.dev; |
2247 | struct drm_device *dev = connector->base.base.dev; |
2217 | 2248 | ||
2218 | intel_attach_force_audio_property(&connector->base.base); |
2249 | intel_attach_force_audio_property(&connector->base.base); |
- | 2250 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) { |
|
- | 2251 | intel_attach_broadcast_rgb_property(&connector->base.base); |
|
2219 | if (INTEL_INFO(dev)->gen >= 4 && IS_MOBILE(dev)) |
2252 | intel_sdvo->color_range_auto = true; |
Line 2220... | Line 2253... | ||
2220 | intel_attach_broadcast_rgb_property(&connector->base.base); |
2253 | } |
2221 | } |
2254 | } |
2222 | 2255 | ||
Line 2263... | Line 2296... | ||
2263 | intel_sdvo->is_hdmi = true; |
2296 | intel_sdvo->is_hdmi = true; |
2264 | } |
2297 | } |
Line 2265... | Line 2298... | ||
2265 | 2298 | ||
2266 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); |
2299 | intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); |
2267 | if (intel_sdvo->is_hdmi) |
2300 | if (intel_sdvo->is_hdmi) |
Line 2268... | Line 2301... | ||
2268 | intel_sdvo_add_hdmi_properties(intel_sdvo_connector); |
2301 | intel_sdvo_add_hdmi_properties(intel_sdvo, intel_sdvo_connector); |
2269 | 2302 | ||
Line 2270... | Line 2303... | ||
2270 | return true; |
2303 | return true; |