Merge branch 'overlayfs-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszer...
[linux-2.6-block.git] / include / drm / drm_of.h
CommitLineData
7e435aad
RK
1#ifndef __DRM_OF_H__
2#define __DRM_OF_H__
3
4cacf91f
PZ
4#include <linux/of_graph.h>
5
df785aa8 6struct component_master_ops;
97ac0e47 7struct component_match;
df785aa8 8struct device;
7e435aad 9struct drm_device;
4cacf91f 10struct drm_encoder;
1f2db303
RH
11struct drm_panel;
12struct drm_bridge;
7e435aad
RK
13struct device_node;
14
15#ifdef CONFIG_OF
91faa047
DV
16uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
17 struct device_node *port);
18void drm_of_component_match_add(struct device *master,
19 struct component_match **matchptr,
20 int (*compare)(struct device *, void *),
21 struct device_node *node);
22int drm_of_component_probe(struct device *dev,
23 int (*compare_of)(struct device *, void *),
24 const struct component_master_ops *m_ops);
25int drm_of_encoder_active_endpoint(struct device_node *node,
26 struct drm_encoder *encoder,
27 struct of_endpoint *endpoint);
1f2db303
RH
28int 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);
7e435aad
RK
32#else
33static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
34 struct device_node *port)
35{
36 return 0;
37}
df785aa8 38
329f4c81
AB
39static inline void
40drm_of_component_match_add(struct device *master,
41 struct component_match **matchptr,
42 int (*compare)(struct device *, void *),
43 struct device_node *node)
97ac0e47
RK
44{
45}
46
df785aa8
LD
47static inline int
48drm_of_component_probe(struct device *dev,
49 int (*compare_of)(struct device *, void *),
50 const struct component_master_ops *m_ops)
51{
52 return -EINVAL;
53}
4cacf91f
PZ
54
55static inline int drm_of_encoder_active_endpoint(struct device_node *node,
56 struct drm_encoder *encoder,
57 struct of_endpoint *endpoint)
58{
59 return -EINVAL;
60}
1f2db303
RH
61static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
62 int port, int endpoint,
63 struct drm_panel **panel,
64 struct drm_bridge **bridge)
65{
66 return -EINVAL;
67}
7e435aad
RK
68#endif
69
4cacf91f
PZ
70static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
71 struct drm_encoder *encoder)
72{
73 struct of_endpoint endpoint;
74 int ret = drm_of_encoder_active_endpoint(node, encoder,
75 &endpoint);
76
77 return ret ?: endpoint.id;
78}
79
80static inline int drm_of_encoder_active_port_id(struct device_node *node,
81 struct drm_encoder *encoder)
82{
83 struct of_endpoint endpoint;
84 int ret = drm_of_encoder_active_endpoint(node, encoder,
85 &endpoint);
86
87 return ret ?: endpoint.port;
88}
89
7e435aad 90#endif /* __DRM_OF_H__ */