]>
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 | 6 | struct component_master_ops; |
97ac0e47 | 7 | struct component_match; |
df785aa8 | 8 | struct device; |
7e435aad | 9 | struct drm_device; |
4cacf91f | 10 | struct drm_encoder; |
7e435aad RK |
11 | struct device_node; |
12 | ||
13 | #ifdef CONFIG_OF | |
14 | extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | |
15 | struct device_node *port); | |
97ac0e47 RK |
16 | extern void drm_of_component_match_add(struct device *master, |
17 | struct component_match **matchptr, | |
18 | int (*compare)(struct device *, void *), | |
19 | struct device_node *node); | |
df785aa8 LD |
20 | extern int drm_of_component_probe(struct device *dev, |
21 | int (*compare_of)(struct device *, void *), | |
22 | const struct component_master_ops *m_ops); | |
4cacf91f PZ |
23 | extern int drm_of_encoder_active_endpoint(struct device_node *node, |
24 | struct drm_encoder *encoder, | |
25 | struct of_endpoint *endpoint); | |
7e435aad RK |
26 | #else |
27 | static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | |
28 | struct device_node *port) | |
29 | { | |
30 | return 0; | |
31 | } | |
df785aa8 | 32 | |
97ac0e47 RK |
33 | static void drm_of_component_match_add(struct device *master, |
34 | struct component_match **matchptr, | |
35 | int (*compare)(struct device *, void *), | |
36 | struct device_node *node) | |
37 | { | |
38 | } | |
39 | ||
df785aa8 LD |
40 | static inline int |
41 | drm_of_component_probe(struct device *dev, | |
42 | int (*compare_of)(struct device *, void *), | |
43 | const struct component_master_ops *m_ops) | |
44 | { | |
45 | return -EINVAL; | |
46 | } | |
4cacf91f PZ |
47 | |
48 | static inline int drm_of_encoder_active_endpoint(struct device_node *node, | |
49 | struct drm_encoder *encoder, | |
50 | struct of_endpoint *endpoint) | |
51 | { | |
52 | return -EINVAL; | |
53 | } | |
7e435aad RK |
54 | #endif |
55 | ||
4cacf91f PZ |
56 | static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, |
57 | struct drm_encoder *encoder) | |
58 | { | |
59 | struct of_endpoint endpoint; | |
60 | int ret = drm_of_encoder_active_endpoint(node, encoder, | |
61 | &endpoint); | |
62 | ||
63 | return ret ?: endpoint.id; | |
64 | } | |
65 | ||
66 | static inline int drm_of_encoder_active_port_id(struct device_node *node, | |
67 | struct drm_encoder *encoder) | |
68 | { | |
69 | struct of_endpoint endpoint; | |
70 | int ret = drm_of_encoder_active_endpoint(node, encoder, | |
71 | &endpoint); | |
72 | ||
73 | return ret ?: endpoint.port; | |
74 | } | |
75 | ||
7e435aad | 76 | #endif /* __DRM_OF_H__ */ |