Commit 5aebc852 authored by Laurent Pinchart's avatar Laurent Pinchart

drm: rcar-du: Simplify encoder registration

Before the driver fully moved to drm_bridge and drm_panel, it was
necessary to parse DT and locate encoder and connector nodes. The
connector node is now unused and can be removed as a parameter to
rcar_du_encoder_init(). As a consequence rcar_du_encoders_init_one() can
be greatly simplified, removing most of the DT parsing.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
parent fc59d7d4
...@@ -30,8 +30,7 @@ static const struct drm_encoder_funcs encoder_funcs = { ...@@ -30,8 +30,7 @@ static const struct drm_encoder_funcs encoder_funcs = {
int rcar_du_encoder_init(struct rcar_du_device *rcdu, int rcar_du_encoder_init(struct rcar_du_device *rcdu,
enum rcar_du_output output, enum rcar_du_output output,
struct device_node *enc_node, struct device_node *enc_node)
struct device_node *con_node)
{ {
struct rcar_du_encoder *renc; struct rcar_du_encoder *renc;
struct drm_encoder *encoder; struct drm_encoder *encoder;
......
...@@ -26,7 +26,6 @@ struct rcar_du_encoder { ...@@ -26,7 +26,6 @@ struct rcar_du_encoder {
int rcar_du_encoder_init(struct rcar_du_device *rcdu, int rcar_du_encoder_init(struct rcar_du_device *rcdu,
enum rcar_du_output output, enum rcar_du_output output,
struct device_node *enc_node, struct device_node *enc_node);
struct device_node *con_node);
#endif /* __RCAR_DU_ENCODER_H__ */ #endif /* __RCAR_DU_ENCODER_H__ */
...@@ -330,17 +330,10 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, ...@@ -330,17 +330,10 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
enum rcar_du_output output, enum rcar_du_output output,
struct of_endpoint *ep) struct of_endpoint *ep)
{ {
struct device_node *connector = NULL;
struct device_node *encoder = NULL;
struct device_node *ep_node = NULL;
struct device_node *entity_ep_node;
struct device_node *entity; struct device_node *entity;
int ret; int ret;
/* /* Locate the connected entity and initialize the encoder. */
* Locate the connected entity and infer its type from the number of
* endpoints.
*/
entity = of_graph_get_remote_port_parent(ep->local_node); entity = of_graph_get_remote_port_parent(ep->local_node);
if (!entity) { if (!entity) {
dev_dbg(rcdu->dev, "unconnected endpoint %pOF, skipping\n", dev_dbg(rcdu->dev, "unconnected endpoint %pOF, skipping\n",
...@@ -356,50 +349,13 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu, ...@@ -356,50 +349,13 @@ static int rcar_du_encoders_init_one(struct rcar_du_device *rcdu,
return -ENODEV; return -ENODEV;
} }
entity_ep_node = of_graph_get_remote_endpoint(ep->local_node); ret = rcar_du_encoder_init(rcdu, output, entity);
for_each_endpoint_of_node(entity, ep_node) {
if (ep_node == entity_ep_node)
continue;
/*
* We've found one endpoint other than the input, this must
* be an encoder. Locate the connector.
*/
encoder = entity;
connector = of_graph_get_remote_port_parent(ep_node);
of_node_put(ep_node);
if (!connector) {
dev_warn(rcdu->dev,
"no connector for encoder %pOF, skipping\n",
encoder);
of_node_put(entity_ep_node);
of_node_put(encoder);
return -ENODEV;
}
break;
}
of_node_put(entity_ep_node);
if (!encoder) {
dev_warn(rcdu->dev,
"no encoder found for endpoint %pOF, skipping\n",
ep->local_node);
of_node_put(entity);
return -ENODEV;
}
ret = rcar_du_encoder_init(rcdu, output, encoder, connector);
if (ret && ret != -EPROBE_DEFER) if (ret && ret != -EPROBE_DEFER)
dev_warn(rcdu->dev, dev_warn(rcdu->dev,
"failed to initialize encoder %pOF on output %u (%d), skipping\n", "failed to initialize encoder %pOF on output %u (%d), skipping\n",
encoder, output, ret); entity, output, ret);
of_node_put(encoder); of_node_put(entity);
of_node_put(connector);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment