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