aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drm_crtc.h
diff options
context:
space:
mode:
authorAjay Kumar <ajaykumar.rs@samsung.com>2015-01-20 11:38:44 -0500
committerThierry Reding <treding@nvidia.com>2015-01-28 02:45:40 -0500
commit3d3f8b1f8b62c3a010976269df454baa9246fc65 (patch)
tree855bd2b86afa52afbd7b872959789b028ff630ce /include/drm/drm_crtc.h
parentb07b90fd178a4797b0454ead491b717b41046bee (diff)
drm/bridge: make bridge registration independent of drm flow
Currently, third party bridge drivers(ptn3460) are dependent on the corresponding encoder driver init, since bridge driver needs a drm_device pointer to finish drm initializations. The encoder driver passes the drm_device pointer to the bridge driver. Because of this dependency, third party drivers like ptn3460 doesn't adhere to the driver model. In this patch, we reframe the bridge registration framework so that bridge initialization is split into 2 steps, and bridge registration happens independent of drm flow: --Step 1: gather all the bridge settings independent of drm and add the bridge onto a global list of bridges. --Step 2: when the encoder driver is probed, call drm_bridge_attach for the corresponding bridge so that the bridge receives drm_device pointer and continues with connector and other drm initializations. The old set of bridge helpers are removed, and a set of new helpers are added to accomplish the 2 step initialization. The bridge devices register themselves onto global list of bridges when they get probed by calling "drm_bridge_add". The parent encoder driver waits till the bridge is available in the lookup table(by calling "of_drm_find_bridge") and then continues with its initialization. The encoder driver should also call "drm_bridge_attach" to pass on the drm_device to the bridge object. drm_bridge_attach inturn calls "bridge->funcs->attach" so that bridge can continue with drm related initializations. Signed-off-by: Ajay Kumar <ajaykumar.rs@samsung.com> Acked-by: Inki Dae <inki.dae@samsung.com> Tested-by: Rahul Sharma <rahul.sharma@samsung.com> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Tested-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/drm/drm_crtc.h')
-rw-r--r--include/drm/drm_crtc.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 15bb762fb316..920e21a8f3fd 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -868,15 +868,16 @@ struct drm_plane {
868 868
869/** 869/**
870 * struct drm_bridge_funcs - drm_bridge control functions 870 * struct drm_bridge_funcs - drm_bridge control functions
871 * @attach: Called during drm_bridge_attach
871 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge 872 * @mode_fixup: Try to fixup (or reject entirely) proposed mode for this bridge
872 * @disable: Called right before encoder prepare, disables the bridge 873 * @disable: Called right before encoder prepare, disables the bridge
873 * @post_disable: Called right after encoder prepare, for lockstepped disable 874 * @post_disable: Called right after encoder prepare, for lockstepped disable
874 * @mode_set: Set this mode to the bridge 875 * @mode_set: Set this mode to the bridge
875 * @pre_enable: Called right before encoder commit, for lockstepped commit 876 * @pre_enable: Called right before encoder commit, for lockstepped commit
876 * @enable: Called right after encoder commit, enables the bridge 877 * @enable: Called right after encoder commit, enables the bridge
877 * @destroy: make object go away
878 */ 878 */
879struct drm_bridge_funcs { 879struct drm_bridge_funcs {
880 int (*attach)(struct drm_bridge *bridge);
880 bool (*mode_fixup)(struct drm_bridge *bridge, 881 bool (*mode_fixup)(struct drm_bridge *bridge,
881 const struct drm_display_mode *mode, 882 const struct drm_display_mode *mode,
882 struct drm_display_mode *adjusted_mode); 883 struct drm_display_mode *adjusted_mode);
@@ -887,22 +888,24 @@ struct drm_bridge_funcs {
887 struct drm_display_mode *adjusted_mode); 888 struct drm_display_mode *adjusted_mode);
888 void (*pre_enable)(struct drm_bridge *bridge); 889 void (*pre_enable)(struct drm_bridge *bridge);
889 void (*enable)(struct drm_bridge *bridge); 890 void (*enable)(struct drm_bridge *bridge);
890 void (*destroy)(struct drm_bridge *bridge);
891}; 891};
892 892
893/** 893/**
894 * struct drm_bridge - central DRM bridge control structure 894 * struct drm_bridge - central DRM bridge control structure
895 * @dev: DRM device this bridge belongs to 895 * @dev: DRM device this bridge belongs to
896 * @head: list management 896 * @of_node: device node pointer to the bridge
897 * @list: to keep track of all added bridges
897 * @base: base mode object 898 * @base: base mode object
898 * @funcs: control functions 899 * @funcs: control functions
899 * @driver_private: pointer to the bridge driver's internal context 900 * @driver_private: pointer to the bridge driver's internal context
900 */ 901 */
901struct drm_bridge { 902struct drm_bridge {
902 struct drm_device *dev; 903 struct drm_device *dev;
903 struct list_head head; 904 struct drm_encoder *encoder;
904 905#ifdef CONFIG_OF
905 struct drm_mode_object base; 906 struct device_node *of_node;
907#endif
908 struct list_head list;
906 909
907 const struct drm_bridge_funcs *funcs; 910 const struct drm_bridge_funcs *funcs;
908 void *driver_private; 911 void *driver_private;
@@ -1007,7 +1010,6 @@ struct drm_mode_group {
1007 uint32_t num_crtcs; 1010 uint32_t num_crtcs;
1008 uint32_t num_encoders; 1011 uint32_t num_encoders;
1009 uint32_t num_connectors; 1012 uint32_t num_connectors;
1010 uint32_t num_bridges;
1011 1013
1012 /* list of object IDs for this group */ 1014 /* list of object IDs for this group */
1013 uint32_t *id_list; 1015 uint32_t *id_list;
@@ -1026,8 +1028,6 @@ struct drm_mode_group {
1026 * @fb_list: list of framebuffers available 1028 * @fb_list: list of framebuffers available
1027 * @num_connector: number of connectors on this device 1029 * @num_connector: number of connectors on this device
1028 * @connector_list: list of connector objects 1030 * @connector_list: list of connector objects
1029 * @num_bridge: number of bridges on this device
1030 * @bridge_list: list of bridge objects
1031 * @num_encoder: number of encoders on this device 1031 * @num_encoder: number of encoders on this device
1032 * @encoder_list: list of encoder objects 1032 * @encoder_list: list of encoder objects
1033 * @num_overlay_plane: number of overlay planes on this device 1033 * @num_overlay_plane: number of overlay planes on this device
@@ -1072,8 +1072,6 @@ struct drm_mode_config {
1072 1072
1073 int num_connector; 1073 int num_connector;
1074 struct list_head connector_list; 1074 struct list_head connector_list;
1075 int num_bridge;
1076 struct list_head bridge_list;
1077 int num_encoder; 1075 int num_encoder;
1078 struct list_head encoder_list; 1076 struct list_head encoder_list;
1079 1077
@@ -1222,8 +1220,10 @@ extern unsigned int drm_connector_index(struct drm_connector *connector);
1222/* helper to unplug all connectors from sysfs for device */ 1220/* helper to unplug all connectors from sysfs for device */
1223extern void drm_connector_unplug_all(struct drm_device *dev); 1221extern void drm_connector_unplug_all(struct drm_device *dev);
1224 1222
1225extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge); 1223extern int drm_bridge_add(struct drm_bridge *bridge);
1226extern void drm_bridge_cleanup(struct drm_bridge *bridge); 1224extern void drm_bridge_remove(struct drm_bridge *bridge);
1225extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
1226extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge);
1227 1227
1228extern int drm_encoder_init(struct drm_device *dev, 1228extern int drm_encoder_init(struct drm_device *dev,
1229 struct drm_encoder *encoder, 1229 struct drm_encoder *encoder,