diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 438 |
1 files changed, 303 insertions, 135 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index 9a00adb3a50..5371d933255 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "drm.h" | 31 | #include "drm.h" |
32 | #include "drm_crtc.h" | 32 | #include "drm_crtc.h" |
33 | #include "intel_drv.h" | 33 | #include "intel_drv.h" |
34 | #include "drm_edid.h" | ||
34 | #include "i915_drm.h" | 35 | #include "i915_drm.h" |
35 | #include "i915_drv.h" | 36 | #include "i915_drv.h" |
36 | #include "intel_sdvo_regs.h" | 37 | #include "intel_sdvo_regs.h" |
@@ -38,8 +39,7 @@ | |||
38 | #undef SDVO_DEBUG | 39 | #undef SDVO_DEBUG |
39 | #define I915_SDVO "i915_sdvo" | 40 | #define I915_SDVO "i915_sdvo" |
40 | struct intel_sdvo_priv { | 41 | struct intel_sdvo_priv { |
41 | struct intel_i2c_chan *i2c_bus; | 42 | u8 slave_addr; |
42 | int slaveaddr; | ||
43 | 43 | ||
44 | /* Register for the SDVO device: SDVOB or SDVOC */ | 44 | /* Register for the SDVO device: SDVOB or SDVOC */ |
45 | int output_device; | 45 | int output_device; |
@@ -56,6 +56,12 @@ struct intel_sdvo_priv { | |||
56 | /* Pixel clock limitations reported by the SDVO device, in kHz */ | 56 | /* Pixel clock limitations reported by the SDVO device, in kHz */ |
57 | int pixel_clock_min, pixel_clock_max; | 57 | int pixel_clock_min, pixel_clock_max; |
58 | 58 | ||
59 | /* | ||
60 | * For multiple function SDVO device, | ||
61 | * this is for current attached outputs. | ||
62 | */ | ||
63 | uint16_t attached_output; | ||
64 | |||
59 | /** | 65 | /** |
60 | * This is set if we're going to treat the device as TV-out. | 66 | * This is set if we're going to treat the device as TV-out. |
61 | * | 67 | * |
@@ -69,12 +75,23 @@ struct intel_sdvo_priv { | |||
69 | * This is set if we treat the device as HDMI, instead of DVI. | 75 | * This is set if we treat the device as HDMI, instead of DVI. |
70 | */ | 76 | */ |
71 | bool is_hdmi; | 77 | bool is_hdmi; |
78 | |||
72 | /** | 79 | /** |
73 | * This is set if we detect output of sdvo device as LVDS. | 80 | * This is set if we detect output of sdvo device as LVDS. |
74 | */ | 81 | */ |
75 | bool is_lvds; | 82 | bool is_lvds; |
76 | 83 | ||
77 | /** | 84 | /** |
85 | * This is sdvo flags for input timing. | ||
86 | */ | ||
87 | uint8_t sdvo_flags; | ||
88 | |||
89 | /** | ||
90 | * This is sdvo fixed pannel mode pointer | ||
91 | */ | ||
92 | struct drm_display_mode *sdvo_lvds_fixed_mode; | ||
93 | |||
94 | /** | ||
78 | * Returned SDTV resolutions allowed for the current format, if the | 95 | * Returned SDTV resolutions allowed for the current format, if the |
79 | * device reported it. | 96 | * device reported it. |
80 | */ | 97 | */ |
@@ -104,6 +121,9 @@ struct intel_sdvo_priv { | |||
104 | u32 save_SDVOX; | 121 | u32 save_SDVOX; |
105 | }; | 122 | }; |
106 | 123 | ||
124 | static bool | ||
125 | intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags); | ||
126 | |||
107 | /** | 127 | /** |
108 | * Writes the SDVOB or SDVOC with the given value, but always writes both | 128 | * Writes the SDVOB or SDVOC with the given value, but always writes both |
109 | * SDVOB and SDVOC to work around apparent hardware issues (according to | 129 | * SDVOB and SDVOC to work around apparent hardware issues (according to |
@@ -146,13 +166,13 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr, | |||
146 | 166 | ||
147 | struct i2c_msg msgs[] = { | 167 | struct i2c_msg msgs[] = { |
148 | { | 168 | { |
149 | .addr = sdvo_priv->i2c_bus->slave_addr, | 169 | .addr = sdvo_priv->slave_addr >> 1, |
150 | .flags = 0, | 170 | .flags = 0, |
151 | .len = 1, | 171 | .len = 1, |
152 | .buf = out_buf, | 172 | .buf = out_buf, |
153 | }, | 173 | }, |
154 | { | 174 | { |
155 | .addr = sdvo_priv->i2c_bus->slave_addr, | 175 | .addr = sdvo_priv->slave_addr >> 1, |
156 | .flags = I2C_M_RD, | 176 | .flags = I2C_M_RD, |
157 | .len = 1, | 177 | .len = 1, |
158 | .buf = buf, | 178 | .buf = buf, |
@@ -162,7 +182,7 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr, | |||
162 | out_buf[0] = addr; | 182 | out_buf[0] = addr; |
163 | out_buf[1] = 0; | 183 | out_buf[1] = 0; |
164 | 184 | ||
165 | if ((ret = i2c_transfer(&sdvo_priv->i2c_bus->adapter, msgs, 2)) == 2) | 185 | if ((ret = i2c_transfer(intel_output->i2c_bus, msgs, 2)) == 2) |
166 | { | 186 | { |
167 | *ch = buf[0]; | 187 | *ch = buf[0]; |
168 | return true; | 188 | return true; |
@@ -175,10 +195,11 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr, | |||
175 | static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr, | 195 | static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr, |
176 | u8 ch) | 196 | u8 ch) |
177 | { | 197 | { |
198 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
178 | u8 out_buf[2]; | 199 | u8 out_buf[2]; |
179 | struct i2c_msg msgs[] = { | 200 | struct i2c_msg msgs[] = { |
180 | { | 201 | { |
181 | .addr = intel_output->i2c_bus->slave_addr, | 202 | .addr = sdvo_priv->slave_addr >> 1, |
182 | .flags = 0, | 203 | .flags = 0, |
183 | .len = 2, | 204 | .len = 2, |
184 | .buf = out_buf, | 205 | .buf = out_buf, |
@@ -188,7 +209,7 @@ static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr, | |||
188 | out_buf[0] = addr; | 209 | out_buf[0] = addr; |
189 | out_buf[1] = ch; | 210 | out_buf[1] = ch; |
190 | 211 | ||
191 | if (i2c_transfer(&intel_output->i2c_bus->adapter, msgs, 1) == 1) | 212 | if (i2c_transfer(intel_output->i2c_bus, msgs, 1) == 1) |
192 | { | 213 | { |
193 | return true; | 214 | return true; |
194 | } | 215 | } |
@@ -592,6 +613,7 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
592 | uint16_t height) | 613 | uint16_t height) |
593 | { | 614 | { |
594 | struct intel_sdvo_preferred_input_timing_args args; | 615 | struct intel_sdvo_preferred_input_timing_args args; |
616 | struct intel_sdvo_priv *sdvo_priv = output->dev_priv; | ||
595 | uint8_t status; | 617 | uint8_t status; |
596 | 618 | ||
597 | memset(&args, 0, sizeof(args)); | 619 | memset(&args, 0, sizeof(args)); |
@@ -599,7 +621,12 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
599 | args.width = width; | 621 | args.width = width; |
600 | args.height = height; | 622 | args.height = height; |
601 | args.interlace = 0; | 623 | args.interlace = 0; |
602 | args.scaled = 0; | 624 | |
625 | if (sdvo_priv->is_lvds && | ||
626 | (sdvo_priv->sdvo_lvds_fixed_mode->hdisplay != width || | ||
627 | sdvo_priv->sdvo_lvds_fixed_mode->vdisplay != height)) | ||
628 | args.scaled = 1; | ||
629 | |||
603 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, | 630 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, |
604 | &args, sizeof(args)); | 631 | &args, sizeof(args)); |
605 | status = intel_sdvo_read_response(output, NULL, 0); | 632 | status = intel_sdvo_read_response(output, NULL, 0); |
@@ -944,12 +971,7 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
944 | struct intel_output *output = enc_to_intel_output(encoder); | 971 | struct intel_output *output = enc_to_intel_output(encoder); |
945 | struct intel_sdvo_priv *dev_priv = output->dev_priv; | 972 | struct intel_sdvo_priv *dev_priv = output->dev_priv; |
946 | 973 | ||
947 | if (!dev_priv->is_tv) { | 974 | if (dev_priv->is_tv) { |
948 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
949 | * SDVO device will be told of the multiplier during mode_set. | ||
950 | */ | ||
951 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
952 | } else { | ||
953 | struct intel_sdvo_dtd output_dtd; | 975 | struct intel_sdvo_dtd output_dtd; |
954 | bool success; | 976 | bool success; |
955 | 977 | ||
@@ -980,6 +1002,47 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
980 | intel_sdvo_get_preferred_input_timing(output, | 1002 | intel_sdvo_get_preferred_input_timing(output, |
981 | &input_dtd); | 1003 | &input_dtd); |
982 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | 1004 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); |
1005 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
1006 | |||
1007 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
1008 | |||
1009 | mode->clock = adjusted_mode->clock; | ||
1010 | |||
1011 | adjusted_mode->clock *= | ||
1012 | intel_sdvo_get_pixel_multiplier(mode); | ||
1013 | } else { | ||
1014 | return false; | ||
1015 | } | ||
1016 | } else if (dev_priv->is_lvds) { | ||
1017 | struct intel_sdvo_dtd output_dtd; | ||
1018 | bool success; | ||
1019 | |||
1020 | drm_mode_set_crtcinfo(dev_priv->sdvo_lvds_fixed_mode, 0); | ||
1021 | /* Set output timings */ | ||
1022 | intel_sdvo_get_dtd_from_mode(&output_dtd, | ||
1023 | dev_priv->sdvo_lvds_fixed_mode); | ||
1024 | |||
1025 | intel_sdvo_set_target_output(output, | ||
1026 | dev_priv->controlled_output); | ||
1027 | intel_sdvo_set_output_timing(output, &output_dtd); | ||
1028 | |||
1029 | /* Set the input timing to the screen. Assume always input 0. */ | ||
1030 | intel_sdvo_set_target_input(output, true, false); | ||
1031 | |||
1032 | |||
1033 | success = intel_sdvo_create_preferred_input_timing( | ||
1034 | output, | ||
1035 | mode->clock / 10, | ||
1036 | mode->hdisplay, | ||
1037 | mode->vdisplay); | ||
1038 | |||
1039 | if (success) { | ||
1040 | struct intel_sdvo_dtd input_dtd; | ||
1041 | |||
1042 | intel_sdvo_get_preferred_input_timing(output, | ||
1043 | &input_dtd); | ||
1044 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | ||
1045 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
983 | 1046 | ||
984 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 1047 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
985 | 1048 | ||
@@ -990,6 +1053,12 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
990 | } else { | 1053 | } else { |
991 | return false; | 1054 | return false; |
992 | } | 1055 | } |
1056 | |||
1057 | } else { | ||
1058 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
1059 | * SDVO device will be told of the multiplier during mode_set. | ||
1060 | */ | ||
1061 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
993 | } | 1062 | } |
994 | return true; | 1063 | return true; |
995 | } | 1064 | } |
@@ -1033,15 +1102,16 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1033 | 1102 | ||
1034 | /* We have tried to get input timing in mode_fixup, and filled into | 1103 | /* We have tried to get input timing in mode_fixup, and filled into |
1035 | adjusted_mode */ | 1104 | adjusted_mode */ |
1036 | if (sdvo_priv->is_tv) | 1105 | if (sdvo_priv->is_tv || sdvo_priv->is_lvds) { |
1037 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | 1106 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); |
1038 | else | 1107 | input_dtd.part2.sdvo_flags = sdvo_priv->sdvo_flags; |
1108 | } else | ||
1039 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); | 1109 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); |
1040 | 1110 | ||
1041 | /* If it's a TV, we already set the output timing in mode_fixup. | 1111 | /* If it's a TV, we already set the output timing in mode_fixup. |
1042 | * Otherwise, the output timing is equal to the input timing. | 1112 | * Otherwise, the output timing is equal to the input timing. |
1043 | */ | 1113 | */ |
1044 | if (!sdvo_priv->is_tv) { | 1114 | if (!sdvo_priv->is_tv && !sdvo_priv->is_lvds) { |
1045 | /* Set the output timing to the screen */ | 1115 | /* Set the output timing to the screen */ |
1046 | intel_sdvo_set_target_output(output, | 1116 | intel_sdvo_set_target_output(output, |
1047 | sdvo_priv->controlled_output); | 1117 | sdvo_priv->controlled_output); |
@@ -1116,6 +1186,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1116 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; | 1186 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; |
1117 | } | 1187 | } |
1118 | 1188 | ||
1189 | if (sdvo_priv->sdvo_flags & SDVO_NEED_TO_STALL) | ||
1190 | sdvox |= SDVO_STALL_SELECT; | ||
1119 | intel_sdvo_write_sdvox(output, sdvox); | 1191 | intel_sdvo_write_sdvox(output, sdvox); |
1120 | } | 1192 | } |
1121 | 1193 | ||
@@ -1276,6 +1348,17 @@ static int intel_sdvo_mode_valid(struct drm_connector *connector, | |||
1276 | if (sdvo_priv->pixel_clock_max < mode->clock) | 1348 | if (sdvo_priv->pixel_clock_max < mode->clock) |
1277 | return MODE_CLOCK_HIGH; | 1349 | return MODE_CLOCK_HIGH; |
1278 | 1350 | ||
1351 | if (sdvo_priv->is_lvds == true) { | ||
1352 | if (sdvo_priv->sdvo_lvds_fixed_mode == NULL) | ||
1353 | return MODE_PANEL; | ||
1354 | |||
1355 | if (mode->hdisplay > sdvo_priv->sdvo_lvds_fixed_mode->hdisplay) | ||
1356 | return MODE_PANEL; | ||
1357 | |||
1358 | if (mode->vdisplay > sdvo_priv->sdvo_lvds_fixed_mode->vdisplay) | ||
1359 | return MODE_PANEL; | ||
1360 | } | ||
1361 | |||
1279 | return MODE_OK; | 1362 | return MODE_OK; |
1280 | } | 1363 | } |
1281 | 1364 | ||
@@ -1362,42 +1445,96 @@ void intel_sdvo_set_hotplug(struct drm_connector *connector, int on) | |||
1362 | intel_sdvo_read_response(intel_output, &response, 2); | 1445 | intel_sdvo_read_response(intel_output, &response, 2); |
1363 | } | 1446 | } |
1364 | 1447 | ||
1365 | static void | 1448 | static bool |
1366 | intel_sdvo_hdmi_sink_detect(struct drm_connector *connector) | 1449 | intel_sdvo_multifunc_encoder(struct intel_output *intel_output) |
1450 | { | ||
1451 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1452 | int caps = 0; | ||
1453 | |||
1454 | if (sdvo_priv->caps.output_flags & | ||
1455 | (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) | ||
1456 | caps++; | ||
1457 | if (sdvo_priv->caps.output_flags & | ||
1458 | (SDVO_OUTPUT_RGB0 | SDVO_OUTPUT_RGB1)) | ||
1459 | caps++; | ||
1460 | if (sdvo_priv->caps.output_flags & | ||
1461 | (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_SVID0)) | ||
1462 | caps++; | ||
1463 | if (sdvo_priv->caps.output_flags & | ||
1464 | (SDVO_OUTPUT_CVBS0 | SDVO_OUTPUT_CVBS1)) | ||
1465 | caps++; | ||
1466 | if (sdvo_priv->caps.output_flags & | ||
1467 | (SDVO_OUTPUT_YPRPB0 | SDVO_OUTPUT_YPRPB1)) | ||
1468 | caps++; | ||
1469 | |||
1470 | if (sdvo_priv->caps.output_flags & | ||
1471 | (SDVO_OUTPUT_SCART0 | SDVO_OUTPUT_SCART1)) | ||
1472 | caps++; | ||
1473 | |||
1474 | if (sdvo_priv->caps.output_flags & | ||
1475 | (SDVO_OUTPUT_LVDS0 | SDVO_OUTPUT_LVDS1)) | ||
1476 | caps++; | ||
1477 | |||
1478 | return (caps > 1); | ||
1479 | } | ||
1480 | |||
1481 | enum drm_connector_status | ||
1482 | intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response) | ||
1367 | { | 1483 | { |
1368 | struct intel_output *intel_output = to_intel_output(connector); | 1484 | struct intel_output *intel_output = to_intel_output(connector); |
1369 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | 1485 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; |
1486 | enum drm_connector_status status = connector_status_connected; | ||
1370 | struct edid *edid = NULL; | 1487 | struct edid *edid = NULL; |
1371 | 1488 | ||
1372 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); | ||
1373 | edid = drm_get_edid(&intel_output->base, | 1489 | edid = drm_get_edid(&intel_output->base, |
1374 | &intel_output->ddc_bus->adapter); | 1490 | intel_output->ddc_bus); |
1375 | if (edid != NULL) { | 1491 | if (edid != NULL) { |
1376 | sdvo_priv->is_hdmi = drm_detect_hdmi_monitor(edid); | 1492 | /* Don't report the output as connected if it's a DVI-I |
1493 | * connector with a non-digital EDID coming out. | ||
1494 | */ | ||
1495 | if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) { | ||
1496 | if (edid->input & DRM_EDID_INPUT_DIGITAL) | ||
1497 | sdvo_priv->is_hdmi = | ||
1498 | drm_detect_hdmi_monitor(edid); | ||
1499 | else | ||
1500 | status = connector_status_disconnected; | ||
1501 | } | ||
1502 | |||
1377 | kfree(edid); | 1503 | kfree(edid); |
1378 | intel_output->base.display_info.raw_edid = NULL; | 1504 | intel_output->base.display_info.raw_edid = NULL; |
1379 | } | 1505 | |
1506 | } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) | ||
1507 | status = connector_status_disconnected; | ||
1508 | |||
1509 | return status; | ||
1380 | } | 1510 | } |
1381 | 1511 | ||
1382 | static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector) | 1512 | static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector) |
1383 | { | 1513 | { |
1384 | u8 response[2]; | 1514 | uint16_t response; |
1385 | u8 status; | 1515 | u8 status; |
1386 | struct intel_output *intel_output = to_intel_output(connector); | 1516 | struct intel_output *intel_output = to_intel_output(connector); |
1517 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1387 | 1518 | ||
1388 | intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0); | 1519 | intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0); |
1389 | status = intel_sdvo_read_response(intel_output, &response, 2); | 1520 | status = intel_sdvo_read_response(intel_output, &response, 2); |
1390 | 1521 | ||
1391 | DRM_DEBUG("SDVO response %d %d\n", response[0], response[1]); | 1522 | DRM_DEBUG("SDVO response %d %d\n", response & 0xff, response >> 8); |
1392 | 1523 | ||
1393 | if (status != SDVO_CMD_STATUS_SUCCESS) | 1524 | if (status != SDVO_CMD_STATUS_SUCCESS) |
1394 | return connector_status_unknown; | 1525 | return connector_status_unknown; |
1395 | 1526 | ||
1396 | if ((response[0] != 0) || (response[1] != 0)) { | 1527 | if (response == 0) |
1397 | intel_sdvo_hdmi_sink_detect(connector); | ||
1398 | return connector_status_connected; | ||
1399 | } else | ||
1400 | return connector_status_disconnected; | 1528 | return connector_status_disconnected; |
1529 | |||
1530 | if (intel_sdvo_multifunc_encoder(intel_output) && | ||
1531 | sdvo_priv->attached_output != response) { | ||
1532 | if (sdvo_priv->controlled_output != response && | ||
1533 | intel_sdvo_output_setup(intel_output, response) != true) | ||
1534 | return connector_status_unknown; | ||
1535 | sdvo_priv->attached_output = response; | ||
1536 | } | ||
1537 | return intel_sdvo_hdmi_sink_detect(connector, response); | ||
1401 | } | 1538 | } |
1402 | 1539 | ||
1403 | static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) | 1540 | static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) |
@@ -1549,23 +1686,21 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector) | |||
1549 | static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | 1686 | static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) |
1550 | { | 1687 | { |
1551 | struct intel_output *intel_output = to_intel_output(connector); | 1688 | struct intel_output *intel_output = to_intel_output(connector); |
1552 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1553 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 1689 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
1690 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1691 | struct drm_display_mode *newmode; | ||
1554 | 1692 | ||
1555 | /* | 1693 | /* |
1556 | * Attempt to get the mode list from DDC. | 1694 | * Attempt to get the mode list from DDC. |
1557 | * Assume that the preferred modes are | 1695 | * Assume that the preferred modes are |
1558 | * arranged in priority order. | 1696 | * arranged in priority order. |
1559 | */ | 1697 | */ |
1560 | /* set the bus switch and get the modes */ | ||
1561 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); | ||
1562 | intel_ddc_get_modes(intel_output); | 1698 | intel_ddc_get_modes(intel_output); |
1563 | if (list_empty(&connector->probed_modes) == false) | 1699 | if (list_empty(&connector->probed_modes) == false) |
1564 | return; | 1700 | goto end; |
1565 | 1701 | ||
1566 | /* Fetch modes from VBT */ | 1702 | /* Fetch modes from VBT */ |
1567 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { | 1703 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { |
1568 | struct drm_display_mode *newmode; | ||
1569 | newmode = drm_mode_duplicate(connector->dev, | 1704 | newmode = drm_mode_duplicate(connector->dev, |
1570 | dev_priv->sdvo_lvds_vbt_mode); | 1705 | dev_priv->sdvo_lvds_vbt_mode); |
1571 | if (newmode != NULL) { | 1706 | if (newmode != NULL) { |
@@ -1575,6 +1710,16 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1575 | drm_mode_probed_add(connector, newmode); | 1710 | drm_mode_probed_add(connector, newmode); |
1576 | } | 1711 | } |
1577 | } | 1712 | } |
1713 | |||
1714 | end: | ||
1715 | list_for_each_entry(newmode, &connector->probed_modes, head) { | ||
1716 | if (newmode->type & DRM_MODE_TYPE_PREFERRED) { | ||
1717 | sdvo_priv->sdvo_lvds_fixed_mode = | ||
1718 | drm_mode_duplicate(connector->dev, newmode); | ||
1719 | break; | ||
1720 | } | ||
1721 | } | ||
1722 | |||
1578 | } | 1723 | } |
1579 | 1724 | ||
1580 | static int intel_sdvo_get_modes(struct drm_connector *connector) | 1725 | static int intel_sdvo_get_modes(struct drm_connector *connector) |
@@ -1597,14 +1742,20 @@ static int intel_sdvo_get_modes(struct drm_connector *connector) | |||
1597 | static void intel_sdvo_destroy(struct drm_connector *connector) | 1742 | static void intel_sdvo_destroy(struct drm_connector *connector) |
1598 | { | 1743 | { |
1599 | struct intel_output *intel_output = to_intel_output(connector); | 1744 | struct intel_output *intel_output = to_intel_output(connector); |
1745 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1600 | 1746 | ||
1601 | if (intel_output->i2c_bus) | 1747 | if (intel_output->i2c_bus) |
1602 | intel_i2c_destroy(intel_output->i2c_bus); | 1748 | intel_i2c_destroy(intel_output->i2c_bus); |
1603 | if (intel_output->ddc_bus) | 1749 | if (intel_output->ddc_bus) |
1604 | intel_i2c_destroy(intel_output->ddc_bus); | 1750 | intel_i2c_destroy(intel_output->ddc_bus); |
1605 | 1751 | ||
1752 | if (sdvo_priv->sdvo_lvds_fixed_mode != NULL) | ||
1753 | drm_mode_destroy(connector->dev, | ||
1754 | sdvo_priv->sdvo_lvds_fixed_mode); | ||
1755 | |||
1606 | drm_sysfs_connector_remove(connector); | 1756 | drm_sysfs_connector_remove(connector); |
1607 | drm_connector_cleanup(connector); | 1757 | drm_connector_cleanup(connector); |
1758 | |||
1608 | kfree(intel_output); | 1759 | kfree(intel_output); |
1609 | } | 1760 | } |
1610 | 1761 | ||
@@ -1709,7 +1860,7 @@ intel_sdvo_chan_to_intel_output(struct intel_i2c_chan *chan) | |||
1709 | 1860 | ||
1710 | list_for_each_entry(connector, | 1861 | list_for_each_entry(connector, |
1711 | &dev->mode_config.connector_list, head) { | 1862 | &dev->mode_config.connector_list, head) { |
1712 | if (to_intel_output(connector)->ddc_bus == chan) { | 1863 | if (to_intel_output(connector)->ddc_bus == &chan->adapter) { |
1713 | intel_output = to_intel_output(connector); | 1864 | intel_output = to_intel_output(connector); |
1714 | break; | 1865 | break; |
1715 | } | 1866 | } |
@@ -1723,7 +1874,7 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap, | |||
1723 | struct intel_output *intel_output; | 1874 | struct intel_output *intel_output; |
1724 | struct intel_sdvo_priv *sdvo_priv; | 1875 | struct intel_sdvo_priv *sdvo_priv; |
1725 | struct i2c_algo_bit_data *algo_data; | 1876 | struct i2c_algo_bit_data *algo_data; |
1726 | struct i2c_algorithm *algo; | 1877 | const struct i2c_algorithm *algo; |
1727 | 1878 | ||
1728 | algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data; | 1879 | algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data; |
1729 | intel_output = | 1880 | intel_output = |
@@ -1733,7 +1884,7 @@ static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap, | |||
1733 | return -EINVAL; | 1884 | return -EINVAL; |
1734 | 1885 | ||
1735 | sdvo_priv = intel_output->dev_priv; | 1886 | sdvo_priv = intel_output->dev_priv; |
1736 | algo = (struct i2c_algorithm *)intel_output->i2c_bus->adapter.algo; | 1887 | algo = intel_output->i2c_bus->algo; |
1737 | 1888 | ||
1738 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); | 1889 | intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); |
1739 | return algo->master_xfer(i2c_adap, msgs, num); | 1890 | return algo->master_xfer(i2c_adap, msgs, num); |
@@ -1780,18 +1931,101 @@ intel_sdvo_get_slave_addr(struct drm_device *dev, int output_device) | |||
1780 | return 0x72; | 1931 | return 0x72; |
1781 | } | 1932 | } |
1782 | 1933 | ||
1934 | static bool | ||
1935 | intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) | ||
1936 | { | ||
1937 | struct drm_connector *connector = &intel_output->base; | ||
1938 | struct drm_encoder *encoder = &intel_output->enc; | ||
1939 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1940 | bool ret = true, registered = false; | ||
1941 | |||
1942 | sdvo_priv->is_tv = false; | ||
1943 | intel_output->needs_tv_clock = false; | ||
1944 | sdvo_priv->is_lvds = false; | ||
1945 | |||
1946 | if (device_is_registered(&connector->kdev)) { | ||
1947 | drm_sysfs_connector_remove(connector); | ||
1948 | registered = true; | ||
1949 | } | ||
1950 | |||
1951 | if (flags & | ||
1952 | (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) { | ||
1953 | if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS0) | ||
1954 | sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS0; | ||
1955 | else | ||
1956 | sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1; | ||
1957 | |||
1958 | encoder->encoder_type = DRM_MODE_ENCODER_TMDS; | ||
1959 | connector->connector_type = DRM_MODE_CONNECTOR_DVID; | ||
1960 | |||
1961 | if (intel_sdvo_get_supp_encode(intel_output, | ||
1962 | &sdvo_priv->encode) && | ||
1963 | intel_sdvo_get_digital_encoding_mode(intel_output) && | ||
1964 | sdvo_priv->is_hdmi) { | ||
1965 | /* enable hdmi encoding mode if supported */ | ||
1966 | intel_sdvo_set_encode(intel_output, SDVO_ENCODE_HDMI); | ||
1967 | intel_sdvo_set_colorimetry(intel_output, | ||
1968 | SDVO_COLORIMETRY_RGB256); | ||
1969 | connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; | ||
1970 | } | ||
1971 | } else if (flags & SDVO_OUTPUT_SVID0) { | ||
1972 | |||
1973 | sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0; | ||
1974 | encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; | ||
1975 | connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; | ||
1976 | sdvo_priv->is_tv = true; | ||
1977 | intel_output->needs_tv_clock = true; | ||
1978 | } else if (flags & SDVO_OUTPUT_RGB0) { | ||
1979 | |||
1980 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; | ||
1981 | encoder->encoder_type = DRM_MODE_ENCODER_DAC; | ||
1982 | connector->connector_type = DRM_MODE_CONNECTOR_VGA; | ||
1983 | } else if (flags & SDVO_OUTPUT_RGB1) { | ||
1984 | |||
1985 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; | ||
1986 | encoder->encoder_type = DRM_MODE_ENCODER_DAC; | ||
1987 | connector->connector_type = DRM_MODE_CONNECTOR_VGA; | ||
1988 | } else if (flags & SDVO_OUTPUT_LVDS0) { | ||
1989 | |||
1990 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0; | ||
1991 | encoder->encoder_type = DRM_MODE_ENCODER_LVDS; | ||
1992 | connector->connector_type = DRM_MODE_CONNECTOR_LVDS; | ||
1993 | sdvo_priv->is_lvds = true; | ||
1994 | } else if (flags & SDVO_OUTPUT_LVDS1) { | ||
1995 | |||
1996 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; | ||
1997 | encoder->encoder_type = DRM_MODE_ENCODER_LVDS; | ||
1998 | connector->connector_type = DRM_MODE_CONNECTOR_LVDS; | ||
1999 | sdvo_priv->is_lvds = true; | ||
2000 | } else { | ||
2001 | |||
2002 | unsigned char bytes[2]; | ||
2003 | |||
2004 | sdvo_priv->controlled_output = 0; | ||
2005 | memcpy(bytes, &sdvo_priv->caps.output_flags, 2); | ||
2006 | DRM_DEBUG_KMS(I915_SDVO, | ||
2007 | "%s: Unknown SDVO output type (0x%02x%02x)\n", | ||
2008 | SDVO_NAME(sdvo_priv), | ||
2009 | bytes[0], bytes[1]); | ||
2010 | ret = false; | ||
2011 | } | ||
2012 | |||
2013 | if (ret && registered) | ||
2014 | ret = drm_sysfs_connector_add(connector) == 0 ? true : false; | ||
2015 | |||
2016 | |||
2017 | return ret; | ||
2018 | |||
2019 | } | ||
2020 | |||
1783 | bool intel_sdvo_init(struct drm_device *dev, int output_device) | 2021 | bool intel_sdvo_init(struct drm_device *dev, int output_device) |
1784 | { | 2022 | { |
1785 | struct drm_connector *connector; | 2023 | struct drm_connector *connector; |
1786 | struct intel_output *intel_output; | 2024 | struct intel_output *intel_output; |
1787 | struct intel_sdvo_priv *sdvo_priv; | 2025 | struct intel_sdvo_priv *sdvo_priv; |
1788 | struct intel_i2c_chan *i2cbus = NULL; | 2026 | |
1789 | struct intel_i2c_chan *ddcbus = NULL; | ||
1790 | int connector_type; | ||
1791 | u8 ch[0x40]; | 2027 | u8 ch[0x40]; |
1792 | int i; | 2028 | int i; |
1793 | int encoder_type, output_id; | ||
1794 | u8 slave_addr; | ||
1795 | 2029 | ||
1796 | intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL); | 2030 | intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL); |
1797 | if (!intel_output) { | 2031 | if (!intel_output) { |
@@ -1799,29 +2033,24 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1799 | } | 2033 | } |
1800 | 2034 | ||
1801 | sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1); | 2035 | sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1); |
2036 | sdvo_priv->output_device = output_device; | ||
2037 | |||
2038 | intel_output->dev_priv = sdvo_priv; | ||
1802 | intel_output->type = INTEL_OUTPUT_SDVO; | 2039 | intel_output->type = INTEL_OUTPUT_SDVO; |
1803 | 2040 | ||
1804 | /* setup the DDC bus. */ | 2041 | /* setup the DDC bus. */ |
1805 | if (output_device == SDVOB) | 2042 | if (output_device == SDVOB) |
1806 | i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB"); | 2043 | intel_output->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB"); |
1807 | else | 2044 | else |
1808 | i2cbus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC"); | 2045 | intel_output->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC"); |
1809 | 2046 | ||
1810 | if (!i2cbus) | 2047 | if (!intel_output->i2c_bus) |
1811 | goto err_inteloutput; | 2048 | goto err_inteloutput; |
1812 | 2049 | ||
1813 | slave_addr = intel_sdvo_get_slave_addr(dev, output_device); | 2050 | sdvo_priv->slave_addr = intel_sdvo_get_slave_addr(dev, output_device); |
1814 | sdvo_priv->i2c_bus = i2cbus; | ||
1815 | 2051 | ||
1816 | if (output_device == SDVOB) { | 2052 | /* Save the bit-banging i2c functionality for use by the DDC wrapper */ |
1817 | output_id = 1; | 2053 | intel_sdvo_i2c_bit_algo.functionality = intel_output->i2c_bus->algo->functionality; |
1818 | } else { | ||
1819 | output_id = 2; | ||
1820 | } | ||
1821 | sdvo_priv->i2c_bus->slave_addr = slave_addr >> 1; | ||
1822 | sdvo_priv->output_device = output_device; | ||
1823 | intel_output->i2c_bus = i2cbus; | ||
1824 | intel_output->dev_priv = sdvo_priv; | ||
1825 | 2054 | ||
1826 | /* Read the regs to test if we can talk to the device */ | 2055 | /* Read the regs to test if we can talk to the device */ |
1827 | for (i = 0; i < 0x40; i++) { | 2056 | for (i = 0; i < 0x40; i++) { |
@@ -1835,101 +2064,39 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1835 | 2064 | ||
1836 | /* setup the DDC bus. */ | 2065 | /* setup the DDC bus. */ |
1837 | if (output_device == SDVOB) | 2066 | if (output_device == SDVOB) |
1838 | ddcbus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); | 2067 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); |
1839 | else | 2068 | else |
1840 | ddcbus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); | 2069 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); |
1841 | 2070 | ||
1842 | if (ddcbus == NULL) | 2071 | if (intel_output->ddc_bus == NULL) |
1843 | goto err_i2c; | 2072 | goto err_i2c; |
1844 | 2073 | ||
1845 | intel_sdvo_i2c_bit_algo.functionality = | 2074 | /* Wrap with our custom algo which switches to DDC mode */ |
1846 | intel_output->i2c_bus->adapter.algo->functionality; | 2075 | intel_output->ddc_bus->algo = &intel_sdvo_i2c_bit_algo; |
1847 | ddcbus->adapter.algo = &intel_sdvo_i2c_bit_algo; | ||
1848 | intel_output->ddc_bus = ddcbus; | ||
1849 | 2076 | ||
1850 | /* In defaut case sdvo lvds is false */ | 2077 | /* In defaut case sdvo lvds is false */ |
1851 | sdvo_priv->is_lvds = false; | ||
1852 | intel_sdvo_get_capabilities(intel_output, &sdvo_priv->caps); | 2078 | intel_sdvo_get_capabilities(intel_output, &sdvo_priv->caps); |
1853 | 2079 | ||
1854 | if (sdvo_priv->caps.output_flags & | 2080 | if (intel_sdvo_output_setup(intel_output, |
1855 | (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) { | 2081 | sdvo_priv->caps.output_flags) != true) { |
1856 | if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS0) | 2082 | DRM_DEBUG("SDVO output failed to setup on SDVO%c\n", |
1857 | sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS0; | 2083 | output_device == SDVOB ? 'B' : 'C'); |
1858 | else | ||
1859 | sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1; | ||
1860 | |||
1861 | encoder_type = DRM_MODE_ENCODER_TMDS; | ||
1862 | connector_type = DRM_MODE_CONNECTOR_DVID; | ||
1863 | |||
1864 | if (intel_sdvo_get_supp_encode(intel_output, | ||
1865 | &sdvo_priv->encode) && | ||
1866 | intel_sdvo_get_digital_encoding_mode(intel_output) && | ||
1867 | sdvo_priv->is_hdmi) { | ||
1868 | /* enable hdmi encoding mode if supported */ | ||
1869 | intel_sdvo_set_encode(intel_output, SDVO_ENCODE_HDMI); | ||
1870 | intel_sdvo_set_colorimetry(intel_output, | ||
1871 | SDVO_COLORIMETRY_RGB256); | ||
1872 | connector_type = DRM_MODE_CONNECTOR_HDMIA; | ||
1873 | } | ||
1874 | } | ||
1875 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_SVID0) | ||
1876 | { | ||
1877 | sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0; | ||
1878 | encoder_type = DRM_MODE_ENCODER_TVDAC; | ||
1879 | connector_type = DRM_MODE_CONNECTOR_SVIDEO; | ||
1880 | sdvo_priv->is_tv = true; | ||
1881 | intel_output->needs_tv_clock = true; | ||
1882 | } | ||
1883 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0) | ||
1884 | { | ||
1885 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; | ||
1886 | encoder_type = DRM_MODE_ENCODER_DAC; | ||
1887 | connector_type = DRM_MODE_CONNECTOR_VGA; | ||
1888 | } | ||
1889 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1) | ||
1890 | { | ||
1891 | sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; | ||
1892 | encoder_type = DRM_MODE_ENCODER_DAC; | ||
1893 | connector_type = DRM_MODE_CONNECTOR_VGA; | ||
1894 | } | ||
1895 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS0) | ||
1896 | { | ||
1897 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0; | ||
1898 | encoder_type = DRM_MODE_ENCODER_LVDS; | ||
1899 | connector_type = DRM_MODE_CONNECTOR_LVDS; | ||
1900 | sdvo_priv->is_lvds = true; | ||
1901 | } | ||
1902 | else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS1) | ||
1903 | { | ||
1904 | sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1; | ||
1905 | encoder_type = DRM_MODE_ENCODER_LVDS; | ||
1906 | connector_type = DRM_MODE_CONNECTOR_LVDS; | ||
1907 | sdvo_priv->is_lvds = true; | ||
1908 | } | ||
1909 | else | ||
1910 | { | ||
1911 | unsigned char bytes[2]; | ||
1912 | |||
1913 | sdvo_priv->controlled_output = 0; | ||
1914 | memcpy (bytes, &sdvo_priv->caps.output_flags, 2); | ||
1915 | DRM_DEBUG_KMS(I915_SDVO, | ||
1916 | "%s: Unknown SDVO output type (0x%02x%02x)\n", | ||
1917 | SDVO_NAME(sdvo_priv), | ||
1918 | bytes[0], bytes[1]); | ||
1919 | encoder_type = DRM_MODE_ENCODER_NONE; | ||
1920 | connector_type = DRM_MODE_CONNECTOR_Unknown; | ||
1921 | goto err_i2c; | 2084 | goto err_i2c; |
1922 | } | 2085 | } |
1923 | 2086 | ||
2087 | |||
1924 | connector = &intel_output->base; | 2088 | connector = &intel_output->base; |
1925 | drm_connector_init(dev, connector, &intel_sdvo_connector_funcs, | 2089 | drm_connector_init(dev, connector, &intel_sdvo_connector_funcs, |
1926 | connector_type); | 2090 | connector->connector_type); |
2091 | |||
1927 | drm_connector_helper_add(connector, &intel_sdvo_connector_helper_funcs); | 2092 | drm_connector_helper_add(connector, &intel_sdvo_connector_helper_funcs); |
1928 | connector->interlace_allowed = 0; | 2093 | connector->interlace_allowed = 0; |
1929 | connector->doublescan_allowed = 0; | 2094 | connector->doublescan_allowed = 0; |
1930 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; | 2095 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; |
1931 | 2096 | ||
1932 | drm_encoder_init(dev, &intel_output->enc, &intel_sdvo_enc_funcs, encoder_type); | 2097 | drm_encoder_init(dev, &intel_output->enc, |
2098 | &intel_sdvo_enc_funcs, intel_output->enc.encoder_type); | ||
2099 | |||
1933 | drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs); | 2100 | drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs); |
1934 | 2101 | ||
1935 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); | 2102 | drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); |
@@ -1965,9 +2132,10 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device) | |||
1965 | return true; | 2132 | return true; |
1966 | 2133 | ||
1967 | err_i2c: | 2134 | err_i2c: |
1968 | if (ddcbus != NULL) | 2135 | if (intel_output->ddc_bus != NULL) |
1969 | intel_i2c_destroy(intel_output->ddc_bus); | 2136 | intel_i2c_destroy(intel_output->ddc_bus); |
1970 | intel_i2c_destroy(intel_output->i2c_bus); | 2137 | if (intel_output->i2c_bus != NULL) |
2138 | intel_i2c_destroy(intel_output->i2c_bus); | ||
1971 | err_inteloutput: | 2139 | err_inteloutput: |
1972 | kfree(intel_output); | 2140 | kfree(intel_output); |
1973 | 2141 | ||