]>
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; |
1f2db303 RH |
11 | struct drm_panel; |
12 | struct drm_bridge; | |
7e435aad RK |
13 | struct device_node; |
14 | ||
15 | #ifdef CONFIG_OF | |
91faa047 DV |
16 | uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, |
17 | struct device_node *port); | |
18 | void drm_of_component_match_add(struct device *master, | |
19 | struct component_match **matchptr, | |
20 | int (*compare)(struct device *, void *), | |
21 | struct device_node *node); | |
22 | int drm_of_component_probe(struct device *dev, | |
23 | int (*compare_of)(struct device *, void *), | |
24 | const struct component_master_ops *m_ops); | |
25 | int drm_of_encoder_active_endpoint(struct device_node *node, | |
26 | struct drm_encoder *encoder, | |
27 | struct of_endpoint *endpoint); | |
1f2db303 RH |
28 | int drm_of_find_panel_or_bridge(const struct device_node *np, |
29 | int port, int endpoint, | |
30 | struct drm_panel **panel, | |
31 | struct drm_bridge **bridge); | |
c70087e8 | 32 | int drm_of_panel_bridge_remove(const struct device_node *np, |
33 | int port, int endpoint); | |
7e435aad RK |
34 | #else |
35 | static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, | |
36 | struct device_node *port) | |
37 | { | |
38 | return 0; | |
39 | } | |
df785aa8 | 40 | |
329f4c81 AB |
41 | static inline void |
42 | drm_of_component_match_add(struct device *master, | |
43 | struct component_match **matchptr, | |
44 | int (*compare)(struct device *, void *), | |
45 | struct device_node *node) | |
97ac0e47 RK |
46 | { |
47 | } | |
48 | ||
df785aa8 LD |
49 | static inline int |
50 | drm_of_component_probe(struct device *dev, | |
51 | int (*compare_of)(struct device *, void *), | |
52 | const struct component_master_ops *m_ops) | |
53 | { | |
54 | return -EINVAL; | |
55 | } | |
4cacf91f PZ |
56 | |
57 | static inline int drm_of_encoder_active_endpoint(struct device_node *node, | |
58 | struct drm_encoder *encoder, | |
59 | struct of_endpoint *endpoint) | |
60 | { | |
61 | return -EINVAL; | |
62 | } | |
1f2db303 RH |
63 | static inline int drm_of_find_panel_or_bridge(const struct device_node *np, |
64 | int port, int endpoint, | |
65 | struct drm_panel **panel, | |
66 | struct drm_bridge **bridge) | |
67 | { | |
68 | return -EINVAL; | |
69 | } | |
c70087e8 | 70 | |
71 | static inline int drm_of_panel_bridge_remove(const struct device_node *np, | |
72 | int port, int endpoint) | |
73 | { | |
74 | return -EINVAL; | |
75 | } | |
7e435aad RK |
76 | #endif |
77 | ||
4cacf91f PZ |
78 | static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, |
79 | struct drm_encoder *encoder) | |
80 | { | |
81 | struct of_endpoint endpoint; | |
82 | int ret = drm_of_encoder_active_endpoint(node, encoder, | |
83 | &endpoint); | |
84 | ||
85 | return ret ?: endpoint.id; | |
86 | } | |
87 | ||
88 | static inline int drm_of_encoder_active_port_id(struct device_node *node, | |
89 | struct drm_encoder *encoder) | |
90 | { | |
91 | struct of_endpoint endpoint; | |
92 | int ret = drm_of_encoder_active_endpoint(node, encoder, | |
93 | &endpoint); | |
94 | ||
95 | return ret ?: endpoint.port; | |
96 | } | |
97 | ||
7e435aad | 98 | #endif /* __DRM_OF_H__ */ |