aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_sdvo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c52
1 files changed, 37 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 49482fd5b76c..a583e8f718a7 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -539,7 +539,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
539 goto log_fail; 539 goto log_fail;
540 540
541 while ((status == SDVO_CMD_STATUS_PENDING || 541 while ((status == SDVO_CMD_STATUS_PENDING ||
542 status == SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED) && --retry) { 542 status == SDVO_CMD_STATUS_TARGET_NOT_SPECIFIED) && --retry) {
543 if (retry < 10) 543 if (retry < 10)
544 msleep(15); 544 msleep(15);
545 else 545 else
@@ -1068,7 +1068,7 @@ intel_sdvo_get_preferred_input_mode(struct intel_sdvo *intel_sdvo,
1068 1068
1069static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_config *pipe_config) 1069static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_config *pipe_config)
1070{ 1070{
1071 unsigned dotclock = pipe_config->adjusted_mode.clock; 1071 unsigned dotclock = pipe_config->port_clock;
1072 struct dpll *clock = &pipe_config->dpll; 1072 struct dpll *clock = &pipe_config->dpll;
1073 1073
1074 /* SDVO TV has fixed PLL values depend on its clock range, 1074 /* SDVO TV has fixed PLL values depend on its clock range,
@@ -1133,7 +1133,6 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
1133 */ 1133 */
1134 pipe_config->pixel_multiplier = 1134 pipe_config->pixel_multiplier =
1135 intel_sdvo_get_pixel_multiplier(adjusted_mode); 1135 intel_sdvo_get_pixel_multiplier(adjusted_mode);
1136 adjusted_mode->clock *= pipe_config->pixel_multiplier;
1137 1136
1138 if (intel_sdvo->color_range_auto) { 1137 if (intel_sdvo->color_range_auto) {
1139 /* See CEA-861-E - 5.1 Default Encoding Parameters */ 1138 /* See CEA-861-E - 5.1 Default Encoding Parameters */
@@ -1217,11 +1216,7 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)
1217 !intel_sdvo_set_tv_format(intel_sdvo)) 1216 !intel_sdvo_set_tv_format(intel_sdvo))
1218 return; 1217 return;
1219 1218
1220 /* We have tried to get input timing in mode_fixup, and filled into
1221 * adjusted_mode.
1222 */
1223 intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); 1219 intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode);
1224 input_dtd.part1.clock /= crtc->config.pixel_multiplier;
1225 1220
1226 if (intel_sdvo->is_tv || intel_sdvo->is_lvds) 1221 if (intel_sdvo->is_tv || intel_sdvo->is_lvds)
1227 input_dtd.part2.sdvo_flags = intel_sdvo->dtd_sdvo_flags; 1222 input_dtd.part2.sdvo_flags = intel_sdvo->dtd_sdvo_flags;
@@ -1330,6 +1325,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
1330 struct intel_sdvo *intel_sdvo = to_sdvo(encoder); 1325 struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
1331 struct intel_sdvo_dtd dtd; 1326 struct intel_sdvo_dtd dtd;
1332 int encoder_pixel_multiplier = 0; 1327 int encoder_pixel_multiplier = 0;
1328 int dotclock;
1333 u32 flags = 0, sdvox; 1329 u32 flags = 0, sdvox;
1334 u8 val; 1330 u8 val;
1335 bool ret; 1331 bool ret;
@@ -1368,6 +1364,13 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
1368 >> SDVO_PORT_MULTIPLY_SHIFT) + 1; 1364 >> SDVO_PORT_MULTIPLY_SHIFT) + 1;
1369 } 1365 }
1370 1366
1367 dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
1368
1369 if (HAS_PCH_SPLIT(dev))
1370 ironlake_check_encoder_dotclock(pipe_config, dotclock);
1371
1372 pipe_config->adjusted_mode.crtc_clock = dotclock;
1373
1371 /* Cross check the port pixel multiplier with the sdvo encoder state. */ 1374 /* Cross check the port pixel multiplier with the sdvo encoder state. */
1372 if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_CLOCK_RATE_MULT, 1375 if (intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_CLOCK_RATE_MULT,
1373 &val, 1)) { 1376 &val, 1)) {
@@ -1770,6 +1773,9 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
1770{ 1773{
1771 struct edid *edid; 1774 struct edid *edid;
1772 1775
1776 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1777 connector->base.id, drm_get_connector_name(connector));
1778
1773 /* set the bus switch and get the modes */ 1779 /* set the bus switch and get the modes */
1774 edid = intel_sdvo_get_edid(connector); 1780 edid = intel_sdvo_get_edid(connector);
1775 1781
@@ -1865,6 +1871,9 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
1865 uint32_t reply = 0, format_map = 0; 1871 uint32_t reply = 0, format_map = 0;
1866 int i; 1872 int i;
1867 1873
1874 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1875 connector->base.id, drm_get_connector_name(connector));
1876
1868 /* Read the list of supported input resolutions for the selected TV 1877 /* Read the list of supported input resolutions for the selected TV
1869 * format. 1878 * format.
1870 */ 1879 */
@@ -1899,6 +1908,9 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
1899 struct drm_i915_private *dev_priv = connector->dev->dev_private; 1908 struct drm_i915_private *dev_priv = connector->dev->dev_private;
1900 struct drm_display_mode *newmode; 1909 struct drm_display_mode *newmode;
1901 1910
1911 DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
1912 connector->base.id, drm_get_connector_name(connector));
1913
1902 /* 1914 /*
1903 * Fetch modes from VBT. For SDVO prefer the VBT mode since some 1915 * Fetch modes from VBT. For SDVO prefer the VBT mode since some
1904 * SDVO->LVDS transcoders can't cope with the EDID mode. 1916 * SDVO->LVDS transcoders can't cope with the EDID mode.
@@ -1930,7 +1942,6 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
1930 break; 1942 break;
1931 } 1943 }
1932 } 1944 }
1933
1934} 1945}
1935 1946
1936static int intel_sdvo_get_modes(struct drm_connector *connector) 1947static int intel_sdvo_get_modes(struct drm_connector *connector)
@@ -1998,7 +2009,6 @@ static void intel_sdvo_destroy(struct drm_connector *connector)
1998 intel_sdvo_connector->tv_format); 2009 intel_sdvo_connector->tv_format);
1999 2010
2000 intel_sdvo_destroy_enhance_property(connector); 2011 intel_sdvo_destroy_enhance_property(connector);
2001 drm_sysfs_connector_remove(connector);
2002 drm_connector_cleanup(connector); 2012 drm_connector_cleanup(connector);
2003 kfree(intel_sdvo_connector); 2013 kfree(intel_sdvo_connector);
2004} 2014}
@@ -2394,7 +2404,9 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2394 struct intel_connector *intel_connector; 2404 struct intel_connector *intel_connector;
2395 struct intel_sdvo_connector *intel_sdvo_connector; 2405 struct intel_sdvo_connector *intel_sdvo_connector;
2396 2406
2397 intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); 2407 DRM_DEBUG_KMS("initialising DVI device %d\n", device);
2408
2409 intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL);
2398 if (!intel_sdvo_connector) 2410 if (!intel_sdvo_connector)
2399 return false; 2411 return false;
2400 2412
@@ -2442,7 +2454,9 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
2442 struct intel_connector *intel_connector; 2454 struct intel_connector *intel_connector;
2443 struct intel_sdvo_connector *intel_sdvo_connector; 2455 struct intel_sdvo_connector *intel_sdvo_connector;
2444 2456
2445 intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); 2457 DRM_DEBUG_KMS("initialising TV type %d\n", type);
2458
2459 intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL);
2446 if (!intel_sdvo_connector) 2460 if (!intel_sdvo_connector)
2447 return false; 2461 return false;
2448 2462
@@ -2467,6 +2481,7 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type)
2467 return true; 2481 return true;
2468 2482
2469err: 2483err:
2484 drm_sysfs_connector_remove(connector);
2470 intel_sdvo_destroy(connector); 2485 intel_sdvo_destroy(connector);
2471 return false; 2486 return false;
2472} 2487}
@@ -2479,7 +2494,9 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device)
2479 struct intel_connector *intel_connector; 2494 struct intel_connector *intel_connector;
2480 struct intel_sdvo_connector *intel_sdvo_connector; 2495 struct intel_sdvo_connector *intel_sdvo_connector;
2481 2496
2482 intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); 2497 DRM_DEBUG_KMS("initialising analog device %d\n", device);
2498
2499 intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL);
2483 if (!intel_sdvo_connector) 2500 if (!intel_sdvo_connector)
2484 return false; 2501 return false;
2485 2502
@@ -2510,7 +2527,9 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
2510 struct intel_connector *intel_connector; 2527 struct intel_connector *intel_connector;
2511 struct intel_sdvo_connector *intel_sdvo_connector; 2528 struct intel_sdvo_connector *intel_sdvo_connector;
2512 2529
2513 intel_sdvo_connector = kzalloc(sizeof(struct intel_sdvo_connector), GFP_KERNEL); 2530 DRM_DEBUG_KMS("initialising LVDS device %d\n", device);
2531
2532 intel_sdvo_connector = kzalloc(sizeof(*intel_sdvo_connector), GFP_KERNEL);
2514 if (!intel_sdvo_connector) 2533 if (!intel_sdvo_connector)
2515 return false; 2534 return false;
2516 2535
@@ -2534,6 +2553,7 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device)
2534 return true; 2553 return true;
2535 2554
2536err: 2555err:
2556 drm_sysfs_connector_remove(connector);
2537 intel_sdvo_destroy(connector); 2557 intel_sdvo_destroy(connector);
2538 return false; 2558 return false;
2539} 2559}
@@ -2605,8 +2625,10 @@ static void intel_sdvo_output_cleanup(struct intel_sdvo *intel_sdvo)
2605 2625
2606 list_for_each_entry_safe(connector, tmp, 2626 list_for_each_entry_safe(connector, tmp,
2607 &dev->mode_config.connector_list, head) { 2627 &dev->mode_config.connector_list, head) {
2608 if (intel_attached_encoder(connector) == &intel_sdvo->base) 2628 if (intel_attached_encoder(connector) == &intel_sdvo->base) {
2629 drm_sysfs_connector_remove(connector);
2609 intel_sdvo_destroy(connector); 2630 intel_sdvo_destroy(connector);
2631 }
2610 } 2632 }
2611} 2633}
2612 2634
@@ -2876,7 +2898,7 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2876 struct intel_encoder *intel_encoder; 2898 struct intel_encoder *intel_encoder;
2877 struct intel_sdvo *intel_sdvo; 2899 struct intel_sdvo *intel_sdvo;
2878 int i; 2900 int i;
2879 intel_sdvo = kzalloc(sizeof(struct intel_sdvo), GFP_KERNEL); 2901 intel_sdvo = kzalloc(sizeof(*intel_sdvo), GFP_KERNEL);
2880 if (!intel_sdvo) 2902 if (!intel_sdvo)
2881 return false; 2903 return false;
2882 2904