Skip to content

Commit 15f09a9

Browse files
committed
Merge tag 'du-next-20211206' of git://linuxtv.org/pinchartl/media into drm-next
R-Car DU updates: - DSI output support - Misc fixes Signed-off-by: Dave Airlie <[email protected]> From: Laurent Pinchart <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/Ya4/[email protected]
2 parents f8eb96b + 1553583 commit 15f09a9

File tree

8 files changed

+1159
-19
lines changed

8 files changed

+1159
-19
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/display/bridge/renesas,dsi-csi2-tx.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Renesas R-Car MIPI DSI/CSI-2 Encoder
8+
9+
maintainers:
10+
- Laurent Pinchart <[email protected]>
11+
12+
description: |
13+
This binding describes the MIPI DSI/CSI-2 encoder embedded in the Renesas
14+
R-Car V3U SoC. The encoder can operate in either DSI or CSI-2 mode, with up
15+
to four data lanes.
16+
17+
properties:
18+
compatible:
19+
enum:
20+
- renesas,r8a779a0-dsi-csi2-tx # for V3U
21+
22+
reg:
23+
maxItems: 1
24+
25+
clocks:
26+
items:
27+
- description: Functional clock
28+
- description: DSI (and CSI-2) functional clock
29+
- description: PLL reference clock
30+
31+
clock-names:
32+
items:
33+
- const: fck
34+
- const: dsi
35+
- const: pll
36+
37+
power-domains:
38+
maxItems: 1
39+
40+
resets:
41+
maxItems: 1
42+
43+
ports:
44+
$ref: /schemas/graph.yaml#/properties/ports
45+
46+
properties:
47+
port@0:
48+
$ref: /schemas/graph.yaml#/properties/port
49+
description: Parallel input port
50+
51+
port@1:
52+
$ref: /schemas/graph.yaml#/$defs/port-base
53+
unevaluatedProperties: false
54+
description: DSI/CSI-2 output port
55+
56+
properties:
57+
endpoint:
58+
$ref: /schemas/media/video-interfaces.yaml#
59+
unevaluatedProperties: false
60+
61+
properties:
62+
data-lanes:
63+
minItems: 1
64+
maxItems: 4
65+
66+
required:
67+
- data-lanes
68+
69+
required:
70+
- port@0
71+
- port@1
72+
73+
required:
74+
- compatible
75+
- reg
76+
- clocks
77+
- power-domains
78+
- resets
79+
- ports
80+
81+
additionalProperties: false
82+
83+
examples:
84+
- |
85+
#include <dt-bindings/clock/r8a779a0-cpg-mssr.h>
86+
#include <dt-bindings/power/r8a779a0-sysc.h>
87+
88+
dsi0: dsi-encoder@fed80000 {
89+
compatible = "renesas,r8a779a0-dsi-csi2-tx";
90+
reg = <0xfed80000 0x10000>;
91+
power-domains = <&sysc R8A779A0_PD_ALWAYS_ON>;
92+
clocks = <&cpg CPG_MOD 415>,
93+
<&cpg CPG_CORE R8A779A0_CLK_DSI>,
94+
<&cpg CPG_CORE R8A779A0_CLK_CP>;
95+
clock-names = "fck", "dsi", "pll";
96+
resets = <&cpg 415>;
97+
98+
ports {
99+
#address-cells = <1>;
100+
#size-cells = <0>;
101+
102+
port@0 {
103+
reg = <0>;
104+
dsi0_in: endpoint {
105+
remote-endpoint = <&du_out_dsi0>;
106+
};
107+
};
108+
109+
port@1 {
110+
reg = <1>;
111+
dsi0_out: endpoint {
112+
data-lanes = <1 2>;
113+
remote-endpoint = <&sn65dsi86_in>;
114+
};
115+
};
116+
};
117+
};
118+
...

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6414,6 +6414,7 @@ L: [email protected]
64146414
64156415
S: Supported
64166416
T: git git://linuxtv.org/pinchartl/media drm/du/next
6417+
F: Documentation/devicetree/bindings/display/bridge/renesas,dsi-csi2-tx.yaml
64176418
F: Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.yaml
64186419
F: Documentation/devicetree/bindings/display/bridge/renesas,lvds.yaml
64196420
F: Documentation/devicetree/bindings/display/renesas,du.yaml

drivers/gpu/drm/rcar-du/Kconfig

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ config DRM_RCAR_DU
44
depends on DRM && OF
55
depends on ARM || ARM64
66
depends on ARCH_RENESAS || COMPILE_TEST
7-
imply DRM_RCAR_CMM
8-
imply DRM_RCAR_LVDS
97
select DRM_KMS_HELPER
108
select DRM_KMS_CMA_HELPER
119
select DRM_GEM_CMA_HELPER
@@ -14,29 +12,45 @@ config DRM_RCAR_DU
1412
Choose this option if you have an R-Car chipset.
1513
If M is selected the module will be called rcar-du-drm.
1614

17-
config DRM_RCAR_CMM
18-
tristate "R-Car DU Color Management Module (CMM) Support"
19-
depends on DRM && OF
15+
config DRM_RCAR_USE_CMM
16+
bool "R-Car DU Color Management Module (CMM) Support"
2017
depends on DRM_RCAR_DU
18+
default DRM_RCAR_DU
2119
help
2220
Enable support for R-Car Color Management Module (CMM).
2321

22+
config DRM_RCAR_CMM
23+
def_tristate DRM_RCAR_DU
24+
depends on DRM_RCAR_USE_CMM
25+
2426
config DRM_RCAR_DW_HDMI
2527
tristate "R-Car Gen3 and RZ/G2 DU HDMI Encoder Support"
2628
depends on DRM && OF
2729
select DRM_DW_HDMI
2830
help
2931
Enable support for R-Car Gen3 or RZ/G2 internal HDMI encoder.
3032

33+
config DRM_RCAR_USE_LVDS
34+
bool "R-Car DU LVDS Encoder Support"
35+
depends on DRM_BRIDGE && OF
36+
default DRM_RCAR_DU
37+
help
38+
Enable support for the R-Car Display Unit embedded LVDS encoders.
39+
3140
config DRM_RCAR_LVDS
32-
tristate "R-Car DU LVDS Encoder Support"
33-
depends on DRM && DRM_BRIDGE && OF
41+
def_tristate DRM_RCAR_DU
42+
depends on DRM_RCAR_USE_LVDS
3443
select DRM_KMS_HELPER
3544
select DRM_PANEL
3645
select OF_FLATTREE
3746
select OF_OVERLAY
47+
48+
config DRM_RCAR_MIPI_DSI
49+
tristate "R-Car DU MIPI DSI Encoder Support"
50+
depends on DRM && DRM_BRIDGE && OF
51+
select DRM_MIPI_DSI
3852
help
39-
Enable support for the R-Car Display Unit embedded LVDS encoders.
53+
Enable support for the R-Car Display Unit embedded MIPI DSI encoders.
4054

4155
config DRM_RCAR_VSP
4256
bool "R-Car DU VSP Compositor Support" if ARM

drivers/gpu/drm/rcar-du/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ obj-$(CONFIG_DRM_RCAR_CMM) += rcar_cmm.o
1919
obj-$(CONFIG_DRM_RCAR_DU) += rcar-du-drm.o
2020
obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o
2121
obj-$(CONFIG_DRM_RCAR_LVDS) += rcar_lvds.o
22+
obj-$(CONFIG_DRM_RCAR_MIPI_DSI) += rcar_mipi_dsi.o
2223

2324
# 'remote-endpoint' is fixed up at run-time
2425
DTC_FLAGS_rcar_du_of_lvds_r8a7790 += -Wno-graph_endpoint

drivers/gpu/drm/rcar-du/rcar_du_crtc.c

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
215215
const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;
216216
struct rcar_du_device *rcdu = rcrtc->dev;
217217
unsigned long mode_clock = mode->clock * 1000;
218+
unsigned int hdse_offset;
218219
u32 dsmr;
219220
u32 escr;
220221

@@ -261,12 +262,13 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
261262
rcar_du_group_write(rcrtc->group, DPLLCR, dpllcr);
262263

263264
escr = ESCR_DCLKSEL_DCLKIN | div;
264-
} else if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index)) {
265+
} else if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index) ||
266+
rcdu->info->dsi_clk_mask & BIT(rcrtc->index)) {
265267
/*
266-
* Use the LVDS PLL output as the dot clock when outputting to
267-
* the LVDS encoder on an SoC that supports this clock routing
268-
* option. We use the clock directly in that case, without any
269-
* additional divider.
268+
* Use the external LVDS or DSI PLL output as the dot clock when
269+
* outputting to the LVDS or DSI encoder on an SoC that supports
270+
* this clock routing option. We use the clock directly in that
271+
* case, without any additional divider.
270272
*/
271273
escr = ESCR_DCLKSEL_DCLKIN;
272274
} else {
@@ -298,10 +300,15 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
298300
| DSMR_DIPM_DISP | DSMR_CSPM;
299301
rcar_du_crtc_write(rcrtc, DSMR, dsmr);
300302

303+
hdse_offset = 19;
304+
if (rcrtc->group->cmms_mask & BIT(rcrtc->index % 2))
305+
hdse_offset += 25;
306+
301307
/* Display timings */
302-
rcar_du_crtc_write(rcrtc, HDSR, mode->htotal - mode->hsync_start - 19);
308+
rcar_du_crtc_write(rcrtc, HDSR, mode->htotal - mode->hsync_start -
309+
hdse_offset);
303310
rcar_du_crtc_write(rcrtc, HDER, mode->htotal - mode->hsync_start +
304-
mode->hdisplay - 19);
311+
mode->hdisplay - hdse_offset);
305312
rcar_du_crtc_write(rcrtc, HSWR, mode->hsync_end -
306313
mode->hsync_start - 1);
307314
rcar_du_crtc_write(rcrtc, HCR, mode->htotal - 1);
@@ -836,16 +843,22 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc,
836843
struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
837844
struct rcar_du_device *rcdu = rcrtc->dev;
838845
bool interlaced = mode->flags & DRM_MODE_FLAG_INTERLACE;
846+
unsigned int min_sync_porch;
839847
unsigned int vbp;
840848

841849
if (interlaced && !rcar_du_has(rcdu, RCAR_DU_FEATURE_INTERLACED))
842850
return MODE_NO_INTERLACE;
843851

844852
/*
845853
* The hardware requires a minimum combined horizontal sync and back
846-
* porch of 20 pixels and a minimum vertical back porch of 3 lines.
854+
* porch of 20 pixels (when CMM isn't used) or 45 pixels (when CMM is
855+
* used), and a minimum vertical back porch of 3 lines.
847856
*/
848-
if (mode->htotal - mode->hsync_start < 20)
857+
min_sync_porch = 20;
858+
if (rcrtc->group->cmms_mask & BIT(rcrtc->index % 2))
859+
min_sync_porch += 25;
860+
861+
if (mode->htotal - mode->hsync_start < min_sync_porch)
849862
return MODE_HBLANK_NARROW;
850863

851864
vbp = (mode->vtotal - mode->vsync_end) / (interlaced ? 2 : 1);

drivers/gpu/drm/rcar-du/rcar_du_drv.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,12 @@ const char *rcar_du_output_name(enum rcar_du_output output)
544544
static const char * const names[] = {
545545
[RCAR_DU_OUTPUT_DPAD0] = "DPAD0",
546546
[RCAR_DU_OUTPUT_DPAD1] = "DPAD1",
547-
[RCAR_DU_OUTPUT_LVDS0] = "LVDS0",
548-
[RCAR_DU_OUTPUT_LVDS1] = "LVDS1",
547+
[RCAR_DU_OUTPUT_DSI0] = "DSI0",
548+
[RCAR_DU_OUTPUT_DSI1] = "DSI1",
549549
[RCAR_DU_OUTPUT_HDMI0] = "HDMI0",
550550
[RCAR_DU_OUTPUT_HDMI1] = "HDMI1",
551+
[RCAR_DU_OUTPUT_LVDS0] = "LVDS0",
552+
[RCAR_DU_OUTPUT_LVDS1] = "LVDS1",
551553
[RCAR_DU_OUTPUT_TCON] = "TCON",
552554
};
553555

0 commit comments

Comments
 (0)