clk: rockchip: fix up the clock controller for rk3328
[firefly-linux-kernel-4.4.55.git] / include / drm / drm_crtc.h
index 3f0c6909dda17f9ec14959353a440da171a87ca6..f525cb578b08f4901d457d5de4ee11abfc645524 100644 (file)
@@ -391,6 +391,32 @@ struct drm_crtc_funcs {
                                   const struct drm_crtc_state *state,
                                   struct drm_property *property,
                                   uint64_t *val);
+
+       /**
+        * @late_register:
+        *
+        * This optional hook can be used to register additional userspace
+        * interfaces attached to the crtc like debugfs interfaces.
+        * It is called late in the driver load sequence from drm_dev_register().
+        * Everything added from this callback should be unregistered in
+        * the early_unregister callback.
+        *
+        * Returns:
+        *
+        * 0 on success, or a negative error code on failure.
+        */
+       int (*late_register)(struct drm_crtc *crtc);
+
+       /**
+        * @early_unregister:
+        *
+        * This optional hook should be used to unregister the additional
+        * userspace interfaces attached to the crtc from
+        * late_unregister(). It is called from drm_dev_unregister(),
+        * early in the driver unload sequence to disable userspace access
+        * before data structures are torndown.
+        */
+       void (*early_unregister)(struct drm_crtc *crtc);
 };
 
 /**
@@ -532,6 +558,34 @@ struct drm_connector_funcs {
        int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
        int (*set_property)(struct drm_connector *connector, struct drm_property *property,
                             uint64_t val);
+
+       /**
+        * @late_register:
+        *
+        * This optional hook can be used to register additional userspace
+        * interfaces attached to the connector, light backlight control, i2c,
+        * DP aux or similar interfaces. It is called late in the driver load
+        * sequence from drm_connector_register() when registering all the
+        * core drm connector interfaces. Everything added from this callback
+        * should be unregistered in the early_unregister callback.
+        *
+        * Returns:
+        *
+        * 0 on success, or a negative error code on failure.
+        */
+       int (*late_register)(struct drm_connector *connector);
+
+       /**
+        * @early_unregister:
+        *
+        * This optional hook should be used to unregister the additional
+        * userspace interfaces attached to the connector from
+        * late_unregister(). It is called from drm_connector_unregister(),
+        * early in the driver unload sequence to disable userspace access
+        * before data structures are torndown.
+        */
+       void (*early_unregister)(struct drm_connector *connector);
+
        void (*destroy)(struct drm_connector *connector);
        void (*force)(struct drm_connector *connector);
 
@@ -559,6 +613,32 @@ struct drm_connector_funcs {
 struct drm_encoder_funcs {
        void (*reset)(struct drm_encoder *encoder);
        void (*destroy)(struct drm_encoder *encoder);
+
+       /**
+        * @late_register:
+        *
+        * This optional hook can be used to register additional userspace
+        * interfaces attached to the encoder like debugfs interfaces.
+        * It is called late in the driver load sequence from drm_dev_register().
+        * Everything added from this callback should be unregistered in
+        * the early_unregister callback.
+        *
+        * Returns:
+        *
+        * 0 on success, or a negative error code on failure.
+        */
+       int (*late_register)(struct drm_encoder *encoder);
+
+       /**
+        * @early_unregister:
+        *
+        * This optional hook should be used to unregister the additional
+        * userspace interfaces attached to the encoder from
+        * late_unregister(). It is called from drm_dev_unregister(),
+        * early in the driver unload sequence to disable userspace access
+        * before data structures are torndown.
+        */
+       void (*early_unregister)(struct drm_encoder *encoder);
 };
 
 #define DRM_CONNECTOR_MAX_ENCODER 3
@@ -610,6 +690,7 @@ struct drm_encoder {
 /**
  * struct drm_connector - central DRM connector control structure
  * @dev: parent DRM device
+ * @port: OF node used by find connector by node.
  * @kdev: kernel device for sysfs attributes
  * @attr: sysfs attributes
  * @head: list management
@@ -664,6 +745,7 @@ struct drm_encoder {
  */
 struct drm_connector {
        struct drm_device *dev;
+       struct device_node *port;
        struct device *kdev;
        struct device_attribute *attr;
        struct list_head head;
@@ -706,6 +788,7 @@ struct drm_connector {
        bool override_edid;
        uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
        struct drm_encoder *encoder; /* currently active encoder */
+       bool loader_protect;
 
        /* EDID bits */
        uint8_t eld[MAX_ELD_BYTES];
@@ -816,6 +899,31 @@ struct drm_plane_funcs {
                                   const struct drm_plane_state *state,
                                   struct drm_property *property,
                                   uint64_t *val);
+       /**
+        * @late_register:
+        *
+        * This optional hook can be used to register additional userspace
+        * interfaces attached to the plane like debugfs interfaces.
+        * It is called late in the driver load sequence from drm_dev_register().
+        * Everything added from this callback should be unregistered in
+        * the early_unregister callback.
+        *
+        * Returns:
+        *
+        * 0 on success, or a negative error code on failure.
+        */
+       int (*late_register)(struct drm_plane *plane);
+
+       /**
+        * @early_unregister:
+        *
+        * This optional hook should be used to unregister the additional
+        * userspace interfaces attached to the plane from
+        * late_unregister(). It is called from drm_dev_unregister(),
+        * early in the driver unload sequence to disable userspace access
+        * before data structures are torndown.
+        */
+       void (*early_unregister)(struct drm_plane *plane);
 };
 
 enum drm_plane_type {
@@ -827,6 +935,7 @@ enum drm_plane_type {
 /**
  * struct drm_plane - central DRM plane control structure
  * @dev: DRM device this plane belongs to
+ * @parent: this plane share some resources with parent plane.
  * @head: for list management
  * @base: base mode object
  * @possible_crtcs: pipes this plane can be bound to
@@ -844,6 +953,7 @@ enum drm_plane_type {
  */
 struct drm_plane {
        struct drm_device *dev;
+       struct drm_plane *parent;
        struct list_head head;
 
        struct drm_modeset_lock mutex;
@@ -1074,6 +1184,8 @@ struct drm_mode_config {
         */
        int num_overlay_plane;
        int num_total_plane;
+       int num_share_plane;
+       int num_share_overlay_plane;
        struct list_head plane_list;
 
        int num_crtc;
@@ -1094,6 +1206,10 @@ struct drm_mode_config {
 
        struct mutex blob_lock;
 
+       /* pointers to share properties */
+       struct drm_property *prop_share_id;
+       struct drm_property *prop_share_flags;
+
        /* pointers to standard properties */
        struct list_head property_blob_list;
        struct drm_property *edid_property;
@@ -1183,11 +1299,13 @@ struct drm_prop_enum_list {
        char *name;
 };
 
-extern int drm_crtc_init_with_planes(struct drm_device *dev,
-                                    struct drm_crtc *crtc,
-                                    struct drm_plane *primary,
-                                    struct drm_plane *cursor,
-                                    const struct drm_crtc_funcs *funcs);
+extern __printf(6, 7)
+int drm_crtc_init_with_planes(struct drm_device *dev,
+                             struct drm_crtc *crtc,
+                             struct drm_plane *primary,
+                             struct drm_plane *cursor,
+                             const struct drm_crtc_funcs *funcs,
+                             const char *name, ...);
 extern void drm_crtc_cleanup(struct drm_crtc *crtc);
 extern unsigned int drm_crtc_index(struct drm_crtc *crtc);
 
@@ -1214,8 +1332,10 @@ void drm_connector_unregister(struct drm_connector *connector);
 
 extern void drm_connector_cleanup(struct drm_connector *connector);
 extern unsigned int drm_connector_index(struct drm_connector *connector);
-/* helper to unplug all connectors from sysfs for device */
-extern void drm_connector_unplug_all(struct drm_device *dev);
+
+/* helpers to {un}register all connectors from sysfs for device */
+extern int drm_connector_register_all(struct drm_device *dev);
+extern void drm_connector_unregister_all(struct drm_device *dev);
 
 extern int drm_bridge_add(struct drm_bridge *bridge);
 extern void drm_bridge_remove(struct drm_bridge *bridge);
@@ -1233,10 +1353,11 @@ void drm_bridge_mode_set(struct drm_bridge *bridge,
 void drm_bridge_pre_enable(struct drm_bridge *bridge);
 void drm_bridge_enable(struct drm_bridge *bridge);
 
-extern int drm_encoder_init(struct drm_device *dev,
-                           struct drm_encoder *encoder,
-                           const struct drm_encoder_funcs *funcs,
-                           int encoder_type);
+extern __printf(5, 6)
+int drm_encoder_init(struct drm_device *dev,
+                    struct drm_encoder *encoder,
+                    const struct drm_encoder_funcs *funcs,
+                    int encoder_type, const char *name, ...);
 
 /**
  * drm_encoder_crtc_ok - can a given crtc drive a given encoder?
@@ -1251,19 +1372,28 @@ static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
        return !!(encoder->possible_crtcs & drm_crtc_mask(crtc));
 }
 
-extern int drm_universal_plane_init(struct drm_device *dev,
-                                   struct drm_plane *plane,
-                                   unsigned long possible_crtcs,
-                                   const struct drm_plane_funcs *funcs,
-                                   const uint32_t *formats,
-                                   unsigned int format_count,
-                                   enum drm_plane_type type);
+extern __printf(8, 9)
+int drm_universal_plane_init(struct drm_device *dev,
+                            struct drm_plane *plane,
+                            unsigned long possible_crtcs,
+                            const struct drm_plane_funcs *funcs,
+                            const uint32_t *formats,
+                            unsigned int format_count,
+                            enum drm_plane_type type,
+                            const char *name, ...);
 extern int drm_plane_init(struct drm_device *dev,
                          struct drm_plane *plane,
                          unsigned long possible_crtcs,
                          const struct drm_plane_funcs *funcs,
                          const uint32_t *formats, unsigned int format_count,
                          bool is_primary);
+extern int drm_share_plane_init(struct drm_device *dev, struct drm_plane *plane,
+                               struct drm_plane *parent,
+                               unsigned long possible_crtcs,
+                               const struct drm_plane_funcs *funcs,
+                               const uint32_t *formats,
+                               unsigned int format_count,
+                               enum drm_plane_type type);
 extern void drm_plane_cleanup(struct drm_plane *plane);
 extern unsigned int drm_plane_index(struct drm_plane *plane);
 extern struct drm_plane * drm_plane_from_index(struct drm_device *dev, int idx);
@@ -1489,6 +1619,7 @@ extern int drm_mode_atomic_ioctl(struct drm_device *dev,
 extern void drm_fb_get_bpp_depth(uint32_t format, unsigned int *depth,
                                 int *bpp);
 extern int drm_format_num_planes(uint32_t format);
+extern int drm_format_plane_bpp(uint32_t format, int plane);
 extern int drm_format_plane_cpp(uint32_t format, int plane);
 extern int drm_format_horz_chroma_subsampling(uint32_t format);
 extern int drm_format_vert_chroma_subsampling(uint32_t format);