aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm
diff options
context:
space:
mode:
authorArchit Taneja <architt@codeaurora.org>2016-09-13 11:21:34 -0400
committerRob Clark <robdclark@gmail.com>2016-09-15 12:53:37 -0400
commit13ce5b6e38b7e487d3b900520f8d608122730095 (patch)
tree59b9ffcda004c9fad42212270d5b448bf2870981 /drivers/gpu/drm/msm
parent8506912b969b60aacc733315eeeb46b014d920a4 (diff)
drm/msm/mdp4: Fix issue with LCDC/LVDS port parsing
The LVDS port is the first in the list of the output ports in MDP4. The driver assumed that if the port and its corresponding endpoint is defined, then there should be a panel node too. This isn't necessary since boards may not really use a LVDS panel. Don't fail if there isn't a panel node available. While we're at it, use of_graph_get_endpoint_by_regs instead of of_graph_get_next_endpoint to make it more explicit that the LVDS output is at port 0. Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/msm')
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index 7b39e89fbc2b..571a91ee9607 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -228,18 +228,21 @@ static struct device_node *mdp4_detect_lcdc_panel(struct drm_device *dev)
228 struct device_node *endpoint, *panel_node; 228 struct device_node *endpoint, *panel_node;
229 struct device_node *np = dev->dev->of_node; 229 struct device_node *np = dev->dev->of_node;
230 230
231 endpoint = of_graph_get_next_endpoint(np, NULL); 231 /*
232 * LVDS/LCDC is the first port described in the list of ports in the
233 * MDP4 DT node.
234 */
235 endpoint = of_graph_get_endpoint_by_regs(np, 0, -1);
232 if (!endpoint) { 236 if (!endpoint) {
233 DBG("no endpoint in MDP4 to fetch LVDS panel\n"); 237 DBG("no LVDS remote endpoint\n");
234 return NULL; 238 return NULL;
235 } 239 }
236 240
237 /* don't proceed if we have an endpoint but no panel_node tied to it */
238 panel_node = of_graph_get_remote_port_parent(endpoint); 241 panel_node = of_graph_get_remote_port_parent(endpoint);
239 if (!panel_node) { 242 if (!panel_node) {
240 dev_err(dev->dev, "no valid panel node\n"); 243 DBG("no valid panel node in LVDS endpoint\n");
241 of_node_put(endpoint); 244 of_node_put(endpoint);
242 return ERR_PTR(-ENODEV); 245 return NULL;
243 } 246 }
244 247
245 of_node_put(endpoint); 248 of_node_put(endpoint);
@@ -262,14 +265,12 @@ static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms,
262 switch (intf_type) { 265 switch (intf_type) {
263 case DRM_MODE_ENCODER_LVDS: 266 case DRM_MODE_ENCODER_LVDS:
264 /* 267 /*
265 * bail out early if: 268 * bail out early if there is no panel node (no need to
266 * - there is no panel node (no need to initialize lcdc 269 * initialize LCDC encoder and LVDS connector)
267 * encoder and lvds connector), or
268 * - panel node is a bad pointer
269 */ 270 */
270 panel_node = mdp4_detect_lcdc_panel(dev); 271 panel_node = mdp4_detect_lcdc_panel(dev);
271 if (IS_ERR_OR_NULL(panel_node)) 272 if (!panel_node)
272 return PTR_ERR(panel_node); 273 return 0;
273 274
274 encoder = mdp4_lcdc_encoder_init(dev, panel_node); 275 encoder = mdp4_lcdc_encoder_init(dev, panel_node);
275 if (IS_ERR(encoder)) { 276 if (IS_ERR(encoder)) {