Russell King | 7e435aa | 2014-06-15 11:07:12 +0100 | [diff] [blame] | 1 | #ifndef __DRM_OF_H__ |
| 2 | #define __DRM_OF_H__ |
| 3 | |
Philipp Zabel | 4cacf91 | 2015-02-24 11:34:01 +0100 | [diff] [blame] | 4 | #include <linux/of_graph.h> |
| 5 | |
Liviu Dudau | df785aa | 2015-10-20 10:23:12 +0100 | [diff] [blame] | 6 | struct component_master_ops; |
Russell King | 97ac0e4 | 2016-10-19 11:28:27 +0100 | [diff] [blame] | 7 | struct component_match; |
Liviu Dudau | df785aa | 2015-10-20 10:23:12 +0100 | [diff] [blame] | 8 | struct device; |
Russell King | 7e435aa | 2014-06-15 11:07:12 +0100 | [diff] [blame] | 9 | struct drm_device; |
Philipp Zabel | 4cacf91 | 2015-02-24 11:34:01 +0100 | [diff] [blame] | 10 | struct drm_encoder; |
Russell King | 7e435aa | 2014-06-15 11:07:12 +0100 | [diff] [blame] | 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); |
Russell King | 97ac0e4 | 2016-10-19 11:28:27 +0100 | [diff] [blame] | 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); |
Liviu Dudau | df785aa | 2015-10-20 10:23:12 +0100 | [diff] [blame] | 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); |
Philipp Zabel | 4cacf91 | 2015-02-24 11:34:01 +0100 | [diff] [blame] | 23 | extern int drm_of_encoder_active_endpoint(struct device_node *node, |
| 24 | struct drm_encoder *encoder, |
| 25 | struct of_endpoint *endpoint); |
Russell King | 7e435aa | 2014-06-15 11:07:12 +0100 | [diff] [blame] | 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 | } |
Liviu Dudau | df785aa | 2015-10-20 10:23:12 +0100 | [diff] [blame] | 32 | |
Arnd Bergmann | 329f4c8 | 2016-10-26 10:57:47 +0200 | [diff] [blame] | 33 | static inline void |
| 34 | drm_of_component_match_add(struct device *master, |
| 35 | struct component_match **matchptr, |
| 36 | int (*compare)(struct device *, void *), |
| 37 | struct device_node *node) |
Russell King | 97ac0e4 | 2016-10-19 11:28:27 +0100 | [diff] [blame] | 38 | { |
| 39 | } |
| 40 | |
Liviu Dudau | df785aa | 2015-10-20 10:23:12 +0100 | [diff] [blame] | 41 | static inline int |
| 42 | drm_of_component_probe(struct device *dev, |
| 43 | int (*compare_of)(struct device *, void *), |
| 44 | const struct component_master_ops *m_ops) |
| 45 | { |
| 46 | return -EINVAL; |
| 47 | } |
Philipp Zabel | 4cacf91 | 2015-02-24 11:34:01 +0100 | [diff] [blame] | 48 | |
| 49 | static inline int drm_of_encoder_active_endpoint(struct device_node *node, |
| 50 | struct drm_encoder *encoder, |
| 51 | struct of_endpoint *endpoint) |
| 52 | { |
| 53 | return -EINVAL; |
| 54 | } |
Russell King | 7e435aa | 2014-06-15 11:07:12 +0100 | [diff] [blame] | 55 | #endif |
| 56 | |
Philipp Zabel | 4cacf91 | 2015-02-24 11:34:01 +0100 | [diff] [blame] | 57 | static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, |
| 58 | struct drm_encoder *encoder) |
| 59 | { |
| 60 | struct of_endpoint endpoint; |
| 61 | int ret = drm_of_encoder_active_endpoint(node, encoder, |
| 62 | &endpoint); |
| 63 | |
| 64 | return ret ?: endpoint.id; |
| 65 | } |
| 66 | |
| 67 | static inline int drm_of_encoder_active_port_id(struct device_node *node, |
| 68 | struct drm_encoder *encoder) |
| 69 | { |
| 70 | struct of_endpoint endpoint; |
| 71 | int ret = drm_of_encoder_active_endpoint(node, encoder, |
| 72 | &endpoint); |
| 73 | |
| 74 | return ret ?: endpoint.port; |
| 75 | } |
| 76 | |
Russell King | 7e435aa | 2014-06-15 11:07:12 +0100 | [diff] [blame] | 77 | #endif /* __DRM_OF_H__ */ |