aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKieran Bingham <kieran.bingham+renesas@ideasonboard.com>2018-04-27 18:21:53 -0400
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2018-05-05 10:11:19 -0400
commit7ae90455bc865ab1c30fb4db53ac56ec32741ab9 (patch)
tree6046cbb08032c475f0aeabbdf1fcb99373f806cf
parent5361cc7f8e9146f393cfcb76890d8c80a4e73086 (diff)
drm: rcar-du: Allow DU groups to work with hardware indexing
The group objects assume linear indexing, and more so always assume that channel 0 of any active group is used. Now that the CRTC objects support non-linear indexing, adapt the groups to remove assumptions that channel 0 is utilised in each group by using the channel mask provided in the device structures. Finally ensure that the RGB routing is determined from the index of the CRTC object (which represents the hardware DU channel index). Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_group.c14
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_group.h2
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_kms.c5
3 files changed, 15 insertions, 6 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index eead202c95c7..d539cb290a35 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -46,9 +46,12 @@ void rcar_du_group_write(struct rcar_du_group *rgrp, u32 reg, u32 data)
46 46
47static void rcar_du_group_setup_pins(struct rcar_du_group *rgrp) 47static void rcar_du_group_setup_pins(struct rcar_du_group *rgrp)
48{ 48{
49 u32 defr6 = DEFR6_CODE | DEFR6_ODPM02_DISP; 49 u32 defr6 = DEFR6_CODE;
50 50
51 if (rgrp->num_crtcs > 1) 51 if (rgrp->channels_mask & BIT(0))
52 defr6 |= DEFR6_ODPM02_DISP;
53
54 if (rgrp->channels_mask & BIT(1))
52 defr6 |= DEFR6_ODPM12_DISP; 55 defr6 |= DEFR6_ODPM12_DISP;
53 56
54 rcar_du_group_write(rgrp, DEFR6, defr6); 57 rcar_du_group_write(rgrp, DEFR6, defr6);
@@ -80,10 +83,11 @@ static void rcar_du_group_setup_defr8(struct rcar_du_group *rgrp)
80 * On Gen3 VSPD routing can't be configured, but DPAD routing 83 * On Gen3 VSPD routing can't be configured, but DPAD routing
81 * needs to be set despite having a single option available. 84 * needs to be set despite having a single option available.
82 */ 85 */
83 u32 crtc = ffs(possible_crtcs) - 1; 86 unsigned int rgb_crtc = ffs(possible_crtcs) - 1;
87 struct rcar_du_crtc *crtc = &rcdu->crtcs[rgb_crtc];
84 88
85 if (crtc / 2 == rgrp->index) 89 if (crtc->index / 2 == rgrp->index)
86 defr8 |= DEFR8_DRGBS_DU(crtc); 90 defr8 |= DEFR8_DRGBS_DU(crtc->index);
87 } 91 }
88 92
89 rcar_du_group_write(rgrp, DEFR8, defr8); 93 rcar_du_group_write(rgrp, DEFR8, defr8);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.h b/drivers/gpu/drm/rcar-du/rcar_du_group.h
index 5e3adc6b31b5..42105aedecc8 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.h
@@ -25,6 +25,7 @@ struct rcar_du_device;
25 * @dev: the DU device 25 * @dev: the DU device
26 * @mmio_offset: registers offset in the device memory map 26 * @mmio_offset: registers offset in the device memory map
27 * @index: group index 27 * @index: group index
28 * @channels_mask: bitmask of populated DU channels in this group
28 * @num_crtcs: number of CRTCs in this group (1 or 2) 29 * @num_crtcs: number of CRTCs in this group (1 or 2)
29 * @use_count: number of users of the group (rcar_du_group_(get|put)) 30 * @use_count: number of users of the group (rcar_du_group_(get|put))
30 * @used_crtcs: number of CRTCs currently in use 31 * @used_crtcs: number of CRTCs currently in use
@@ -39,6 +40,7 @@ struct rcar_du_group {
39 unsigned int mmio_offset; 40 unsigned int mmio_offset;
40 unsigned int index; 41 unsigned int index;
41 42
43 unsigned int channels_mask;
42 unsigned int num_crtcs; 44 unsigned int num_crtcs;
43 unsigned int use_count; 45 unsigned int use_count;
44 unsigned int used_crtcs; 46 unsigned int used_crtcs;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index b5e331cb0d1c..34f1c27e9cf9 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -559,7 +559,10 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
559 rgrp->dev = rcdu; 559 rgrp->dev = rcdu;
560 rgrp->mmio_offset = mmio_offsets[i]; 560 rgrp->mmio_offset = mmio_offsets[i];
561 rgrp->index = i; 561 rgrp->index = i;
562 rgrp->num_crtcs = min(rcdu->num_crtcs - 2 * i, 2U); 562 /* Extract the channel mask for this group only. */
563 rgrp->channels_mask = (rcdu->info->channels_mask >> (2 * i))
564 & GENMASK(1, 0);
565 rgrp->num_crtcs = hweight8(rgrp->channels_mask);
563 566
564 /* 567 /*
565 * If we have more than one CRTCs in this group pre-associate 568 * If we have more than one CRTCs in this group pre-associate