]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/drm/drm_of.h
4 #include <linux/of_graph.h>
5 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
6 #include <drm/drm_bridge.h>
9 struct component_master_ops
;
10 struct component_match
;
19 uint32_t drm_of_find_possible_crtcs(struct drm_device
*dev
,
20 struct device_node
*port
);
21 void drm_of_component_match_add(struct device
*master
,
22 struct component_match
**matchptr
,
23 int (*compare
)(struct device
*, void *),
24 struct device_node
*node
);
25 int drm_of_component_probe(struct device
*dev
,
26 int (*compare_of
)(struct device
*, void *),
27 const struct component_master_ops
*m_ops
);
28 int drm_of_encoder_active_endpoint(struct device_node
*node
,
29 struct drm_encoder
*encoder
,
30 struct of_endpoint
*endpoint
);
31 int drm_of_find_panel_or_bridge(const struct device_node
*np
,
32 int port
, int endpoint
,
33 struct drm_panel
**panel
,
34 struct drm_bridge
**bridge
);
36 static inline uint32_t drm_of_find_possible_crtcs(struct drm_device
*dev
,
37 struct device_node
*port
)
43 drm_of_component_match_add(struct device
*master
,
44 struct component_match
**matchptr
,
45 int (*compare
)(struct device
*, void *),
46 struct device_node
*node
)
51 drm_of_component_probe(struct device
*dev
,
52 int (*compare_of
)(struct device
*, void *),
53 const struct component_master_ops
*m_ops
)
58 static inline int drm_of_encoder_active_endpoint(struct device_node
*node
,
59 struct drm_encoder
*encoder
,
60 struct of_endpoint
*endpoint
)
64 static inline int drm_of_find_panel_or_bridge(const struct device_node
*np
,
65 int port
, int endpoint
,
66 struct drm_panel
**panel
,
67 struct drm_bridge
**bridge
)
74 * drm_of_panel_bridge_remove - remove panel bridge
75 * @np: device tree node containing panel bridge output ports
77 * Remove the panel bridge of a given DT node's port and endpoint number
79 * Returns zero if successful, or one of the standard error codes if it fails.
81 static inline int drm_of_panel_bridge_remove(const struct device_node
*np
,
82 int port
, int endpoint
)
84 #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE)
85 struct drm_bridge
*bridge
;
86 struct device_node
*remote
;
88 remote
= of_graph_get_remote_node(np
, port
, endpoint
);
92 bridge
= of_drm_find_bridge(remote
);
93 drm_panel_bridge_remove(bridge
);
101 static inline int drm_of_encoder_active_endpoint_id(struct device_node
*node
,
102 struct drm_encoder
*encoder
)
104 struct of_endpoint endpoint
;
105 int ret
= drm_of_encoder_active_endpoint(node
, encoder
,
108 return ret
?: endpoint
.id
;
111 static inline int drm_of_encoder_active_port_id(struct device_node
*node
,
112 struct drm_encoder
*encoder
)
114 struct of_endpoint endpoint
;
115 int ret
= drm_of_encoder_active_endpoint(node
, encoder
,
118 return ret
?: endpoint
.port
;
121 #endif /* __DRM_OF_H__ */