17e435aadSRussell King #ifndef __DRM_OF_H__ 27e435aadSRussell King #define __DRM_OF_H__ 37e435aadSRussell King 44cacf91fSPhilipp Zabel #include <linux/of_graph.h> 54cacf91fSPhilipp Zabel 6df785aa8SLiviu Dudau struct component_master_ops; 7*97ac0e47SRussell King struct component_match; 8df785aa8SLiviu Dudau struct device; 97e435aadSRussell King struct drm_device; 104cacf91fSPhilipp Zabel struct drm_encoder; 117e435aadSRussell King struct device_node; 127e435aadSRussell King 137e435aadSRussell King #ifdef CONFIG_OF 147e435aadSRussell King extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, 157e435aadSRussell King struct device_node *port); 16*97ac0e47SRussell King extern void drm_of_component_match_add(struct device *master, 17*97ac0e47SRussell King struct component_match **matchptr, 18*97ac0e47SRussell King int (*compare)(struct device *, void *), 19*97ac0e47SRussell King struct device_node *node); 20df785aa8SLiviu Dudau extern int drm_of_component_probe(struct device *dev, 21df785aa8SLiviu Dudau int (*compare_of)(struct device *, void *), 22df785aa8SLiviu Dudau const struct component_master_ops *m_ops); 234cacf91fSPhilipp Zabel extern int drm_of_encoder_active_endpoint(struct device_node *node, 244cacf91fSPhilipp Zabel struct drm_encoder *encoder, 254cacf91fSPhilipp Zabel struct of_endpoint *endpoint); 267e435aadSRussell King #else 277e435aadSRussell King static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev, 287e435aadSRussell King struct device_node *port) 297e435aadSRussell King { 307e435aadSRussell King return 0; 317e435aadSRussell King } 32df785aa8SLiviu Dudau 33*97ac0e47SRussell King static void drm_of_component_match_add(struct device *master, 34*97ac0e47SRussell King struct component_match **matchptr, 35*97ac0e47SRussell King int (*compare)(struct device *, void *), 36*97ac0e47SRussell King struct device_node *node) 37*97ac0e47SRussell King { 38*97ac0e47SRussell King } 39*97ac0e47SRussell King 40df785aa8SLiviu Dudau static inline int 41df785aa8SLiviu Dudau drm_of_component_probe(struct device *dev, 42df785aa8SLiviu Dudau int (*compare_of)(struct device *, void *), 43df785aa8SLiviu Dudau const struct component_master_ops *m_ops) 44df785aa8SLiviu Dudau { 45df785aa8SLiviu Dudau return -EINVAL; 46df785aa8SLiviu Dudau } 474cacf91fSPhilipp Zabel 484cacf91fSPhilipp Zabel static inline int drm_of_encoder_active_endpoint(struct device_node *node, 494cacf91fSPhilipp Zabel struct drm_encoder *encoder, 504cacf91fSPhilipp Zabel struct of_endpoint *endpoint) 514cacf91fSPhilipp Zabel { 524cacf91fSPhilipp Zabel return -EINVAL; 534cacf91fSPhilipp Zabel } 547e435aadSRussell King #endif 557e435aadSRussell King 564cacf91fSPhilipp Zabel static inline int drm_of_encoder_active_endpoint_id(struct device_node *node, 574cacf91fSPhilipp Zabel struct drm_encoder *encoder) 584cacf91fSPhilipp Zabel { 594cacf91fSPhilipp Zabel struct of_endpoint endpoint; 604cacf91fSPhilipp Zabel int ret = drm_of_encoder_active_endpoint(node, encoder, 614cacf91fSPhilipp Zabel &endpoint); 624cacf91fSPhilipp Zabel 634cacf91fSPhilipp Zabel return ret ?: endpoint.id; 644cacf91fSPhilipp Zabel } 654cacf91fSPhilipp Zabel 664cacf91fSPhilipp Zabel static inline int drm_of_encoder_active_port_id(struct device_node *node, 674cacf91fSPhilipp Zabel struct drm_encoder *encoder) 684cacf91fSPhilipp Zabel { 694cacf91fSPhilipp Zabel struct of_endpoint endpoint; 704cacf91fSPhilipp Zabel int ret = drm_of_encoder_active_endpoint(node, encoder, 714cacf91fSPhilipp Zabel &endpoint); 724cacf91fSPhilipp Zabel 734cacf91fSPhilipp Zabel return ret ?: endpoint.port; 744cacf91fSPhilipp Zabel } 754cacf91fSPhilipp Zabel 767e435aadSRussell King #endif /* __DRM_OF_H__ */ 77