summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/arm
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2017-03-22 16:26:06 +0300
committerSean Paul <seanpaul@chromium.org>2017-04-07 00:00:27 +0300
commit86418f90a4c1a0073db65d8a1e2bf94421117a60 (patch)
treea82b9534e5f5c89ceeaa93abaad71da000c7f8d3 /drivers/gpu/drm/arm
parent1f2db3034c9f16ed918e34809167546f21d0fcb4 (diff)
downloadlinux-86418f90a4c1a0073db65d8a1e2bf94421117a60.tar.xz
drm: convert drivers to use of_graph_get_remote_node
Convert drivers to use the new of_graph_get_remote_node() helper instead of parsing the endpoint node and then getting the remote device node. Now drivers can just specify the device node and which port/endpoint and get back the connected remote device node. The details of the graph binding are nicely abstracted into the core OF graph code. This changes some error messages to debug messages (in the graph core). Graph connections are often "no connects" depending on the particular board, so we want to avoid spurious messages. Plus the kernel is not a DT validator. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Neil Armstrong <narmstrong@baylibre.com> Tested-by: Liviu Dudau <liviu.dudau@arm.com> Tested-by: Eric Anholt <eric@anholt.net> Tested-by: Jyri Sarha <jsarha@ti.com> Tested by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/arm')
-rw-r--r--drivers/gpu/drm/arm/hdlcd_drv.c22
-rw-r--r--drivers/gpu/drm/arm/malidp_drv.c28
2 files changed, 7 insertions, 43 deletions
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index 0e74880b5e94..0f49c4b12772 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -392,29 +392,13 @@ static int compare_dev(struct device *dev, void *data)
static int hdlcd_probe(struct platform_device *pdev)
{
- struct device_node *port, *ep;
+ struct device_node *port;
struct component_match *match = NULL;
- if (!pdev->dev.of_node)
- return -ENODEV;
-
/* there is only one output port inside each device, find it */
- ep = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
- if (!ep)
- return -ENODEV;
-
- if (!of_device_is_available(ep)) {
- of_node_put(ep);
+ port = of_graph_get_remote_node(pdev->dev.of_node, 0, 0);
+ if (!port)
return -ENODEV;
- }
-
- /* add the remote encoder port as component */
- port = of_graph_get_remote_port_parent(ep);
- of_node_put(ep);
- if (!port || !of_device_is_available(port)) {
- of_node_put(port);
- return -EAGAIN;
- }
drm_of_component_match_add(&pdev->dev, &match, compare_dev, port);
of_node_put(port);
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index ea2546f766c2..898c2b58e73d 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -283,7 +283,6 @@ static int malidp_bind(struct device *dev)
{
struct resource *res;
struct drm_device *drm;
- struct device_node *ep;
struct malidp_drm *malidp;
struct malidp_hw_device *hwdev;
struct platform_device *pdev = to_platform_device(dev);
@@ -398,12 +397,7 @@ static int malidp_bind(struct device *dev)
goto init_fail;
/* Set the CRTC's port so that the encoder component can find it */
- ep = of_graph_get_next_endpoint(dev->of_node, NULL);
- if (!ep) {
- ret = -EINVAL;
- goto port_fail;
- }
- malidp->crtc.port = of_get_next_parent(ep);
+ malidp->crtc.port = of_graph_get_port_by_id(dev->of_node, 0);
ret = component_bind_all(dev, drm);
if (ret) {
@@ -458,7 +452,6 @@ irq_init_fail:
bind_fail:
of_node_put(malidp->crtc.port);
malidp->crtc.port = NULL;
-port_fail:
malidp_fini(drm);
init_fail:
drm->dev_private = NULL;
@@ -516,29 +509,16 @@ static int malidp_compare_dev(struct device *dev, void *data)
static int malidp_platform_probe(struct platform_device *pdev)
{
- struct device_node *port, *ep;
+ struct device_node *port;
struct component_match *match = NULL;
if (!pdev->dev.of_node)
return -ENODEV;
/* there is only one output port inside each device, find it */
- ep = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
- if (!ep)
- return -ENODEV;
-
- if (!of_device_is_available(ep)) {
- of_node_put(ep);
+ port = of_graph_get_remote_node(pdev->dev.of_node, 0, 0);
+ if (!port)
return -ENODEV;
- }
-
- /* add the remote encoder port as component */
- port = of_graph_get_remote_port_parent(ep);
- of_node_put(ep);
- if (!port || !of_device_is_available(port)) {
- of_node_put(port);
- return -EAGAIN;
- }
drm_of_component_match_add(&pdev->dev, &match, malidp_compare_dev,
port);