2014-06-15 10:07:12 +00:00
|
|
|
#ifndef __DRM_OF_H__
|
|
|
|
#define __DRM_OF_H__
|
|
|
|
|
2015-02-24 10:34:01 +00:00
|
|
|
#include <linux/of_graph.h>
|
|
|
|
|
2015-10-20 09:23:12 +00:00
|
|
|
struct component_master_ops;
|
2016-10-19 10:28:27 +00:00
|
|
|
struct component_match;
|
2015-10-20 09:23:12 +00:00
|
|
|
struct device;
|
2014-06-15 10:07:12 +00:00
|
|
|
struct drm_device;
|
2015-02-24 10:34:01 +00:00
|
|
|
struct drm_encoder;
|
2017-03-22 13:26:05 +00:00
|
|
|
struct drm_panel;
|
|
|
|
struct drm_bridge;
|
2014-06-15 10:07:12 +00:00
|
|
|
struct device_node;
|
|
|
|
|
|
|
|
#ifdef CONFIG_OF
|
2017-03-22 08:36:02 +00:00
|
|
|
uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
|
|
|
|
struct device_node *port);
|
|
|
|
void drm_of_component_match_add(struct device *master,
|
|
|
|
struct component_match **matchptr,
|
|
|
|
int (*compare)(struct device *, void *),
|
|
|
|
struct device_node *node);
|
|
|
|
int drm_of_component_probe(struct device *dev,
|
|
|
|
int (*compare_of)(struct device *, void *),
|
|
|
|
const struct component_master_ops *m_ops);
|
|
|
|
int drm_of_encoder_active_endpoint(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder,
|
|
|
|
struct of_endpoint *endpoint);
|
2017-03-22 13:26:05 +00:00
|
|
|
int drm_of_find_panel_or_bridge(const struct device_node *np,
|
|
|
|
int port, int endpoint,
|
|
|
|
struct drm_panel **panel,
|
|
|
|
struct drm_bridge **bridge);
|
2014-06-15 10:07:12 +00:00
|
|
|
#else
|
|
|
|
static inline uint32_t drm_of_find_possible_crtcs(struct drm_device *dev,
|
|
|
|
struct device_node *port)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2015-10-20 09:23:12 +00:00
|
|
|
|
2016-10-26 08:57:47 +00: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 10:28:27 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-10-20 09:23:12 +00: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 10:34:01 +00:00
|
|
|
|
|
|
|
static inline int drm_of_encoder_active_endpoint(struct device_node *node,
|
|
|
|
struct drm_encoder *encoder,
|
|
|
|
struct of_endpoint *endpoint)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2017-03-22 13:26:05 +00:00
|
|
|
static inline int drm_of_find_panel_or_bridge(const struct device_node *np,
|
|
|
|
int port, int endpoint,
|
|
|
|
struct drm_panel **panel,
|
|
|
|
struct drm_bridge **bridge)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2014-06-15 10:07:12 +00:00
|
|
|
#endif
|
|
|
|
|
2015-02-24 10:34:01 +00: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 10:07:12 +00:00
|
|
|
#endif /* __DRM_OF_H__ */
|