2014-06-15 18:07:12 +08:00
|
|
|
#ifndef __DRM_OF_H__
|
|
|
|
#define __DRM_OF_H__
|
|
|
|
|
2015-02-24 18:34:01 +08:00
|
|
|
#include <linux/of_graph.h>
|
|
|
|
|
2015-10-20 17:23:12 +08:00
|
|
|
struct component_master_ops;
|
|
|
|
struct device;
|
2014-06-15 18:07:12 +08:00
|
|
|
struct drm_device;
|
2015-02-24 18:34:01 +08:00
|
|
|
struct drm_encoder;
|
2014-06-15 18:07:12 +08:00
|
|
|
struct device_node;
|
|
|
|
|
|
|
|
#ifdef CONFIG_OF
|
|
|
|
extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
|
|
|
|
struct device_node *port);
|
2015-10-20 17:23:12 +08:00
|
|
|
extern int drm_of_component_probe(struct device *dev,
|
|
|
|
int (*compare_of)(struct device *, void *),
|
|
|
|
const struct component_master_ops *m_ops);
|
2015-02-24 18:34:01 +08:00
|
|
|
extern int drm_of_encoder_active_endpoint(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder,
|
|
|
|
struct of_endpoint *endpoint);
|
2014-06-15 18:07:12 +08:00
|
|
|
#else
|
|
|
|
static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
|
|
|
|
struct device_node *port)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2015-10-20 17:23:12 +08:00
|
|
|
|
|
|
|
static inline int
|
|
|
|
drm_of_component_probe(struct device *dev,
|
|
|
|
int (*compare_of)(struct device *, void *),
|
|
|
|
const struct component_master_ops *m_ops)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2015-02-24 18:34:01 +08:00
|
|
|
|
|
|
|
static inline int drm_of_encoder_active_endpoint(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder,
|
|
|
|
struct of_endpoint *endpoint)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2014-06-15 18:07:12 +08:00
|
|
|
#endif
|
|
|
|
|
2015-02-24 18:34:01 +08:00
|
|
|
static inline int drm_of_encoder_active_endpoint_id(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct of_endpoint endpoint;
|
|
|
|
int ret = drm_of_encoder_active_endpoint(node, encoder,
|
|
|
|
&endpoint);
|
|
|
|
|
|
|
|
return ret ?: endpoint.id;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int drm_of_encoder_active_port_id(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct of_endpoint endpoint;
|
|
|
|
int ret = drm_of_encoder_active_endpoint(node, encoder,
|
|
|
|
&endpoint);
|
|
|
|
|
|
|
|
return ret ?: endpoint.port;
|
|
|
|
}
|
|
|
|
|
2014-06-15 18:07:12 +08:00
|
|
|
#endif /* __DRM_OF_H__ */
|