Commit | Line | Data |
---|---|---|
7e435aad RK |
1 | #ifndef __DRM_OF_H__ |
2 | #define __DRM_OF_H__ | |
3 | ||
4cacf91f PZ |
4 | #include <linux/of_graph.h> |
5 | ||
df785aa8 LD |
6 | struct component_master_ops; |
7 | struct device; | |
7e435aad | 8 | struct drm_device; |
4cacf91f | 9 | struct drm_encoder; |
7e435aad RK |
10 | struct device_node; |
11 | ||
12 | #ifdef CONFIG_OF | |
13 | extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | |
14 | struct device_node *port); | |
df785aa8 LD |
15 | extern int drm_of_component_probe(struct device *dev, |
16 | int (*compare_of)(struct device *, void *), | |
17 | const struct component_master_ops *m_ops); | |
4cacf91f PZ |
18 | extern int drm_of_encoder_active_endpoint(struct device_node *node, |
19 | struct drm_encoder *encoder, | |
20 | struct of_endpoint *endpoint); | |
7e435aad RK |
21 | #else |
22 | static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | |
23 | struct device_node *port) | |
24 | { | |
25 | return 0; | |
26 | } | |
df785aa8 LD |
27 | |
28 | static inline int | |
29 | drm_of_component_probe(struct device *dev, | |
30 | int (*compare_of)(struct device *, void *), | |
31 | const struct component_master_ops *m_ops) | |
32 | { | |
33 | return -EINVAL; | |
34 | } | |
4cacf91f PZ |
35 | |
36 | static inline int drm_of_encoder_active_endpoint(struct device_node *node, | |
37 | struct drm_encoder *encoder, | |
38 | struct of_endpoint *endpoint) | |
39 | { | |
40 | return -EINVAL; | |
41 | } | |
7e435aad RK |
42 | #endif |
43 | ||
4cacf91f PZ |
44 | static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, |
45 | struct drm_encoder *encoder) | |
46 | { | |
47 | struct of_endpoint endpoint; | |
48 | int ret = drm_of_encoder_active_endpoint(node, encoder, | |
49 | &endpoint); | |
50 | ||
51 | return ret ?: endpoint.id; | |
52 | } | |
53 | ||
54 | static inline int drm_of_encoder_active_port_id(struct device_node *node, | |
55 | struct drm_encoder *encoder) | |
56 | { | |
57 | struct of_endpoint endpoint; | |
58 | int ret = drm_of_encoder_active_endpoint(node, encoder, | |
59 | &endpoint); | |
60 | ||
61 | return ret ?: endpoint.port; | |
62 | } | |
63 | ||
7e435aad | 64 | #endif /* __DRM_OF_H__ */ |