aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm/omap_crtc.c
diff options
context:
space:
mode:
authorJyri Sarha <jsarha@ti.com>2017-03-24 10:47:55 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-04-03 05:36:40 -0400
commite8e13b1521678af0df7b07f30745d77e8de1820a (patch)
tree5b43e024c00391db18f83e6285b2b280953df39b /drivers/gpu/drm/omapdrm/omap_crtc.c
parent694c99cf6f5a13774bbdbf5becdbf59451b955f0 (diff)
drm/omap: Major omap_modeset_init() cleanup
Cleanup overly complex omap_modeset_init(). The function is trying to support many unusual configuration, that have never been tested and are not supported by other parts of the dirver. After cleanup the init function creates exactly one connector, encoder, crtc, and primary plane per each connected dss-device. Each connector->encoder->crtc chain is expected to be separate and each crtc is connect to a single dss-channel. If the configuration does not match the expectations or exceeds the available resources, the configuration is rejected. Signed-off-by: Jyri Sarha <jsarha@ti.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_crtc.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 4f03f74685f0..dccd03726796 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -573,6 +573,8 @@ static const char *channel_names[] = {
573 573
574void omap_crtc_pre_init(void) 574void omap_crtc_pre_init(void)
575{ 575{
576 memset(omap_crtcs, 0, sizeof(omap_crtcs));
577
576 dss_install_mgr_ops(&mgr_ops); 578 dss_install_mgr_ops(&mgr_ops);
577} 579}
578 580
@@ -583,18 +585,28 @@ void omap_crtc_pre_uninit(void)
583 585
584/* initialize crtc */ 586/* initialize crtc */
585struct drm_crtc *omap_crtc_init(struct drm_device *dev, 587struct drm_crtc *omap_crtc_init(struct drm_device *dev,
586 struct drm_plane *plane, enum omap_channel channel, int id) 588 struct drm_plane *plane, struct omap_dss_device *dssdev)
587{ 589{
588 struct omap_drm_private *priv = dev->dev_private; 590 struct omap_drm_private *priv = dev->dev_private;
589 struct drm_crtc *crtc = NULL; 591 struct drm_crtc *crtc = NULL;
590 struct omap_crtc *omap_crtc; 592 struct omap_crtc *omap_crtc;
593 enum omap_channel channel;
594 struct omap_dss_device *out;
591 int ret; 595 int ret;
592 596
597 out = omapdss_find_output_from_display(dssdev);
598 channel = out->dispc_channel;
599 omap_dss_put_device(out);
600
593 DBG("%s", channel_names[channel]); 601 DBG("%s", channel_names[channel]);
594 602
603 /* Multiple displays on same channel is not allowed */
604 if (WARN_ON(omap_crtcs[channel] != NULL))
605 return ERR_PTR(-EINVAL);
606
595 omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); 607 omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL);
596 if (!omap_crtc) 608 if (!omap_crtc)
597 return NULL; 609 return ERR_PTR(-ENOMEM);
598 610
599 crtc = &omap_crtc->base; 611 crtc = &omap_crtc->base;
600 612
@@ -606,8 +618,10 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev,
606 ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, 618 ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL,
607 &omap_crtc_funcs, NULL); 619 &omap_crtc_funcs, NULL);
608 if (ret < 0) { 620 if (ret < 0) {
621 dev_err(dev->dev, "%s(): could not init crtc for: %s\n",
622 __func__, dssdev->name);
609 kfree(omap_crtc); 623 kfree(omap_crtc);
610 return NULL; 624 return ERR_PTR(ret);
611 } 625 }
612 626
613 drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs); 627 drm_crtc_helper_add(crtc, &omap_crtc_helper_funcs);