]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - include/drm/drm_of.h
drm/bridge: add Silicon Image SiI8620 driver
[mirror_ubuntu-focal-kernel.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;
7e435aad
RK
11struct device_node;
12
13#ifdef CONFIG_OF
14extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
15 struct device_node *port);
97ac0e47
RK
16extern 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
20extern 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
23extern int drm_of_encoder_active_endpoint(struct device_node *node,
24 struct drm_encoder *encoder,
25 struct of_endpoint *endpoint);
7e435aad
RK
26#else
27static 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
33static 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
40static inline int
41drm_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
48static 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
56static 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
66static 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__ */