drm_of.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __DRM_OF_H__
  2. #define __DRM_OF_H__
  3. #include <linux/of_graph.h>
  4. struct component_master_ops;
  5. struct device;
  6. struct drm_device;
  7. struct drm_encoder;
  8. struct device_node;
  9. #ifdef CONFIG_OF
  10. extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
  11. struct device_node *port);
  12. extern int drm_of_component_probe(struct device *dev,
  13. int (*compare_of)(struct device *, void *),
  14. const struct component_master_ops *m_ops);
  15. extern int drm_of_encoder_active_endpoint(struct device_node *node,
  16. struct drm_encoder *encoder,
  17. struct of_endpoint *endpoint);
  18. #else
  19. static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
  20. struct device_node *port)
  21. {
  22. return 0;
  23. }
  24. static inline int
  25. drm_of_component_probe(struct device *dev,
  26. int (*compare_of)(struct device *, void *),
  27. const struct component_master_ops *m_ops)
  28. {
  29. return -EINVAL;
  30. }
  31. static inline int drm_of_encoder_active_endpoint(struct device_node *node,
  32. struct drm_encoder *encoder,
  33. struct of_endpoint *endpoint)
  34. {
  35. return -EINVAL;
  36. }
  37. #endif
  38. static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
  39. struct drm_encoder *encoder)
  40. {
  41. struct of_endpoint endpoint;
  42. int ret = drm_of_encoder_active_endpoint(node, encoder,
  43. &endpoint);
  44. return ret ?: endpoint.id;
  45. }
  46. static inline int drm_of_encoder_active_port_id(struct device_node *node,
  47. struct drm_encoder *encoder)
  48. {
  49. struct of_endpoint endpoint;
  50. int ret = drm_of_encoder_active_endpoint(node, encoder,
  51. &endpoint);
  52. return ret ?: endpoint.port;
  53. }
  54. #endif /* __DRM_OF_H__ */