]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - include/drm/drm_of.h
drm/atomic-helper: Fix reference to drm_crtc_send_vblank_event()
[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;
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);
c70087e8 32int drm_of_panel_bridge_remove(const struct device_node *np,
33 int port, int endpoint);
7e435aad
RK
34#else
35static 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
41static inline void
42drm_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
49static inline int
50drm_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
57static 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
63static 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
71static 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
78static 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
88static 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__ */