clk: rockchip: fix up the clock controller for rk3328
[firefly-linux-kernel-4.4.55.git] / include / drm / drm_crtc.h
index 9c37e6bd301c8ddcf92066fabb06ca4eca43dda3..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 {
@@ -1224,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);
@@ -1509,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);