| .. | .. |
|---|
| 26 | 26 | */ |
|---|
| 27 | 27 | |
|---|
| 28 | 28 | #include <linux/i2c.h> |
|---|
| 29 | | -#include <linux/slab.h> |
|---|
| 30 | 29 | #include <linux/module.h> |
|---|
| 31 | | -#include <drm/drmP.h> |
|---|
| 30 | +#include <linux/slab.h> |
|---|
| 31 | + |
|---|
| 32 | 32 | #include <drm/drm_crtc.h> |
|---|
| 33 | 33 | #include <drm/drm_crtc_helper.h> |
|---|
| 34 | +#include <drm/drm_dp_helper.h> |
|---|
| 35 | +#include <drm/drm_simple_kms_helper.h> |
|---|
| 36 | + |
|---|
| 37 | +#include "gma_display.h" |
|---|
| 34 | 38 | #include "psb_drv.h" |
|---|
| 35 | 39 | #include "psb_intel_drv.h" |
|---|
| 36 | 40 | #include "psb_intel_reg.h" |
|---|
| 37 | | -#include "gma_display.h" |
|---|
| 38 | | -#include <drm/drm_dp_helper.h> |
|---|
| 39 | 41 | |
|---|
| 40 | 42 | /** |
|---|
| 41 | 43 | * struct i2c_algo_dp_aux_data - driver interface structure for i2c over dp |
|---|
| .. | .. |
|---|
| 1270 | 1272 | return ((l >> s) & 3) << DP_TRAIN_PRE_EMPHASIS_SHIFT; |
|---|
| 1271 | 1273 | } |
|---|
| 1272 | 1274 | |
|---|
| 1273 | | - |
|---|
| 1274 | | -#if 0 |
|---|
| 1275 | | -static char *voltage_names[] = { |
|---|
| 1276 | | - "0.4V", "0.6V", "0.8V", "1.2V" |
|---|
| 1277 | | -}; |
|---|
| 1278 | | -static char *pre_emph_names[] = { |
|---|
| 1279 | | - "0dB", "3.5dB", "6dB", "9.5dB" |
|---|
| 1280 | | -}; |
|---|
| 1281 | | -static char *link_train_names[] = { |
|---|
| 1282 | | - "pattern 1", "pattern 2", "idle", "off" |
|---|
| 1283 | | -}; |
|---|
| 1284 | | -#endif |
|---|
| 1285 | | - |
|---|
| 1286 | 1275 | #define CDV_DP_VOLTAGE_MAX DP_TRAIN_VOLTAGE_SWING_LEVEL_3 |
|---|
| 1287 | | -/* |
|---|
| 1288 | | -static uint8_t |
|---|
| 1289 | | -cdv_intel_dp_pre_emphasis_max(uint8_t voltage_swing) |
|---|
| 1290 | | -{ |
|---|
| 1291 | | - switch (voltage_swing & DP_TRAIN_VOLTAGE_SWING_MASK) { |
|---|
| 1292 | | - case DP_TRAIN_VOLTAGE_SWING_400: |
|---|
| 1293 | | - return DP_TRAIN_PRE_EMPHASIS_6; |
|---|
| 1294 | | - case DP_TRAIN_VOLTAGE_SWING_600: |
|---|
| 1295 | | - return DP_TRAIN_PRE_EMPHASIS_6; |
|---|
| 1296 | | - case DP_TRAIN_VOLTAGE_SWING_800: |
|---|
| 1297 | | - return DP_TRAIN_PRE_EMPHASIS_3_5; |
|---|
| 1298 | | - case DP_TRAIN_VOLTAGE_SWING_1200: |
|---|
| 1299 | | - default: |
|---|
| 1300 | | - return DP_TRAIN_PRE_EMPHASIS_0; |
|---|
| 1301 | | - } |
|---|
| 1302 | | -} |
|---|
| 1303 | | -*/ |
|---|
| 1276 | + |
|---|
| 1304 | 1277 | static void |
|---|
| 1305 | 1278 | cdv_intel_get_adjust_train(struct gma_encoder *encoder) |
|---|
| 1306 | 1279 | { |
|---|
| .. | .. |
|---|
| 1593 | 1566 | { |
|---|
| 1594 | 1567 | struct drm_device *dev = encoder->base.dev; |
|---|
| 1595 | 1568 | struct cdv_intel_dp *intel_dp = encoder->dev_priv; |
|---|
| 1596 | | - bool channel_eq = false; |
|---|
| 1597 | 1569 | int tries, cr_tries; |
|---|
| 1598 | 1570 | u32 reg; |
|---|
| 1599 | 1571 | uint32_t DP = intel_dp->DP; |
|---|
| .. | .. |
|---|
| 1601 | 1573 | /* channel equalization */ |
|---|
| 1602 | 1574 | tries = 0; |
|---|
| 1603 | 1575 | cr_tries = 0; |
|---|
| 1604 | | - channel_eq = false; |
|---|
| 1605 | 1576 | |
|---|
| 1606 | 1577 | DRM_DEBUG_KMS("\n"); |
|---|
| 1607 | 1578 | reg = DP | DP_LINK_TRAIN_PAT_2; |
|---|
| .. | .. |
|---|
| 1647 | 1618 | |
|---|
| 1648 | 1619 | if (cdv_intel_channel_eq_ok(encoder)) { |
|---|
| 1649 | 1620 | DRM_DEBUG_KMS("PT2 train is done\n"); |
|---|
| 1650 | | - channel_eq = true; |
|---|
| 1651 | 1621 | break; |
|---|
| 1652 | 1622 | } |
|---|
| 1653 | 1623 | |
|---|
| .. | .. |
|---|
| 1910 | 1880 | kfree(connector); |
|---|
| 1911 | 1881 | } |
|---|
| 1912 | 1882 | |
|---|
| 1913 | | -static void cdv_intel_dp_encoder_destroy(struct drm_encoder *encoder) |
|---|
| 1914 | | -{ |
|---|
| 1915 | | - drm_encoder_cleanup(encoder); |
|---|
| 1916 | | -} |
|---|
| 1917 | | - |
|---|
| 1918 | 1883 | static const struct drm_encoder_helper_funcs cdv_intel_dp_helper_funcs = { |
|---|
| 1919 | 1884 | .dpms = cdv_intel_dp_dpms, |
|---|
| 1920 | 1885 | .mode_fixup = cdv_intel_dp_mode_fixup, |
|---|
| .. | .. |
|---|
| 1936 | 1901 | .mode_valid = cdv_intel_dp_mode_valid, |
|---|
| 1937 | 1902 | .best_encoder = gma_best_encoder, |
|---|
| 1938 | 1903 | }; |
|---|
| 1939 | | - |
|---|
| 1940 | | -static const struct drm_encoder_funcs cdv_intel_dp_enc_funcs = { |
|---|
| 1941 | | - .destroy = cdv_intel_dp_encoder_destroy, |
|---|
| 1942 | | -}; |
|---|
| 1943 | | - |
|---|
| 1944 | 1904 | |
|---|
| 1945 | 1905 | static void cdv_intel_dp_add_properties(struct drm_connector *connector) |
|---|
| 1946 | 1906 | { |
|---|
| .. | .. |
|---|
| 2018 | 1978 | encoder = &gma_encoder->base; |
|---|
| 2019 | 1979 | |
|---|
| 2020 | 1980 | drm_connector_init(dev, connector, &cdv_intel_dp_connector_funcs, type); |
|---|
| 2021 | | - drm_encoder_init(dev, encoder, &cdv_intel_dp_enc_funcs, |
|---|
| 2022 | | - DRM_MODE_ENCODER_TMDS, NULL); |
|---|
| 1981 | + drm_simple_encoder_init(dev, encoder, DRM_MODE_ENCODER_TMDS); |
|---|
| 2023 | 1982 | |
|---|
| 2024 | 1983 | gma_connector_attach_encoder(gma_connector, gma_encoder); |
|---|
| 2025 | 1984 | |
|---|
| .. | .. |
|---|
| 2122 | 2081 | if (ret <= 0) { |
|---|
| 2123 | 2082 | /* if this fails, presume the device is a ghost */ |
|---|
| 2124 | 2083 | DRM_INFO("failed to retrieve link info, disabling eDP\n"); |
|---|
| 2125 | | - cdv_intel_dp_encoder_destroy(encoder); |
|---|
| 2084 | + drm_encoder_cleanup(encoder); |
|---|
| 2126 | 2085 | cdv_intel_dp_destroy(connector); |
|---|
| 2127 | 2086 | goto err_connector; |
|---|
| 2128 | 2087 | } else { |
|---|