aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/rcar-du
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-12-08 17:21:12 -0500
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>2014-12-23 05:01:50 -0500
commit0c1c877681e73b87ef63634ed7da55a711de40a6 (patch)
tree08259e004d45b4cb679bd1cbab8301195d103d0b /drivers/gpu/drm/rcar-du
parent5e433b6312d9d05ac83078bfd2e6371f24d6eb46 (diff)
drm: rcar-du: Refactor DEFR8 feature
Rename the feature from RCAR_DU_FEATURE_DEFR8 to RCAR_DU_FEATURE_EXT_CTRL_REGS to cover all extended control registers in addition to the DEFR8 register. Usage of the feature is refactored to optimize runtime operation and prepare for external clock support. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/rcar-du')
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_crtc.c7
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_drv.c6
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_drv.h2
-rw-r--r--drivers/gpu/drm/rcar-du/rcar_du_group.c9
4 files changed, 14 insertions, 10 deletions
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 23cc910951f4..cf0dca13264f 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -139,9 +139,10 @@ void rcar_du_crtc_route_output(struct drm_crtc *crtc,
139 */ 139 */
140 rcrtc->outputs |= BIT(output); 140 rcrtc->outputs |= BIT(output);
141 141
142 /* Store RGB routing to DPAD0 for R8A7790. */ 142 /* Store RGB routing to DPAD0, the hardware will be configured when
143 if (rcar_du_has(rcdu, RCAR_DU_FEATURE_DEFR8) && 143 * starting the CRTC.
144 output == RCAR_DU_OUTPUT_DPAD0) 144 */
145 if (output == RCAR_DU_OUTPUT_DPAD0)
145 rcdu->dpad0_source = rcrtc->index; 146 rcdu->dpad0_source = rcrtc->index;
146} 147}
147 148
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 967ae8f20233..4fb29b473560 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -56,7 +56,8 @@ static const struct rcar_du_device_info rcar_du_r8a7779_info = {
56}; 56};
57 57
58static const struct rcar_du_device_info rcar_du_r8a7790_info = { 58static const struct rcar_du_device_info rcar_du_r8a7790_info = {
59 .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, 59 .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
60 | RCAR_DU_FEATURE_EXT_CTRL_REGS,
60 .quirks = RCAR_DU_QUIRK_ALIGN_128B | RCAR_DU_QUIRK_LVDS_LANES, 61 .quirks = RCAR_DU_QUIRK_ALIGN_128B | RCAR_DU_QUIRK_LVDS_LANES,
61 .num_crtcs = 3, 62 .num_crtcs = 3,
62 .routes = { 63 .routes = {
@@ -83,7 +84,8 @@ static const struct rcar_du_device_info rcar_du_r8a7790_info = {
83}; 84};
84 85
85static const struct rcar_du_device_info rcar_du_r8a7791_info = { 86static const struct rcar_du_device_info rcar_du_r8a7791_info = {
86 .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK | RCAR_DU_FEATURE_DEFR8, 87 .features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
88 | RCAR_DU_FEATURE_EXT_CTRL_REGS,
87 .num_crtcs = 2, 89 .num_crtcs = 2,
88 .routes = { 90 .routes = {
89 /* R8A7791 has one RGB output, one LVDS output and one 91 /* R8A7791 has one RGB output, one LVDS output and one
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index 0a724669f02d..c5b9ea6a7eaa 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -27,7 +27,7 @@ struct rcar_du_device;
27struct rcar_du_lvdsenc; 27struct rcar_du_lvdsenc;
28 28
29#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */ 29#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */
30#define RCAR_DU_FEATURE_DEFR8 (1 << 1) /* Has DEFR8 register */ 30#define RCAR_DU_FEATURE_EXT_CTRL_REGS (1 << 1) /* Has extended control registers */
31 31
32#define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes */ 32#define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes */
33#define RCAR_DU_QUIRK_LVDS_LANES (1 << 1) /* LVDS lanes 1 and 3 inverted */ 33#define RCAR_DU_QUIRK_LVDS_LANES (1 << 1) /* LVDS lanes 1 and 3 inverted */
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 4e7614b145db..7b6428234252 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -48,9 +48,6 @@ static void rcar_du_group_setup_defr8(struct rcar_du_group *rgrp)
48{ 48{
49 u32 defr8 = DEFR8_CODE | DEFR8_DEFE8; 49 u32 defr8 = DEFR8_CODE | DEFR8_DEFE8;
50 50
51 if (!rcar_du_has(rgrp->dev, RCAR_DU_FEATURE_DEFR8))
52 return;
53
54 /* The DEFR8 register for the first group also controls RGB output 51 /* The DEFR8 register for the first group also controls RGB output
55 * routing to DPAD0 52 * routing to DPAD0
56 */ 53 */
@@ -69,7 +66,8 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)
69 rcar_du_group_write(rgrp, DEFR4, DEFR4_CODE); 66 rcar_du_group_write(rgrp, DEFR4, DEFR4_CODE);
70 rcar_du_group_write(rgrp, DEFR5, DEFR5_CODE | DEFR5_DEFE5); 67 rcar_du_group_write(rgrp, DEFR5, DEFR5_CODE | DEFR5_DEFE5);
71 68
72 rcar_du_group_setup_defr8(rgrp); 69 if (rcar_du_has(rgrp->dev, RCAR_DU_FEATURE_EXT_CTRL_REGS))
70 rcar_du_group_setup_defr8(rgrp);
73 71
74 /* Use DS1PR and DS2PR to configure planes priorities and connects the 72 /* Use DS1PR and DS2PR to configure planes priorities and connects the
75 * superposition 0 to DU0 pins. DU1 pins will be configured dynamically. 73 * superposition 0 to DU0 pins. DU1 pins will be configured dynamically.
@@ -149,6 +147,9 @@ static int rcar_du_set_dpad0_routing(struct rcar_du_device *rcdu)
149{ 147{
150 int ret; 148 int ret;
151 149
150 if (!rcar_du_has(rcdu, RCAR_DU_FEATURE_EXT_CTRL_REGS))
151 return 0;
152
152 /* RGB output routing to DPAD0 is configured in the DEFR8 register of 153 /* RGB output routing to DPAD0 is configured in the DEFR8 register of
153 * the first group. As this function can be called with the DU0 and DU1 154 * the first group. As this function can be called with the DU0 and DU1
154 * CRTCs disabled, we need to enable the first group clock before 155 * CRTCs disabled, we need to enable the first group clock before