drm_of.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #ifndef __DRM_OF_H__
  2. #define __DRM_OF_H__
  3. #include <linux/of_graph.h>
  4. struct component_master_ops;
  5. struct component_match;
  6. struct device;
  7. struct drm_device;
  8. struct drm_encoder;
  9. struct drm_panel;
  10. struct drm_bridge;
  11. struct device_node;
  12. #ifdef CONFIG_OF
  13. uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
  14. struct device_node *port);
  15. void drm_of_component_match_add(struct device *master,
  16. struct component_match **matchptr,
  17. int (*compare)(struct device *, void *),
  18. struct device_node *node);
  19. int drm_of_component_probe(struct device *dev,
  20. int (*compare_of)(struct device *, void *),
  21. const struct component_master_ops *m_ops);
  22. int drm_of_encoder_active_endpoint(struct device_node *node,
  23. struct drm_encoder *encoder,
  24. struct of_endpoint *endpoint);
  25. int drm_of_find_panel_or_bridge(const struct device_node *np,
  26. int port, int endpoint,
  27. struct drm_panel **panel,
  28. struct drm_bridge **bridge);
  29. #else
  30. static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
  31. struct device_node *port)
  32. {
  33. return 0;
  34. }
  35. static inline void
  36. drm_of_component_match_add(struct device *master,
  37. struct component_match **matchptr,
  38. int (*compare)(struct device *, void *),
  39. struct device_node *node)
  40. {
  41. }
  42. static inline int
  43. drm_of_component_probe(struct device *dev,
  44. int (*compare_of)(struct device *, void *),
  45. const struct component_master_ops *m_ops)
  46. {
  47. return -EINVAL;
  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. }
  55. static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
  56. int port, int endpoint,
  57. struct drm_panel **panel,
  58. struct drm_bridge **bridge)
  59. {
  60. return -EINVAL;
  61. }
  62. #endif
  63. static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
  64. struct drm_encoder *encoder)
  65. {
  66. struct of_endpoint endpoint;
  67. int ret = drm_of_encoder_active_endpoint(node, encoder,
  68. &endpoint);
  69. return ret ?: endpoint.id;
  70. }
  71. static inline int drm_of_encoder_active_port_id(struct device_node *node,
  72. struct drm_encoder *encoder)
  73. {
  74. struct of_endpoint endpoint;
  75. int ret = drm_of_encoder_active_endpoint(node, encoder,
  76. &endpoint);
  77. return ret ?: endpoint.port;
  78. }
  79. #endif /* __DRM_OF_H__ */