|
14 | 14 | #include <drm/drm_fb_helper.h>
|
15 | 15 | #include <drm/drm_gem_cma_helper.h>
|
16 | 16 | #include <drm/drm_gem_framebuffer_helper.h>
|
| 17 | +#include <drm/drm_of.h> |
17 | 18 | #include <drm/drm_probe_helper.h>
|
18 | 19 | #include <linux/dma-mapping.h>
|
19 | 20 | #include <linux/module.h>
|
@@ -45,7 +46,7 @@ static int arcpgu_load(struct drm_device *drm)
|
45 | 46 | {
|
46 | 47 | struct platform_device *pdev = to_platform_device(drm->dev);
|
47 | 48 | struct arcpgu_drm_private *arcpgu;
|
48 |
| - struct device_node *encoder_node; |
| 49 | + struct device_node *encoder_node = NULL, *endpoint_node = NULL; |
49 | 50 | struct resource *res;
|
50 | 51 | int ret;
|
51 | 52 |
|
@@ -80,14 +81,23 @@ static int arcpgu_load(struct drm_device *drm)
|
80 | 81 | if (arc_pgu_setup_crtc(drm) < 0)
|
81 | 82 | return -ENODEV;
|
82 | 83 |
|
83 |
| - /* find the encoder node and initialize it */ |
84 |
| - encoder_node = of_parse_phandle(drm->dev->of_node, "encoder-slave", 0); |
| 84 | + /* |
| 85 | + * There is only one output port inside each device. It is linked with |
| 86 | + * encoder endpoint. |
| 87 | + */ |
| 88 | + endpoint_node = of_graph_get_next_endpoint(pdev->dev.of_node, NULL); |
| 89 | + if (endpoint_node) { |
| 90 | + encoder_node = of_graph_get_remote_port_parent(endpoint_node); |
| 91 | + of_node_put(endpoint_node); |
| 92 | + } |
| 93 | + |
85 | 94 | if (encoder_node) {
|
86 | 95 | ret = arcpgu_drm_hdmi_init(drm, encoder_node);
|
87 | 96 | of_node_put(encoder_node);
|
88 | 97 | if (ret < 0)
|
89 | 98 | return ret;
|
90 | 99 | } else {
|
| 100 | + dev_info(drm->dev, "no encoder found. Assumed virtual LCD on simulation platform\n"); |
91 | 101 | ret = arcpgu_drm_sim_init(drm, NULL);
|
92 | 102 | if (ret < 0)
|
93 | 103 | return ret;
|
|
0 commit comments