aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYakir Yang <ykk@rock-chips.com>2016-06-29 05:15:30 -0400
committerYakir Yang <ykk@rock-chips.com>2016-07-05 09:53:37 -0400
commiteb87c91c73f825ea377bdd229cf1cf6ef54e1372 (patch)
tree56499702049828582e9d65ba64b3afb676864bfb
parent82872e42bb1501dd9e60ca430f4bae45a469aa64 (diff)
drm/rockchip: analogix_dp: make panel detect to an optional action
Some boards don't need to declare a panel device node, like the display interface is DP monitors, so it's necessary to make the panel detect to an optional action. Signed-off-by: Yakir Yang <ykk@rock-chips.com> Acked-by: Mark Yao <mark.yao@rock-chips.com> Reviewed-by: Tomasz Figa <tomasz.figa@chromium.com> Reviewed-by: Sean Paul <seanpaul@chromium.org>
-rw-r--r--drivers/gpu/drm/rockchip/analogix_dp-rockchip.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 8557a085d0ac..0755573151af 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -329,38 +329,33 @@ static int rockchip_dp_probe(struct platform_device *pdev)
329{ 329{
330 struct device *dev = &pdev->dev; 330 struct device *dev = &pdev->dev;
331 struct device_node *panel_node, *port, *endpoint; 331 struct device_node *panel_node, *port, *endpoint;
332 struct drm_panel *panel = NULL;
332 struct rockchip_dp_device *dp; 333 struct rockchip_dp_device *dp;
333 struct drm_panel *panel;
334 334
335 port = of_graph_get_port_by_id(dev->of_node, 1); 335 port = of_graph_get_port_by_id(dev->of_node, 1);
336 if (!port) { 336 if (port) {
337 dev_err(dev, "can't find output port\n"); 337 endpoint = of_get_child_by_name(port, "endpoint");
338 return -EINVAL; 338 of_node_put(port);
339 } 339 if (!endpoint) {
340 340 dev_err(dev, "no output endpoint found\n");
341 endpoint = of_get_child_by_name(port, "endpoint"); 341 return -EINVAL;
342 of_node_put(port); 342 }
343 if (!endpoint) { 343
344 dev_err(dev, "no output endpoint found\n"); 344 panel_node = of_graph_get_remote_port_parent(endpoint);
345 return -EINVAL; 345 of_node_put(endpoint);
346 } 346 if (!panel_node) {
347 347 dev_err(dev, "no output node found\n");
348 panel_node = of_graph_get_remote_port_parent(endpoint); 348 return -EINVAL;
349 of_node_put(endpoint); 349 }
350 if (!panel_node) { 350
351 dev_err(dev, "no output node found\n"); 351 panel = of_drm_find_panel(panel_node);
352 return -EINVAL;
353 }
354
355 panel = of_drm_find_panel(panel_node);
356 if (!panel) {
357 DRM_ERROR("failed to find panel\n");
358 of_node_put(panel_node); 352 of_node_put(panel_node);
359 return -EPROBE_DEFER; 353 if (!panel) {
354 DRM_ERROR("failed to find panel\n");
355 return -EPROBE_DEFER;
356 }
360 } 357 }
361 358
362 of_node_put(panel_node);
363
364 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL); 359 dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
365 if (!dp) 360 if (!dp)
366 return -ENOMEM; 361 return -ENOMEM;