static int hdlcd_probe(struct platform_device *pdev) { struct device_node *port; struct component_match *match = NULL; /* there is only one output port inside each device, find it */ port = of_graph_get_remote_node(pdev->dev.of_node, 0, 0); if (!port) return -ENODEV; drm_of_component_match_add(&pdev->dev, &match, compare_dev, port); of_node_put(port); return component_master_add_with_match(&pdev->dev, &hdlcd_master_ops, match); }
static int kirin_drm_platform_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct component_match *match = NULL; struct device_node *remote; dc_ops = (struct kirin_dc_ops *)of_device_get_match_data(dev); if (!dc_ops) { DRM_ERROR("failed to get dt id data\n"); return -EINVAL; } remote = of_graph_get_remote_node(np, 0, 0); if (IS_ERR(remote)) return PTR_ERR(remote); drm_of_component_match_add(dev, &match, compare_of, remote); of_node_put(remote); return component_master_add_with_match(dev, &kirin_drm_ops, match); return 0; }
static int mdp4_modeset_init_intf(struct mdp4_kms *mdp4_kms, int intf_type) { struct drm_device *dev = mdp4_kms->dev; struct msm_drm_private *priv = dev->dev_private; struct drm_encoder *encoder; struct drm_connector *connector; struct device_node *panel_node; int dsi_id; int ret; switch (intf_type) { case DRM_MODE_ENCODER_LVDS: /* * bail out early if there is no panel node (no need to * initialize LCDC encoder and LVDS connector) */ panel_node = of_graph_get_remote_node(dev->dev->of_node, 0, 0); if (!panel_node) return 0; encoder = mdp4_lcdc_encoder_init(dev, panel_node); if (IS_ERR(encoder)) { dev_err(dev->dev, "failed to construct LCDC encoder\n"); return PTR_ERR(encoder); } /* LCDC can be hooked to DMA_P (TODO: Add DMA_S later?) */ encoder->possible_crtcs = 1 << DMA_P; connector = mdp4_lvds_connector_init(dev, panel_node, encoder); if (IS_ERR(connector)) { dev_err(dev->dev, "failed to initialize LVDS connector\n"); return PTR_ERR(connector); } priv->encoders[priv->num_encoders++] = encoder; priv->connectors[priv->num_connectors++] = connector; break; case DRM_MODE_ENCODER_TMDS: encoder = mdp4_dtv_encoder_init(dev); if (IS_ERR(encoder)) { dev_err(dev->dev, "failed to construct DTV encoder\n"); return PTR_ERR(encoder); } /* DTV can be hooked to DMA_E: */ encoder->possible_crtcs = 1 << 1; if (priv->hdmi) { /* Construct bridge/connector for HDMI: */ ret = msm_hdmi_modeset_init(priv->hdmi, dev, encoder); if (ret) { dev_err(dev->dev, "failed to initialize HDMI: %d\n", ret); return ret; } } priv->encoders[priv->num_encoders++] = encoder; break; case DRM_MODE_ENCODER_DSI: /* only DSI1 supported for now */ dsi_id = 0; if (!priv->dsi[dsi_id]) break; encoder = mdp4_dsi_encoder_init(dev); if (IS_ERR(encoder)) { ret = PTR_ERR(encoder); dev_err(dev->dev, "failed to construct DSI encoder: %d\n", ret); return ret; } /* TODO: Add DMA_S later? */ encoder->possible_crtcs = 1 << DMA_P; priv->encoders[priv->num_encoders++] = encoder; ret = msm_dsi_modeset_init(priv->dsi[dsi_id], dev, encoder); if (ret) { dev_err(dev->dev, "failed to initialize DSI: %d\n", ret); return ret; } break; default: dev_err(dev->dev, "Invalid or unsupported interface\n"); return -EINVAL; } return 0; }