summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/mediatek
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/mediatek
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/mediatek')
-rw-r--r--drivers/gpu/drm/mediatek/mtk_dpi.c12
-rw-r--r--drivers/gpu/drm/mediatek/mtk_hdmi.c26
2 files changed, 6 insertions, 32 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 3bd3bd688d1a..32ca351ecd09 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -661,7 +661,7 @@ static int mtk_dpi_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct mtk_dpi *dpi;
struct resource *mem;
- struct device_node *ep, *bridge_node = NULL;
+ struct device_node *bridge_node;
int comp_id;
int ret;
@@ -706,15 +706,9 @@ static int mtk_dpi_probe(struct platform_device *pdev)
return -EINVAL;
}
- ep = of_graph_get_next_endpoint(dev->of_node, NULL);
- if (ep) {
- bridge_node = of_graph_get_remote_port_parent(ep);
- of_node_put(ep);
- }
- if (!bridge_node) {
- dev_err(dev, "Failed to find bridge node\n");
+ bridge_node = of_graph_get_remote_node(dev->of_node, 0, 0);
+ if (!bridge_node)
return -ENODEV;
- }
dev_info(dev, "Found bridge node: %s\n", bridge_node->full_name);
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index c26251260b83..41a1c03b0347 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -1434,7 +1434,7 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
{
struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
- struct device_node *cec_np, *port, *ep, *remote, *i2c_np;
+ struct device_node *cec_np, *remote, *i2c_np;
struct platform_device *cec_pdev;
struct regmap *regmap;
struct resource *mem;
@@ -1486,29 +1486,9 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
if (IS_ERR(hdmi->regs))
return PTR_ERR(hdmi->regs);
- port = of_graph_get_port_by_id(np, 1);
- if (!port) {
- dev_err(dev, "Missing output port node\n");
+ remote = of_graph_get_remote_node(np, 1, 0);
+ if (!remote)
return -EINVAL;
- }
-
- ep = of_get_child_by_name(port, "endpoint");
- if (!ep) {
- dev_err(dev, "Missing endpoint node in port %s\n",
- port->full_name);
- of_node_put(port);
- return -EINVAL;
- }
- of_node_put(port);
-
- remote = of_graph_get_remote_port_parent(ep);
- if (!remote) {
- dev_err(dev, "Missing connector/bridge node for endpoint %s\n",
- ep->full_name);
- of_node_put(ep);
- return -EINVAL;
- }
- of_node_put(ep);
if (!of_device_is_compatible(remote, "hdmi-connector")) {
hdmi->next_bridge = of_drm_find_bridge(remote);