static int modeset_init(struct mdp4_kms *mdp4_kms) { struct drm_device *dev = mdp4_kms->dev; struct msm_drm_private *priv = dev->dev_private; struct drm_plane *plane; struct drm_crtc *crtc; int i, ret; static const enum mdp4_pipe rgb_planes[] = { RGB1, RGB2, }; static const enum mdp4_pipe vg_planes[] = { VG1, VG2, }; static const enum mdp4_dma mdp4_crtcs[] = { DMA_P, DMA_E, }; static const char * const mdp4_crtc_names[] = { "DMA_P", "DMA_E", }; static const int mdp4_intfs[] = { DRM_MODE_ENCODER_LVDS, DRM_MODE_ENCODER_DSI, DRM_MODE_ENCODER_TMDS, }; /* construct non-private planes: */ for (i = 0; i < ARRAY_SIZE(vg_planes); i++) { plane = mdp4_plane_init(dev, vg_planes[i], false); if (IS_ERR(plane)) { dev_err(dev->dev, "failed to construct plane for VG%d\n", i + 1); ret = PTR_ERR(plane); goto fail; } priv->planes[priv->num_planes++] = plane; } for (i = 0; i < ARRAY_SIZE(mdp4_crtcs); i++) { plane = mdp4_plane_init(dev, rgb_planes[i], true); if (IS_ERR(plane)) { dev_err(dev->dev, "failed to construct plane for RGB%d\n", i + 1); ret = PTR_ERR(plane); goto fail; } crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, i, mdp4_crtcs[i]); if (IS_ERR(crtc)) { dev_err(dev->dev, "failed to construct crtc for %s\n", mdp4_crtc_names[i]); ret = PTR_ERR(crtc); goto fail; } priv->crtcs[priv->num_crtcs++] = crtc; } /* * we currently set up two relatively fixed paths: * * LCDC/LVDS path: RGB1 -> DMA_P -> LCDC -> LVDS * or * DSI path: RGB1 -> DMA_P -> DSI1 -> DSI Panel * * DTV/HDMI path: RGB2 -> DMA_E -> DTV -> HDMI */ for (i = 0; i < ARRAY_SIZE(mdp4_intfs); i++) { ret = mdp4_modeset_init_intf(mdp4_kms, mdp4_intfs[i]); if (ret) { dev_err(dev->dev, "failed to initialize intf: %d, %d\n", i, ret); goto fail; } } return 0; fail: return ret; }
static int modeset_init(struct mdp4_kms *mdp4_kms) { struct drm_device *dev = mdp4_kms->dev; struct msm_drm_private *priv = dev->dev_private; struct drm_plane *plane; struct drm_crtc *crtc; struct drm_encoder *encoder; struct hdmi *hdmi; int ret; /* * NOTE: this is a bit simplistic until we add support * for more than just RGB1->DMA_E->DTV->HDMI */ /* construct non-private planes: */ plane = mdp4_plane_init(dev, VG1, false); if (IS_ERR(plane)) { dev_err(dev->dev, "failed to construct plane for VG1\n"); ret = PTR_ERR(plane); goto fail; } priv->planes[priv->num_planes++] = plane; plane = mdp4_plane_init(dev, VG2, false); if (IS_ERR(plane)) { dev_err(dev->dev, "failed to construct plane for VG2\n"); ret = PTR_ERR(plane); goto fail; } priv->planes[priv->num_planes++] = plane; /* the CRTCs get constructed with a private plane: */ plane = mdp4_plane_init(dev, RGB1, true); if (IS_ERR(plane)) { dev_err(dev->dev, "failed to construct plane for RGB1\n"); ret = PTR_ERR(plane); goto fail; } crtc = mdp4_crtc_init(dev, plane, priv->num_crtcs, 1, DMA_E); if (IS_ERR(crtc)) { dev_err(dev->dev, "failed to construct crtc for DMA_E\n"); ret = PTR_ERR(crtc); goto fail; } priv->crtcs[priv->num_crtcs++] = crtc; encoder = mdp4_dtv_encoder_init(dev); if (IS_ERR(encoder)) { dev_err(dev->dev, "failed to construct DTV encoder\n"); ret = PTR_ERR(encoder); goto fail; } encoder->possible_crtcs = 0x1; /* DTV can be hooked to DMA_E */ priv->encoders[priv->num_encoders++] = encoder; hdmi = hdmi_init(dev, encoder); if (IS_ERR(hdmi)) { ret = PTR_ERR(hdmi); dev_err(dev->dev, "failed to initialize HDMI: %d\n", ret); goto fail; } return 0; fail: return ret; }