2014-06-15 17:07:12 +07:00
|
|
|
#ifndef __DRM_OF_H__
|
|
|
|
#define __DRM_OF_H__
|
|
|
|
|
2015-02-24 17:34:01 +07:00
|
|
|
#include <linux/of_graph.h>
|
|
|
|
|
2015-10-20 16:23:12 +07:00
|
|
|
struct component_master_ops;
|
2016-10-19 17:28:27 +07:00
|
|
|
struct component_match;
|
2015-10-20 16:23:12 +07:00
|
|
|
struct device;
|
2014-06-15 17:07:12 +07:00
|
|
|
struct drm_device;
|
2015-02-24 17:34:01 +07:00
|
|
|
struct drm_encoder;
|
2014-06-15 17:07:12 +07:00
|
|
|
struct device_node;
|
|
|
|
|
|
|
|
#ifdef CONFIG_OF
|
|
|
|
extern uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
|
|
|
|
struct device_node *port);
|
2016-10-19 17:28:27 +07:00
|
|
|
extern void drm_of_component_match_add(struct device *master,
|
|
|
|
struct component_match **matchptr,
|
|
|
|
int (*compare)(struct device *, void *),
|
|
|
|
struct device_node *node);
|
2015-10-20 16:23:12 +07: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 17:34:01 +07:00
|
|
|
extern int drm_of_encoder_active_endpoint(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder,
|
|
|
|
struct of_endpoint *endpoint);
|
2014-06-15 17:07:12 +07:00
|
|
|
#else
|
|
|
|
static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
|
|
|
|
struct device_node *port)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2015-10-20 16:23:12 +07:00
|
|
|
|
2016-10-26 15:57:47 +07:00
|
|
|
static inline void
|
|
|
|
drm_of_component_match_add(struct device *master,
|
|
|
|
struct component_match **matchptr,
|
|
|
|
int (*compare)(struct device *, void *),
|
|
|
|
struct device_node *node)
|
2016-10-19 17:28:27 +07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-20 16:23:12 +07: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 17:34:01 +07: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 17:07:12 +07:00
|
|
|
#endif
|
|
|
|
|
2015-02-24 17:34:01 +07: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 17:07:12 +07:00
|
|
|
#endif /* __DRM_OF_H__ */
|