Merge tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel...
authorDave Airlie <airlied@redhat.com>
Wed, 11 Mar 2015 02:15:06 +0000 (12:15 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 11 Mar 2015 02:15:06 +0000 (12:15 +1000)
Another pile of misc drm patches all over, mostly polish for atomic. Last
minute rebase was to avoid the broken merge.

* tag 'topic/drm-misc-2015-03-10' of git://anongit.freedesktop.org/drm-intel:
  drm: Check in setcrtc if the primary plane supports the fb pixel format
  drm: Lighten sysfs connector 'status'
  drm/plane-helper: unexport drm_primary_helper_create_plane
  drm: Share plane pixel format check code between legacy and atomic
  drm: Fix trivial typos in comments
  drm/dp: add DPCD definitions from eDP 1.4
  drm/dp: add DPCD definitions from DP 1.1 and 1.2a
  drm: Fixup racy refcounting in plane_force_disable
  drm/i915: Rotation property is now handled in DRM core
  drm: Complete moving rotation property to core
  drm/dp: add DPCD definitions from eDP 1.2
  drm/dp: indentation and ordering cleanups
  drm/atomic-helper: Fix kerneldoc for prepare_planes
  drm: Remove redundant code in the getencoder ioctl

drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/drm_plane_helper.c
drivers/gpu/drm/drm_sysfs.c
drivers/gpu/drm/i2c/adv7511.c
drivers/gpu/drm/i915/intel_atomic_plane.c
include/drm/drm_crtc.h
include/drm/drm_dp_helper.h
include/drm/drm_plane_helper.h

index 321e098ddf04091c29605c5d9ca725007f8d6d2e..a6caaae40b9ebc25e26b80e7071f240431b3f31b 100644 (file)
@@ -450,6 +450,8 @@ drm_atomic_plane_get_property(struct drm_plane *plane,
                *val = state->src_w;
        } else if (property == config->prop_src_h) {
                *val = state->src_h;
+       } else if (property == config->rotation_property) {
+               *val = state->rotation;
        } else if (plane->funcs->atomic_get_property) {
                return plane->funcs->atomic_get_property(plane, state, property, val);
        } else {
@@ -473,7 +475,7 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
                struct drm_plane_state *state)
 {
        unsigned int fb_width, fb_height;
-       unsigned int i;
+       int ret;
 
        /* either *both* CRTC and FB must be set, or neither */
        if (WARN_ON(state->crtc && !state->fb)) {
@@ -495,13 +497,11 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
        }
 
        /* Check whether this plane supports the fb pixel format. */
-       for (i = 0; i < plane->format_count; i++)
-               if (state->fb->pixel_format == plane->format_types[i])
-                       break;
-       if (i == plane->format_count) {
+       ret = drm_plane_check_pixel_format(plane, state->fb->pixel_format);
+       if (ret) {
                DRM_DEBUG_ATOMIC("Invalid pixel format %s\n",
                                 drm_get_format_name(state->fb->pixel_format));
-               return -EINVAL;
+               return ret;
        }
 
        /* Give drivers some help against integer overflows */
index 7715c40d4e742746642376d121c1d42a743a72ac..a7458813af2b8b7dcf81ccca746f0e8ae6d60634 100644 (file)
@@ -1096,9 +1096,9 @@ EXPORT_SYMBOL(drm_atomic_helper_commit);
  */
 
 /**
- * drm_atomic_helper_prepare_planes - prepare plane resources after commit
+ * drm_atomic_helper_prepare_planes - prepare plane resources before commit
  * @dev: DRM device
- * @state: atomic state object with old state structures
+ * @state: atomic state object with new state structures
  *
  * This function prepares plane state, specifically framebuffers, for the new
  * configuration. If any failure is encountered this function will call
index 927f3445ff3861ba923ec08abd0f34346e13b45c..5785336695ca5330641e4362940b16a8dfe0483b 100644 (file)
@@ -524,17 +524,6 @@ void drm_framebuffer_reference(struct drm_framebuffer *fb)
 }
 EXPORT_SYMBOL(drm_framebuffer_reference);
 
-static void drm_framebuffer_free_bug(struct kref *kref)
-{
-       BUG();
-}
-
-static void __drm_framebuffer_unreference(struct drm_framebuffer *fb)
-{
-       DRM_DEBUG("%p: FB ID: %d (%d)\n", fb, fb->base.id, atomic_read(&fb->refcount.refcount));
-       kref_put(&fb->refcount, drm_framebuffer_free_bug);
-}
-
 /**
  * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr
  * @fb: fb to unregister
@@ -1319,7 +1308,7 @@ void drm_plane_force_disable(struct drm_plane *plane)
                return;
        }
        /* disconnect the plane from the fb and crtc: */
-       __drm_framebuffer_unreference(plane->old_fb);
+       drm_framebuffer_unreference(plane->old_fb);
        plane->old_fb = NULL;
        plane->fb = NULL;
        plane->crtc = NULL;
@@ -2285,8 +2274,6 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
        crtc = drm_encoder_get_crtc(encoder);
        if (crtc)
                enc_resp->crtc_id = crtc->base.id;
-       else if (encoder->crtc)
-               enc_resp->crtc_id = encoder->crtc->base.id;
        else
                enc_resp->crtc_id = 0;
        drm_modeset_unlock(&dev->mode_config.connection_mutex);
@@ -2421,6 +2408,27 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
        return 0;
 }
 
+/**
+ * drm_plane_check_pixel_format - Check if the plane supports the pixel format
+ * @plane: plane to check for format support
+ * @format: the pixel format
+ *
+ * Returns:
+ * Zero of @plane has @format in its list of supported pixel formats, -EINVAL
+ * otherwise.
+ */
+int drm_plane_check_pixel_format(const struct drm_plane *plane, u32 format)
+{
+       unsigned int i;
+
+       for (i = 0; i < plane->format_count; i++) {
+               if (format == plane->format_types[i])
+                       return 0;
+       }
+
+       return -EINVAL;
+}
+
 /*
  * setplane_internal - setplane handler for internal callers
  *
@@ -2441,7 +2449,6 @@ static int __setplane_internal(struct drm_plane *plane,
 {
        int ret = 0;
        unsigned int fb_width, fb_height;
-       unsigned int i;
 
        /* No fb means shut it down */
        if (!fb) {
@@ -2464,13 +2471,10 @@ static int __setplane_internal(struct drm_plane *plane,
        }
 
        /* Check whether this plane supports the fb pixel format. */
-       for (i = 0; i < plane->format_count; i++)
-               if (fb->pixel_format == plane->format_types[i])
-                       break;
-       if (i == plane->format_count) {
+       ret = drm_plane_check_pixel_format(plane, fb->pixel_format);
+       if (ret) {
                DRM_DEBUG_KMS("Invalid pixel format %s\n",
                              drm_get_format_name(fb->pixel_format));
-               ret = -EINVAL;
                goto out;
        }
 
@@ -2794,6 +2798,23 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
 
                drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
 
+               /*
+                * Check whether the primary plane supports the fb pixel format.
+                * Drivers not implementing the universal planes API use a
+                * default formats list provided by the DRM core which doesn't
+                * match real hardware capabilities. Skip the check in that
+                * case.
+                */
+               if (!crtc->primary->format_default) {
+                       ret = drm_plane_check_pixel_format(crtc->primary,
+                                                          fb->pixel_format);
+                       if (ret) {
+                               DRM_DEBUG_KMS("Invalid pixel format %s\n",
+                                       drm_get_format_name(fb->pixel_format));
+                               goto out;
+                       }
+               }
+
                ret = drm_crtc_check_viewport(crtc, crtc_req->x, crtc_req->y,
                                              mode, fb);
                if (ret)
index 487d0e35c134d1fde06338be6c913da66abfa123..2cca85f23138bf7a173a0f6f1204ccb5194533fc 100644 (file)
@@ -278,7 +278,7 @@ struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay,
                hblank = drm_mode->hdisplay * hblank_percentage /
                         (100 * HV_FACTOR - hblank_percentage);
                hblank -= hblank % (2 * CVT_H_GRANULARITY);
-               /* 14. find the total pixes per line */
+               /* 14. find the total pixels per line */
                drm_mode->htotal = drm_mode->hdisplay + hblank;
                drm_mode->hsync_end = drm_mode->hdisplay + hblank / 2;
                drm_mode->hsync_start = drm_mode->hsync_end -
@@ -1209,7 +1209,7 @@ EXPORT_SYMBOL(drm_mode_connector_list_update);
  *     <xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]
  *
  * The intermediate drm_cmdline_mode structure is required to store additional
- * options from the command line modline like the force-enabel/disable flag.
+ * options from the command line modline like the force-enable/disable flag.
  *
  * Returns:
  * True if a valid modeline has been parsed, false otherwise.
index 813a06627eb33ea3908d225271d6c72ebba5c973..b62b036350503c8eb70dee380342b097b796c2c7 100644 (file)
@@ -344,20 +344,7 @@ const struct drm_plane_funcs drm_primary_helper_funcs = {
 };
 EXPORT_SYMBOL(drm_primary_helper_funcs);
 
-/**
- * drm_primary_helper_create_plane() - Create a generic primary plane
- * @dev: drm device
- * @formats: pixel formats supported, or NULL for a default safe list
- * @num_formats: size of @formats; ignored if @formats is NULL
- *
- * Allocates and initializes a primary plane that can be used with the primary
- * plane helpers.  Drivers that wish to use driver-specific plane structures or
- * provide custom handler functions may perform their own allocation and
- * initialization rather than calling this function.
- */
-struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
-                                                 const uint32_t *formats,
-                                                 int num_formats)
+static struct drm_plane *create_primary_plane(struct drm_device *dev)
 {
        struct drm_plane *primary;
        int ret;
@@ -366,17 +353,18 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
        if (primary == NULL) {
                DRM_DEBUG_KMS("Failed to allocate primary plane\n");
                return NULL;
-       }
-
-       if (formats == NULL) {
-               formats = safe_modeset_formats;
-               num_formats = ARRAY_SIZE(safe_modeset_formats);
+               /*
+                * Remove the format_default field from drm_plane when dropping
+                * this helper.
+                */
+               primary->format_default = true;
        }
 
        /* possible_crtc's will be filled in later by crtc_init */
        ret = drm_universal_plane_init(dev, primary, 0,
                                       &drm_primary_helper_funcs,
-                                      formats, num_formats,
+                                      safe_modeset_formats,
+                                      ARRAY_SIZE(safe_modeset_formats),
                                       DRM_PLANE_TYPE_PRIMARY);
        if (ret) {
                kfree(primary);
@@ -385,7 +373,6 @@ struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
 
        return primary;
 }
-EXPORT_SYMBOL(drm_primary_helper_create_plane);
 
 /**
  * drm_crtc_init - Legacy CRTC initialization function
@@ -404,7 +391,7 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
 {
        struct drm_plane *primary;
 
-       primary = drm_primary_helper_create_plane(dev, NULL, 0);
+       primary = create_primary_plane(dev);
        return drm_crtc_init_with_planes(dev, crtc, primary, NULL, funcs);
 }
 EXPORT_SYMBOL(drm_crtc_init);
index 5c99d3773212a92928fb31c2b198f440a6e6a0b4..ffc305fc20768c29af6883eeb2d70553839cfa6e 100644 (file)
@@ -166,23 +166,68 @@ void drm_sysfs_destroy(void)
 /*
  * Connector properties
  */
-static ssize_t status_show(struct device *device,
+static ssize_t status_store(struct device *device,
                           struct device_attribute *attr,
-                          char *buf)
+                          const char *buf, size_t count)
 {
        struct drm_connector *connector = to_drm_connector(device);
-       enum drm_connector_status status;
+       struct drm_device *dev = connector->dev;
+       enum drm_connector_status old_status;
        int ret;
 
-       ret = mutex_lock_interruptible(&connector->dev->mode_config.mutex);
+       ret = mutex_lock_interruptible(&dev->mode_config.mutex);
        if (ret)
                return ret;
 
-       status = connector->funcs->detect(connector, true);
-       mutex_unlock(&connector->dev->mode_config.mutex);
+       old_status = connector->status;
+
+       if (sysfs_streq(buf, "detect")) {
+               connector->force = 0;
+               connector->status = connector->funcs->detect(connector, true);
+       } else if (sysfs_streq(buf, "on")) {
+               connector->force = DRM_FORCE_ON;
+       } else if (sysfs_streq(buf, "on-digital")) {
+               connector->force = DRM_FORCE_ON_DIGITAL;
+       } else if (sysfs_streq(buf, "off")) {
+               connector->force = DRM_FORCE_OFF;
+       } else
+               ret = -EINVAL;
+
+       if (ret == 0 && connector->force) {
+               if (connector->force == DRM_FORCE_ON ||
+                   connector->force == DRM_FORCE_ON_DIGITAL)
+                       connector->status = connector_status_connected;
+               else
+                       connector->status = connector_status_disconnected;
+               if (connector->funcs->force)
+                       connector->funcs->force(connector);
+       }
+
+       if (old_status != connector->status) {
+               DRM_DEBUG_KMS("[CONNECTOR:%d:%s] status updated from %d to %d\n",
+                             connector->base.id,
+                             connector->name,
+                             old_status, connector->status);
+
+               dev->mode_config.delayed_event = true;
+               if (dev->mode_config.poll_enabled)
+                       schedule_delayed_work(&dev->mode_config.output_poll_work,
+                                             0);
+       }
+
+       mutex_unlock(&dev->mode_config.mutex);
+
+       return ret;
+}
+
+static ssize_t status_show(struct device *device,
+                          struct device_attribute *attr,
+                          char *buf)
+{
+       struct drm_connector *connector = to_drm_connector(device);
 
        return snprintf(buf, PAGE_SIZE, "%s\n",
-                       drm_get_connector_status_name(status));
+                       drm_get_connector_status_name(connector->status));
 }
 
 static ssize_t dpms_show(struct device *device,
@@ -339,7 +384,7 @@ static ssize_t select_subconnector_show(struct device *device,
                        drm_get_dvi_i_select_name((int)subconnector));
 }
 
-static DEVICE_ATTR_RO(status);
+static DEVICE_ATTR_RW(status);
 static DEVICE_ATTR_RO(enabled);
 static DEVICE_ATTR_RO(dpms);
 static DEVICE_ATTR_RO(modes);
index fa140e04d5fa72f18237054c2b10f23f77355d83..61aa824d45d2115efe9dd716efee3e2e2785c6c9 100644 (file)
@@ -573,7 +573,7 @@ static void adv7511_encoder_dpms(struct drm_encoder *encoder, int mode)
                 * goes low the adv7511 is reset and the outputs are disabled
                 * which might cause the monitor to go to standby again. To
                 * avoid this we ignore the HDP pin for the first few seconds
-                * after enabeling the output.
+                * after enabling the output.
                 */
                regmap_update_bits(adv7511->regmap, ADV7511_REG_POWER2,
                                   ADV7511_REG_POWER2_HDP_SRC_MASK,
index 9e6f727dfd19d2fa5a536626db3abd81dbeaa3a9..976b8915657077ac6096151ece85834d638cd521 100644 (file)
@@ -203,16 +203,8 @@ intel_plane_atomic_get_property(struct drm_plane *plane,
                                struct drm_property *property,
                                uint64_t *val)
 {
-       struct drm_mode_config *config = &plane->dev->mode_config;
-
-       if (property == config->rotation_property) {
-               *val = state->rotation;
-       } else {
-               DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
-               return -EINVAL;
-       }
-
-       return 0;
+       DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
+       return -EINVAL;
 }
 
 /**
@@ -233,14 +225,6 @@ intel_plane_atomic_set_property(struct drm_plane *plane,
                                struct drm_property *property,
                                uint64_t val)
 {
-       struct drm_mode_config *config = &plane->dev->mode_config;
-
-       if (property == config->rotation_property) {
-               state->rotation = val;
-       } else {
-               DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
-               return -EINVAL;
-       }
-
-       return 0;
+       DRM_DEBUG_KMS("Unknown plane property '%s'\n", property->name);
+       return -EINVAL;
 }
index b1465d6fbe9467874fc37496d1bec0ddc86deef6..adc9ea5acf02ea45437268c16298a4dbbd9fe35a 100644 (file)
@@ -830,6 +830,7 @@ enum drm_plane_type {
  * @possible_crtcs: pipes this plane can be bound to
  * @format_types: array of formats supported by this plane
  * @format_count: number of formats supported
+ * @format_default: driver hasn't supplied supported formats for the plane
  * @crtc: currently bound CRTC
  * @fb: currently bound fb
  * @old_fb: Temporary tracking of the old fb while a modeset is ongoing. Used by
@@ -850,6 +851,7 @@ struct drm_plane {
        uint32_t possible_crtcs;
        uint32_t *format_types;
        uint32_t format_count;
+       bool format_default;
 
        struct drm_crtc *crtc;
        struct drm_framebuffer *fb;
@@ -1263,6 +1265,8 @@ extern int drm_plane_init(struct drm_device *dev,
 extern void drm_plane_cleanup(struct drm_plane *plane);
 extern unsigned int drm_plane_index(struct drm_plane *plane);
 extern void drm_plane_force_disable(struct drm_plane *plane);
+extern int drm_plane_check_pixel_format(const struct drm_plane *plane,
+                                       u32 format);
 extern void drm_crtc_get_hv_timing(const struct drm_display_mode *mode,
                                   int *hdisplay, int *vdisplay);
 extern int drm_crtc_check_viewport(const struct drm_crtc *crtc,
index d4803224028f37311e8ed4299e62b9de0e3cfb33..c5fdc2d3ca97275c36d86954d52b29b7e60c7f7b 100644 (file)
 # define DP_MSA_TIMING_PAR_IGNORED         (1 << 6) /* eDP */
 # define DP_OUI_SUPPORT                            (1 << 7)
 
-#define DP_SUPPORTED_LINK_RATES                        0x010 /*eDP 1.4*/
-#define DP_MAX_SUPPORTED_RATES                 0x8
+#define DP_RECEIVE_PORT_0_CAP_0                    0x008
+# define DP_LOCAL_EDID_PRESENT             (1 << 1)
+# define DP_ASSOCIATED_TO_PRECEDING_PORT    (1 << 2)
+
+#define DP_RECEIVE_PORT_0_BUFFER_SIZE      0x009
+
+#define DP_RECEIVE_PORT_1_CAP_0                    0x00a
+#define DP_RECEIVE_PORT_1_BUFFER_SIZE       0x00b
 
 #define DP_I2C_SPEED_CAP                   0x00c    /* DPI */
 # define DP_I2C_SPEED_1K                   0x01
 # define DP_I2C_SPEED_1M                   0x20
 
 #define DP_EDP_CONFIGURATION_CAP            0x00d   /* XXX 1.2? */
+# define DP_ALTERNATE_SCRAMBLER_RESET_CAP   (1 << 0)
+# define DP_FRAMING_CHANGE_CAP             (1 << 1)
 # define DP_DPCD_DISPLAY_CONTROL_CAPABLE     (1 << 3) /* edp v1.2 or higher */
+
 #define DP_TRAINING_AUX_RD_INTERVAL         0x00e   /* XXX 1.2? */
 
+#define DP_ADAPTER_CAP                     0x00f   /* 1.2 */
+# define DP_FORCE_LOAD_SENSE_CAP           (1 << 0)
+# define DP_ALTERNATE_I2C_PATTERN_CAP      (1 << 1)
+
+#define DP_SUPPORTED_LINK_RATES                    0x010 /* eDP 1.4 */
+# define DP_MAX_SUPPORTED_RATES                     8      /* 16-bit little-endian */
+
 /* Multiple stream transport */
 #define DP_FAUX_CAP                        0x020   /* 1.2 */
 # define DP_FAUX_CAP_1                     (1 << 0)
 #define DP_MSTM_CAP                        0x021   /* 1.2 */
 # define DP_MST_CAP                        (1 << 0)
 
+#define DP_NUMBER_OF_AUDIO_ENDPOINTS       0x022   /* 1.2 */
+
+/* AV_SYNC_DATA_BLOCK                                  1.2 */
+#define DP_AV_GRANULARITY                  0x023
+# define DP_AG_FACTOR_MASK                 (0xf << 0)
+# define DP_AG_FACTOR_3MS                  (0 << 0)
+# define DP_AG_FACTOR_2MS                  (1 << 0)
+# define DP_AG_FACTOR_1MS                  (2 << 0)
+# define DP_AG_FACTOR_500US                (3 << 0)
+# define DP_AG_FACTOR_200US                (4 << 0)
+# define DP_AG_FACTOR_100US                (5 << 0)
+# define DP_AG_FACTOR_10US                 (6 << 0)
+# define DP_AG_FACTOR_1US                  (7 << 0)
+# define DP_VG_FACTOR_MASK                 (0xf << 4)
+# define DP_VG_FACTOR_3MS                  (0 << 4)
+# define DP_VG_FACTOR_2MS                  (1 << 4)
+# define DP_VG_FACTOR_1MS                  (2 << 4)
+# define DP_VG_FACTOR_500US                (3 << 4)
+# define DP_VG_FACTOR_200US                (4 << 4)
+# define DP_VG_FACTOR_100US                (5 << 4)
+
+#define DP_AUD_DEC_LAT0                            0x024
+#define DP_AUD_DEC_LAT1                            0x025
+
+#define DP_AUD_PP_LAT0                     0x026
+#define DP_AUD_PP_LAT1                     0x027
+
+#define DP_VID_INTER_LAT                   0x028
+
+#define DP_VID_PROG_LAT                            0x029
+
+#define DP_REP_LAT                         0x02a
+
+#define DP_AUD_DEL_INS0                            0x02b
+#define DP_AUD_DEL_INS1                            0x02c
+#define DP_AUD_DEL_INS2                            0x02d
+/* End of AV_SYNC_DATA_BLOCK */
+
+#define DP_RECEIVER_ALPM_CAP               0x02e   /* eDP 1.4 */
+# define DP_ALPM_CAP                       (1 << 0)
+
+#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CAP   0x02f   /* eDP 1.4 */
+# define DP_AUX_FRAME_SYNC_CAP             (1 << 0)
+
 #define DP_GUID                                    0x030   /* 1.2 */
 
 #define DP_PSR_SUPPORT                      0x070   /* XXX 1.2? */
 # define DP_PSR_IS_SUPPORTED                1
+# define DP_PSR2_IS_SUPPORTED              2       /* eDP 1.4 */
+
 #define DP_PSR_CAPS                         0x071   /* XXX 1.2? */
 # define DP_PSR_NO_TRAIN_ON_EXIT            1
 # define DP_PSR_SETUP_TIME_330              (0 << 1)
 
 /* link configuration */
 #define        DP_LINK_BW_SET                      0x100
+# define DP_LINK_RATE_TABLE                0x00    /* eDP 1.4 */
 # define DP_LINK_BW_1_62                   0x06
 # define DP_LINK_BW_2_7                            0x0a
 # define DP_LINK_BW_5_4                            0x14    /* 1.2 */
 # define DP_TRAINING_PATTERN_3             3       /* 1.2 */
 # define DP_TRAINING_PATTERN_MASK          0x3
 
-# define DP_LINK_QUAL_PATTERN_DISABLE      (0 << 2)
-# define DP_LINK_QUAL_PATTERN_D10_2        (1 << 2)
-# define DP_LINK_QUAL_PATTERN_ERROR_RATE    (2 << 2)
-# define DP_LINK_QUAL_PATTERN_PRBS7        (3 << 2)
-# define DP_LINK_QUAL_PATTERN_MASK         (3 << 2)
+/* DPCD 1.1 only. For DPCD >= 1.2 see per-lane DP_LINK_QUAL_LANEn_SET */
+# define DP_LINK_QUAL_PATTERN_11_DISABLE    (0 << 2)
+# define DP_LINK_QUAL_PATTERN_11_D10_2     (1 << 2)
+# define DP_LINK_QUAL_PATTERN_11_ERROR_RATE (2 << 2)
+# define DP_LINK_QUAL_PATTERN_11_PRBS7     (3 << 2)
+# define DP_LINK_QUAL_PATTERN_11_MASK      (3 << 2)
 
 # define DP_RECOVERED_CLOCK_OUT_EN         (1 << 4)
 # define DP_LINK_SCRAMBLING_DISABLE        (1 << 5)
 /* bitmask as for DP_I2C_SPEED_CAP */
 
 #define DP_EDP_CONFIGURATION_SET            0x10a   /* XXX 1.2? */
+# define DP_ALTERNATE_SCRAMBLER_RESET_ENABLE (1 << 0)
+# define DP_FRAMING_CHANGE_ENABLE          (1 << 1)
+# define DP_PANEL_SELF_TEST_ENABLE         (1 << 7)
+
+#define DP_LINK_QUAL_LANE0_SET             0x10b   /* DPCD >= 1.2 */
+#define DP_LINK_QUAL_LANE1_SET             0x10c
+#define DP_LINK_QUAL_LANE2_SET             0x10d
+#define DP_LINK_QUAL_LANE3_SET             0x10e
+# define DP_LINK_QUAL_PATTERN_DISABLE      0
+# define DP_LINK_QUAL_PATTERN_D10_2        1
+# define DP_LINK_QUAL_PATTERN_ERROR_RATE    2
+# define DP_LINK_QUAL_PATTERN_PRBS7        3
+# define DP_LINK_QUAL_PATTERN_80BIT_CUSTOM  4
+# define DP_LINK_QUAL_PATTERN_HBR2_EYE      5
+# define DP_LINK_QUAL_PATTERN_MASK         7
+
+#define DP_TRAINING_LANE0_1_SET2           0x10f
+#define DP_TRAINING_LANE2_3_SET2           0x110
+# define DP_LANE02_POST_CURSOR2_SET_MASK    (3 << 0)
+# define DP_LANE02_MAX_POST_CURSOR2_REACHED (1 << 2)
+# define DP_LANE13_POST_CURSOR2_SET_MASK    (3 << 4)
+# define DP_LANE13_MAX_POST_CURSOR2_REACHED (1 << 6)
 
 #define DP_MSTM_CTRL                       0x111   /* 1.2 */
 # define DP_MST_EN                         (1 << 0)
 # define DP_UP_REQ_EN                      (1 << 1)
 # define DP_UPSTREAM_IS_SRC                (1 << 2)
 
-#define DP_LINK_RATE_SET                       0x115
+#define DP_AUDIO_DELAY0                            0x112   /* 1.2 */
+#define DP_AUDIO_DELAY1                            0x113
+#define DP_AUDIO_DELAY2                            0x114
+
+#define DP_LINK_RATE_SET                   0x115   /* eDP 1.4 */
+# define DP_LINK_RATE_SET_SHIFT                    0
+# define DP_LINK_RATE_SET_MASK             (7 << 0)
+
+#define DP_RECEIVER_ALPM_CONFIG                    0x116   /* eDP 1.4 */
+# define DP_ALPM_ENABLE                            (1 << 0)
+# define DP_ALPM_LOCK_ERROR_IRQ_HPD_ENABLE  (1 << 1)
+
+#define DP_SINK_DEVICE_AUX_FRAME_SYNC_CONF  0x117   /* eDP 1.4 */
+# define DP_AUX_FRAME_SYNC_ENABLE          (1 << 0)
+# define DP_IRQ_HPD_ENABLE                 (1 << 1)
+
+#define DP_UPSTREAM_DEVICE_DP_PWR_NEED     0x118   /* 1.2 */
+# define DP_PWR_NOT_NEEDED                 (1 << 0)
+
+#define DP_AUX_FRAME_SYNC_VALUE                    0x15c   /* eDP 1.4 */
+# define DP_AUX_FRAME_SYNC_VALID           (1 << 0)
 
 #define DP_PSR_EN_CFG                      0x170   /* XXX 1.2? */
 # define DP_PSR_ENABLE                     (1 << 0)
 # define DP_PSR_MAIN_LINK_ACTIVE           (1 << 1)
 # define DP_PSR_CRC_VERIFICATION           (1 << 2)
 # define DP_PSR_FRAME_CAPTURE              (1 << 3)
+# define DP_PSR_SELECTIVE_UPDATE           (1 << 4)
+# define DP_PSR_IRQ_HPD_WITH_CRC_ERRORS     (1 << 5)
 
 #define DP_ADAPTER_CTRL                            0x1a0
 # define DP_ADAPTER_CTRL_FORCE_LOAD_SENSE   (1 << 0)
 # define DP_SET_POWER_D3                    0x2
 # define DP_SET_POWER_MASK                  0x3
 
-#define DP_EDP_DPCD_REV                          0x700
+#define DP_EDP_DPCD_REV                            0x700    /* eDP 1.2 */
+# define DP_EDP_11                         0x00
+# define DP_EDP_12                         0x01
+# define DP_EDP_13                         0x02
+# define DP_EDP_14                         0x03
+
+#define DP_EDP_GENERAL_CAP_1               0x701
+
+#define DP_EDP_BACKLIGHT_ADJUSTMENT_CAP     0x702
+
+#define DP_EDP_GENERAL_CAP_2               0x703
+
+#define DP_EDP_GENERAL_CAP_3               0x704    /* eDP 1.4 */
+
+#define DP_EDP_DISPLAY_CONTROL_REGISTER     0x720
+
+#define DP_EDP_BACKLIGHT_MODE_SET_REGISTER  0x721
+
+#define DP_EDP_BACKLIGHT_BRIGHTNESS_MSB     0x722
+#define DP_EDP_BACKLIGHT_BRIGHTNESS_LSB     0x723
+
+#define DP_EDP_PWMGEN_BIT_COUNT             0x724
+#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MIN     0x725
+#define DP_EDP_PWMGEN_BIT_COUNT_CAP_MAX     0x726
+
+#define DP_EDP_BACKLIGHT_CONTROL_STATUS     0x727
+
+#define DP_EDP_BACKLIGHT_FREQ_SET           0x728
+
+#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MSB   0x72a
+#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_MID   0x72b
+#define DP_EDP_BACKLIGHT_FREQ_CAP_MIN_LSB   0x72c
+
+#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MSB   0x72d
+#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_MID   0x72e
+#define DP_EDP_BACKLIGHT_FREQ_CAP_MAX_LSB   0x72f
+
+#define DP_EDP_DBC_MINIMUM_BRIGHTNESS_SET   0x732
+#define DP_EDP_DBC_MAXIMUM_BRIGHTNESS_SET   0x733
+
+#define DP_EDP_REGIONAL_BACKLIGHT_BASE      0x740    /* eDP 1.4 */
+#define DP_EDP_REGIONAL_BACKLIGHT_0        0x741    /* eDP 1.4 */
 
 #define DP_SIDEBAND_MSG_DOWN_REQ_BASE      0x1000   /* 1.2 MST */
 #define DP_SIDEBAND_MSG_UP_REP_BASE        0x1200   /* 1.2 MST */
 #define DP_PSR_ERROR_STATUS                 0x2006  /* XXX 1.2? */
 # define DP_PSR_LINK_CRC_ERROR              (1 << 0)
 # define DP_PSR_RFB_STORAGE_ERROR           (1 << 1)
+# define DP_PSR_VSC_SDP_UNCORRECTABLE_ERROR (1 << 2) /* eDP 1.4 */
 
 #define DP_PSR_ESI                          0x2007  /* XXX 1.2? */
 # define DP_PSR_CAPS_CHANGE                 (1 << 0)
 # define DP_PSR_SINK_INTERNAL_ERROR         7
 # define DP_PSR_SINK_STATE_MASK             0x07
 
+#define DP_RECEIVER_ALPM_STATUS                    0x200b  /* eDP 1.4 */
+# define DP_ALPM_LOCK_TIMEOUT_ERROR        (1 << 0)
+
 /* DP 1.2 Sideband message defines */
 /* peer device type - DP 1.2a Table 2-92 */
 #define DP_PEER_DEVICE_NONE            0x0
index 72ddab02ebd920a4773fa20cb3df4c8252e15b01..e48157a5a59ccad82ab8498a4876c7fe208c3dfc 100644 (file)
@@ -100,10 +100,6 @@ extern int drm_primary_helper_update(struct drm_plane *plane,
 extern int drm_primary_helper_disable(struct drm_plane *plane);
 extern void drm_primary_helper_destroy(struct drm_plane *plane);
 extern const struct drm_plane_funcs drm_primary_helper_funcs;
-extern struct drm_plane *drm_primary_helper_create_plane(struct drm_device *dev,
-                                                        const uint32_t *formats,
-                                                        int num_formats);
-
 
 int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc,
                            struct drm_framebuffer *fb,