aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2018-08-21 17:01:07 -0400
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2018-09-24 17:41:03 -0400
commit1f98b2a4fd4632db3b585a624032b7ec785a5255 (patch)
tree309825dd24ec9636fc540da9362c3a427d4aacd8
parentb4734f43f3cadfaa423ce6aceb1e9faea07b8eb8 (diff)
drm: rcar-du: Enable configurable DPAD0 routing on Gen3
All Gen3 SoCs supported so far have a fixed association between DPAD0 and DU channels, which led to hardcoding that association when writing the corresponding hardware register. The D3 and E3 will break that mechanism as DPAD0 can be dynamically connected to either DU0 or DU1. Make DPAD0 routing dynamic on Gen3. To ensure a valid hardware configuration when the DU starts without the RGB output enabled, DPAD0 is associated at initialization time to the first DU channel that it can be connected to. This makes no change on Gen2 as all Gen2 SoCs can connected DPAD0 to DU0, which is the current implicit default value. As the DPAD0 source is always 0 when a single source is possible on Gen2, we can also simplify the Gen2 code in the same function to remove a conditional check. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_group.c17
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_kms.c12
2 files changed, 18 insertions, 11 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 4c62841eff2f..f38703e7a10d 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -56,8 +56,6 @@ static void rcar_du_group_setup_pins(struct rcar_du_group *rgrp)
56static void rcar_du_group_setup_defr8(struct rcar_du_group *rgrp) 56static void rcar_du_group_setup_defr8(struct rcar_du_group *rgrp)
57{ 57{
58 struct rcar_du_device *rcdu = rgrp->dev; 58 struct rcar_du_device *rcdu = rgrp->dev;
59 unsigned int possible_crtcs =
60 rcdu->info->routes[RCAR_DU_OUTPUT_DPAD0].possible_crtcs;
61 u32 defr8 = DEFR8_CODE; 59 u32 defr8 = DEFR8_CODE;
62 60
63 if (rcdu->info->gen < 3) { 61 if (rcdu->info->gen < 3) {
@@ -69,21 +67,18 @@ static void rcar_du_group_setup_defr8(struct rcar_du_group *rgrp)
69 * DU instances that support it. 67 * DU instances that support it.
70 */ 68 */
71 if (rgrp->index == 0) { 69 if (rgrp->index == 0) {
72 if (possible_crtcs > 1) 70 defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source);
73 defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source);
74 if (rgrp->dev->vspd1_sink == 2) 71 if (rgrp->dev->vspd1_sink == 2)
75 defr8 |= DEFR8_VSCS; 72 defr8 |= DEFR8_VSCS;
76 } 73 }
77 } else { 74 } else {
78 /* 75 /*
79 * On Gen3 VSPD routing can't be configured, but DPAD routing 76 * On Gen3 VSPD routing can't be configured, and DPAD routing
80 * needs to be set despite having a single option available. 77 * is set in the group corresponding to the DPAD output (no Gen3
78 * SoC has multiple DPAD sources belonging to separate groups).
81 */ 79 */
82 unsigned int rgb_crtc = ffs(possible_crtcs) - 1; 80 if (rgrp->index == rcdu->dpad0_source / 2)
83 struct rcar_du_crtc *crtc = &rcdu->crtcs[rgb_crtc]; 81 defr8 |= DEFR8_DRGBS_DU(rcdu->dpad0_source);
84
85 if (crtc->index / 2 == rgrp->index)
86 defr8 |= DEFR8_DRGBS_DU(crtc->index);
87 } 82 }
88 83
89 rcar_du_group_write(rgrp, DEFR8, defr8); 84 rcar_du_group_write(rgrp, DEFR8, defr8);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index b5d79ecd25ea..4ebd61ecbee1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -544,6 +544,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
544 struct drm_device *dev = rcdu->ddev; 544 struct drm_device *dev = rcdu->ddev;
545 struct drm_encoder *encoder; 545 struct drm_encoder *encoder;
546 struct drm_fbdev_cma *fbdev; 546 struct drm_fbdev_cma *fbdev;
547 unsigned int dpad0_sources;
547 unsigned int num_encoders; 548 unsigned int num_encoders;
548 unsigned int num_groups; 549 unsigned int num_groups;
549 unsigned int swindex; 550 unsigned int swindex;
@@ -666,6 +667,17 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
666 encoder->possible_clones = (1 << num_encoders) - 1; 667 encoder->possible_clones = (1 << num_encoders) - 1;
667 } 668 }
668 669
670 /*
671 * Initialize the default DPAD0 source to the index of the first DU
672 * channel that can be connected to DPAD0. The exact value doesn't
673 * matter as it should be overwritten by mode setting for the RGB
674 * output, but it is nonetheless required to ensure a valid initial
675 * hardware configuration on Gen3 where DU0 can't always be connected to
676 * DPAD0.
677 */
678 dpad0_sources = rcdu->info->routes[RCAR_DU_OUTPUT_DPAD0].possible_crtcs;
679 rcdu->dpad0_source = ffs(dpad0_sources) - 1;
680
669 drm_mode_config_reset(dev); 681 drm_mode_config_reset(dev);
670 682
671 drm_kms_helper_poll_init(dev); 683 drm_kms_helper_poll_init(dev);