2019-08-25 13:52:31

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 00/14] drm: rcar-du: Add Color Management Module (CMM)

Hello,
this is the third iteration of CMM support series.

A reference to the v1 cover letter, with some background on the CMM is
available here:
https://lkml.org/lkml/2019/6/6/583

The series is now based on the v5.3-rc4-based renesas-devel-2019-08-21 branch
of Geert's tree, which already contains the CMM clock enablement patches that
were part of v2 and which I have now dropped.

Notable changes in the iteratoin are:
- Added per-SoC compatible strings as requested by Geert: updated bindings and
DTS patches accordingly and dropped R-b tags from there.
- Rework of CMM driver:
- Use the DRM provided functions to extract and scale to HW precision the LUT
table entries as suggested by Uli.
- Re-worked the suspend/resume logic as suggested by Laurent:
- remove resume/suspend handlers from CMM driver
- handle re-enablement of CMM at DU resume time
- Use pm-runtime to handle clock enable/disable of CMM.
- Integration with DU:
- enforce suspend/resume ordering by creating a device_link between
DU (consumer) and CMM (supplier): DU suspends before and resume after CMM
- Force re-enablement of CMM by forcing the color_mgmt_changed flag of a
CRTC state which had the CMM in use at DU resume time.

Compared to v2 system suspend/resume has been more thoughtfully tested by
running an application program which uses the CMM, suspending and resuming
the system and making sure the DU and the CMM are still operational.

Tested on M3-[W|N] with HDMI output.

The test application used to verify the LUT operations is available at:
https://jmondi.org/cgit/kmsxx/
where a color-inversion 1D-LUT table is applied.

The testing provides good results when running in 'flip' mode, where colors seem
actually inverted. I'm less certain about the 'non-flip' static image mode as
it seems red/green/yellow colors get all reduced to a shade of black. Other
opinions and testing with more realistic use-cases are of course very welcome.

Thanks
j

Jacopo Mondi (14):
dt-bindings: display: renesas,cmm: Add R-Car CMM documentation
dt-bindings: display, renesas,du: Document cmms property
arm64: dts: renesas: r8a7796: Add CMM units
arm64: dts: renesas: r8a7795: Add CMM units
arm64: dts: renesas: r8a77965: Add CMM units
arm64: dts: renesas: r8a77990: Add CMM units
arm64: dts: renesas: r8a77995: Add CMM units
drm: rcar-du: Add support for CMM
drm: rcar-du: Claim CMM support for Gen3 SoCs
drm: rcar-du: kms: Collect CMM instances
drm: rcar-du: crtc: Enable and disable CMMs
drm: rcar-du: crtc: Register GAMMA_LUT properties
drm: rcar-du: kms: Update CMM in atomic commit tail
drm: rcar-du: Force CMM enablement when resuming

.../bindings/display/renesas,cmm.txt | 33 +++
.../bindings/display/renesas,du.txt | 5 +
arch/arm64/boot/dts/renesas/r8a7795.dtsi | 36 ++-
arch/arm64/boot/dts/renesas/r8a7796.dtsi | 25 ++
arch/arm64/boot/dts/renesas/r8a77965.dtsi | 25 ++
arch/arm64/boot/dts/renesas/r8a77990.dtsi | 20 +-
arch/arm64/boot/dts/renesas/r8a77995.dtsi | 20 +-
drivers/gpu/drm/rcar-du/Kconfig | 7 +
drivers/gpu/drm/rcar-du/Makefile | 1 +
drivers/gpu/drm/rcar-du/rcar_cmm.c | 262 ++++++++++++++++++
drivers/gpu/drm/rcar-du/rcar_cmm.h | 38 +++
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 17 ++
drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 2 +
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 33 ++-
drivers/gpu/drm/rcar-du/rcar_du_drv.h | 4 +
drivers/gpu/drm/rcar-du/rcar_du_group.c | 8 +
drivers/gpu/drm/rcar-du/rcar_du_group.h | 2 +
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 98 +++++++
drivers/gpu/drm/rcar-du/rcar_du_regs.h | 5 +
19 files changed, 634 insertions(+), 7 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/renesas,cmm.txt
create mode 100644 drivers/gpu/drm/rcar-du/rcar_cmm.c
create mode 100644 drivers/gpu/drm/rcar-du/rcar_cmm.h

--
2.22.0


2019-08-25 13:52:31

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Add device tree bindings documentation for the Renesas R-Car Display
Unit Color Management Module.

CMM is the image enhancement module available on each R-Car DU video
channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).

Signed-off-by: Jacopo Mondi <[email protected]>
---
.../bindings/display/renesas,cmm.txt | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/renesas,cmm.txt

diff --git a/Documentation/devicetree/bindings/display/renesas,cmm.txt b/Documentation/devicetree/bindings/display/renesas,cmm.txt
new file mode 100644
index 000000000000..bc599b69c278
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
@@ -0,0 +1,33 @@
+* Renesas R-Car Color Management Module (CMM)
+
+Renesas R-Car image enhancement module connected to R-Car DU video channels.
+
+Required properties:
+ - compatible: shall be one or more of the following:
+ - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
+ - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
+ - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
+ - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
+ - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.
+ - "renesas,rcar-gen3-cmm": for a generic R-Car Gen3 compatible CMM.
+ - "renesas,rcar-gen2-cmm": for a generic R-Car Gen2 compatible CMM.
+
+ When the generic compatible string is specified, the SoC-specific
+ version corresponding to the platform should be listed first.
+
+ - reg: the address base and length of the memory area where CMM control
+ registers are mapped to.
+
+ - clocks: phandle and clock-specifier pair to the CMM functional clock
+ supplier.
+
+Example:
+--------
+
+ cmm0: cmm@fea40000 {
+ compatible = "renesas,cmm-r8a7796";
+ reg = <0 0xfea40000 0 0x1000>;
+ power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
+ clocks = <&cpg CPG_MOD 711>;
+ resets = <&cpg 711>;
+ };
--
2.22.0

2019-08-25 13:52:35

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 09/14] drm: rcar-du: Claim CMM support for Gen3 SoCs

Add CMM to the list of supported features for Gen3 SoCs that provide it:
- R8A7795
- R8A7796
- R8A77965
- R8A7799x

Leave R8A77970 out as V3M and V3H are the only Gen3 SoCs that do not
support CMM.

Reviewed-by: Ulrich Hecht <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 12 ++++++++----
drivers/gpu/drm/rcar-du/rcar_du_drv.h | 1 +
2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 6df37c2a9678..018480a8f35c 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -276,7 +276,8 @@ static const struct rcar_du_device_info rcar_du_r8a7795_info = {
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
| RCAR_DU_FEATURE_VSP1_SOURCE
| RCAR_DU_FEATURE_INTERLACED
- | RCAR_DU_FEATURE_TVM_SYNC,
+ | RCAR_DU_FEATURE_TVM_SYNC
+ | RCAR_DU_FEATURE_CMM,
.channels_mask = BIT(3) | BIT(2) | BIT(1) | BIT(0),
.routes = {
/*
@@ -309,7 +310,8 @@ static const struct rcar_du_device_info rcar_du_r8a7796_info = {
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
| RCAR_DU_FEATURE_VSP1_SOURCE
| RCAR_DU_FEATURE_INTERLACED
- | RCAR_DU_FEATURE_TVM_SYNC,
+ | RCAR_DU_FEATURE_TVM_SYNC
+ | RCAR_DU_FEATURE_CMM,
.channels_mask = BIT(2) | BIT(1) | BIT(0),
.routes = {
/*
@@ -338,7 +340,8 @@ static const struct rcar_du_device_info rcar_du_r8a77965_info = {
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
| RCAR_DU_FEATURE_VSP1_SOURCE
| RCAR_DU_FEATURE_INTERLACED
- | RCAR_DU_FEATURE_TVM_SYNC,
+ | RCAR_DU_FEATURE_TVM_SYNC
+ | RCAR_DU_FEATURE_CMM,
.channels_mask = BIT(3) | BIT(1) | BIT(0),
.routes = {
/*
@@ -386,7 +389,8 @@ static const struct rcar_du_device_info rcar_du_r8a77970_info = {
static const struct rcar_du_device_info rcar_du_r8a7799x_info = {
.gen = 3,
.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
- | RCAR_DU_FEATURE_VSP1_SOURCE,
+ | RCAR_DU_FEATURE_VSP1_SOURCE
+ | RCAR_DU_FEATURE_CMM,
.channels_mask = BIT(1) | BIT(0),
.routes = {
/*
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
index 1327cd0df90a..a00dccc447aa 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
@@ -28,6 +28,7 @@ struct rcar_du_encoder;
#define RCAR_DU_FEATURE_VSP1_SOURCE BIT(1) /* Has inputs from VSP1 */
#define RCAR_DU_FEATURE_INTERLACED BIT(2) /* HW supports interlaced */
#define RCAR_DU_FEATURE_TVM_SYNC BIT(3) /* Has TV switch/sync modes */
+#define RCAR_DU_FEATURE_CMM BIT(4) /* Has CMM */

#define RCAR_DU_QUIRK_ALIGN_128B BIT(0) /* Align pitches to 128 bytes */

--
2.22.0

2019-08-25 13:52:37

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 11/14] drm: rcar-du: crtc: Enable and disable CMMs

Enable/disable the CMM associated with a CRTC at CRTC start and stop
time and enable the CMM unit through the Display Extensional Functions
register at group setup time.

Reviewed-by: Ulrich Hecht <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 7 +++++++
drivers/gpu/drm/rcar-du/rcar_du_group.c | 8 ++++++++
drivers/gpu/drm/rcar-du/rcar_du_regs.h | 5 +++++
3 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 23f1d6cc1719..3dac605c3a67 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -21,6 +21,7 @@
#include <drm/drm_plane_helper.h>
#include <drm/drm_vblank.h>

+#include "rcar_cmm.h"
#include "rcar_du_crtc.h"
#include "rcar_du_drv.h"
#include "rcar_du_encoder.h"
@@ -619,6 +620,9 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
if (rcar_du_has(rcrtc->dev, RCAR_DU_FEATURE_VSP1_SOURCE))
rcar_du_vsp_disable(rcrtc);

+ if (rcrtc->cmm)
+ rcar_cmm_disable(rcrtc->cmm);
+
/*
* Select switch sync mode. This stops display operation and configures
* the HSYNC and VSYNC signals as inputs.
@@ -686,6 +690,9 @@ static void rcar_du_crtc_atomic_enable(struct drm_crtc *crtc,
}

rcar_du_crtc_start(rcrtc);
+
+ if (rcrtc->cmm)
+ rcar_cmm_enable(rcrtc->cmm);
}

static void rcar_du_crtc_atomic_disable(struct drm_crtc *crtc,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 9eee47969e77..25d0fc125d7a 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -147,6 +147,14 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)

rcar_du_group_setup_pins(rgrp);

+ if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CMM)) {
+ u32 defr7 = DEFR7_CODE
+ | (rgrp->cmms_mask & BIT(1) ? DEFR7_CMME1 : 0)
+ | (rgrp->cmms_mask & BIT(0) ? DEFR7_CMME0 : 0);
+
+ rcar_du_group_write(rgrp, DEFR7, defr7);
+ }
+
if (rcdu->info->gen >= 2) {
rcar_du_group_setup_defr8(rgrp);
rcar_du_group_setup_didsr(rgrp);
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_regs.h b/drivers/gpu/drm/rcar-du/rcar_du_regs.h
index bc87f080b170..fb9964949368 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_regs.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_regs.h
@@ -197,6 +197,11 @@
#define DEFR6_MLOS1 (1 << 2)
#define DEFR6_DEFAULT (DEFR6_CODE | DEFR6_TCNE1)

+#define DEFR7 0x000ec
+#define DEFR7_CODE (0x7779 << 16)
+#define DEFR7_CMME1 BIT(6)
+#define DEFR7_CMME0 BIT(4)
+
/* -----------------------------------------------------------------------------
* R8A7790-only Control Registers
*/
--
2.22.0

2019-08-25 13:53:33

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 13/14] drm: rcar-du: kms: Update CMM in atomic commit tail

Update CMM settings at in the atomic commit tail helper method.

The CMM is updated with new gamma values provided to the driver
in the GAMMA_LUT blob property.

Reviewed-by: Ulrich Hecht <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 61ca1d3c379a..047fdb982a11 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -22,6 +22,7 @@
#include <linux/of_platform.h>
#include <linux/wait.h>

+#include "rcar_cmm.h"
#include "rcar_du_crtc.h"
#include "rcar_du_drv.h"
#include "rcar_du_encoder.h"
@@ -368,6 +369,37 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
* Atomic Check and Update
*/

+static void rcar_du_atomic_commit_update_cmm(struct drm_crtc *crtc,
+ struct drm_crtc_state *old_state)
+{
+ struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
+ struct rcar_cmm_config cmm_config = {};
+
+ if (!rcrtc->cmm || !crtc->state->color_mgmt_changed)
+ return;
+
+ if (!crtc->state->gamma_lut) {
+ cmm_config.lut.enable = false;
+ rcar_cmm_setup(rcrtc->cmm, &cmm_config);
+
+ return;
+ }
+
+ cmm_config.lut.enable = true;
+ cmm_config.lut.table = (struct drm_color_lut *)
+ crtc->state->gamma_lut->data;
+
+ /* Set LUT table size to 0 if entries should not be updated. */
+ if (!old_state->gamma_lut ||
+ old_state->gamma_lut->base.id != crtc->state->gamma_lut->base.id)
+ cmm_config.lut.size = crtc->state->gamma_lut->length
+ / sizeof(cmm_config.lut.table[0]);
+ else
+ cmm_config.lut.size = 0;
+
+ rcar_cmm_setup(rcrtc->cmm, &cmm_config);
+}
+
static int rcar_du_atomic_check(struct drm_device *dev,
struct drm_atomic_state *state)
{
@@ -410,6 +442,9 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
rcdu->dpad1_source = rcrtc->index;
}

+ for_each_old_crtc_in_state(old_state, crtc, crtc_state, i)
+ rcar_du_atomic_commit_update_cmm(crtc, crtc_state);
+
/* Apply the atomic update. */
drm_atomic_helper_commit_modeset_disables(dev, old_state);
drm_atomic_helper_commit_planes(dev, old_state,
--
2.22.0

2019-08-25 13:53:34

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 14/14] drm: rcar-du: Force CMM enablement when resuming

When resuming from system suspend, the DU driver is responsible for
reprogramming and enabling the CMM unit if it was in use at the time
the system entered the suspend state.

Force the color_mgmt_changed flag to true if any of the DRM color
transformation properties was set in the CRTC state duplicated at
suspend time, as the CMM gets reprogrammed only if said flag is active in
the rcar_du_atomic_commit_update_cmm() method.

Signed-off-by: Jacopo Mondi <[email protected]>
---
drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 018480a8f35c..6e38495fb78f 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -17,6 +17,7 @@
#include <linux/slab.h>
#include <linux/wait.h>

+#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_fb_cma_helper.h>
#include <drm/drm_fb_helper.h>
@@ -482,6 +483,26 @@ static int rcar_du_pm_suspend(struct device *dev)
static int rcar_du_pm_resume(struct device *dev)
{
struct rcar_du_device *rcdu = dev_get_drvdata(dev);
+ struct drm_atomic_state *state = rcdu->ddev->mode_config.suspend_state;
+ unsigned int i;
+
+ for (i = 0; i < rcdu->num_crtcs; ++i) {
+ struct drm_crtc *crtc = &rcdu->crtcs[i].crtc;
+ struct drm_crtc_state *crtc_state;
+
+ crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
+ if (!crtc_state)
+ continue;
+
+ /*
+ * Force re-enablement of CMM after system resume if any
+ * of the DRM color transformation properties was set in
+ * the state saved at system suspend time.
+ */
+ if (crtc_state->gamma_lut || crtc_state->degamma_lut ||
+ crtc_state->ctm)
+ crtc_state->color_mgmt_changed = true;
+ }

return drm_mode_config_helper_resume(rcdu->ddev);
}
--
2.22.0

2019-08-25 13:53:46

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 06/14] arm64: dts: renesas: r8a77990: Add CMM units

Add CMM units to Renesas R-Car E3 device tree and reference them from
the Display Unit they are connected to.

While at it, re-sort the du device node properties to match the ordering
found in other SoCs.

Signed-off-by: Jacopo Mondi <[email protected]>
---
arch/arm64/boot/dts/renesas/r8a77990.dtsi | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
index 455954c3d98e..89ebe6f565af 100644
--- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
@@ -1727,6 +1727,22 @@
iommus = <&ipmmu_vi0 9>;
};

+ cmm0: cmm@fea40000 {
+ compatible = "renesas,cmm-r8a77990";
+ reg = <0 0xfea40000 0 0x1000>;
+ clocks = <&cpg CPG_MOD 711>;
+ power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+ resets = <&cpg 711>;
+ };
+
+ cmm1: cmm@fea50000 {
+ compatible = "renesas,cmm-r8a77990";
+ reg = <0 0xfea50000 0 0x1000>;
+ clocks = <&cpg CPG_MOD 710>;
+ power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
+ resets = <&cpg 710>;
+ };
+
csi40: csi2@feaa0000 {
compatible = "renesas,r8a77990-csi2";
reg = <0 0xfeaa0000 0 0x10000>;
@@ -1768,9 +1784,11 @@
clock-names = "du.0", "du.1";
resets = <&cpg 724>;
reset-names = "du.0";
- vsps = <&vspd0 0>, <&vspd1 0>;
status = "disabled";

+ vsps = <&vspd0 0>, <&vspd1 0>;
+ cmms = <&cmm0 &cmm1>;
+
ports {
#address-cells = <1>;
#size-cells = <0>;
--
2.22.0

2019-08-25 13:53:47

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 04/14] arm64: dts: renesas: r8a7795: Add CMM units

Add CMM units to Renesas R-Car H3 device tree and reference them from
the Display Unit they are connected to.

While at it, re-sort the du device node properties to match the ordering
found in other SoCs.

Signed-off-by: Jacopo Mondi <[email protected]>
---
arch/arm64/boot/dts/renesas/r8a7795.dtsi | 36 +++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
index 95deff66eeb6..21b4069f07e7 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
@@ -2909,6 +2909,38 @@
iommus = <&ipmmu_vi1 10>;
};

+ cmm0: cmm@fea40000 {
+ compatible = "renesas,cmm-r8a7795";
+ reg = <0 0xfea40000 0 0x1000>;
+ clocks = <&cpg CPG_MOD 711>;
+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+ resets = <&cpg 711>;
+ };
+
+ cmm1: cmm@fea50000 {
+ compatible = "renesas,cmm-r8a7795";
+ reg = <0 0xfea50000 0 0x1000>;
+ clocks = <&cpg CPG_MOD 710>;
+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+ resets = <&cpg 710>;
+ };
+
+ cmm2: cmm@fea60000 {
+ compatible = "renesas,cmm-r8a7795";
+ reg = <0 0xfea60000 0 0x1000>;
+ clocks = <&cpg CPG_MOD 709>;
+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+ resets = <&cpg 709>;
+ };
+
+ cmm3: cmm@fea70000 {
+ compatible = "renesas,cmm-r8a7795";
+ reg = <0 0xfea70000 0 0x1000>;
+ clocks = <&cpg CPG_MOD 708>;
+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
+ resets = <&cpg 708>;
+ };
+
csi20: csi2@fea80000 {
compatible = "renesas,r8a7795-csi2";
reg = <0 0xfea80000 0 0x10000>;
@@ -3112,9 +3144,11 @@
<&cpg CPG_MOD 722>,
<&cpg CPG_MOD 721>;
clock-names = "du.0", "du.1", "du.2", "du.3";
- vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
status = "disabled";

+ vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
+ cmms = <&cmm0 &cmm1 &cmm2 &cmm3>;
+
ports {
#address-cells = <1>;
#size-cells = <0>;
--
2.22.0

2019-08-25 13:54:44

by Jacopo Mondi

[permalink] [raw]
Subject: [PATCH v3 12/14] drm: rcar-du: crtc: Register GAMMA_LUT properties

Enable the GAMMA_LUT KMS property using the framework helpers to
register the property and set the associated gamma table maximum size.

Reviewed-by: Ulrich Hecht <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Jacopo Mondi <[email protected]>
---
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 3dac605c3a67..222ccc20d6d8 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -1082,6 +1082,7 @@ static const struct drm_crtc_funcs crtc_funcs_gen3 = {
.set_crc_source = rcar_du_crtc_set_crc_source,
.verify_crc_source = rcar_du_crtc_verify_crc_source,
.get_crc_sources = rcar_du_crtc_get_crc_sources,
+ .gamma_set = drm_atomic_helper_legacy_gamma_set,
};

/* -----------------------------------------------------------------------------
@@ -1205,6 +1206,9 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
if (rcdu->cmms[swindex]) {
rcrtc->cmm = rcdu->cmms[swindex];
rgrp->cmms_mask |= BIT(hwindex % 2);
+
+ drm_mode_crtc_set_gamma_size(crtc, CMM_GAMMA_LUT_SIZE);
+ drm_crtc_enable_color_mgmt(crtc, 0, false, CMM_GAMMA_LUT_SIZE);
}

drm_crtc_helper_add(crtc, &crtc_helper_funcs);
--
2.22.0

2019-08-26 07:37:15

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Jacopo,

On Sun, Aug 25, 2019 at 3:50 PM Jacopo Mondi <[email protected]> wrote:
> Add device tree bindings documentation for the Renesas R-Car Display
> Unit Color Management Module.
>
> CMM is the image enhancement module available on each R-Car DU video
> channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).
>
> Signed-off-by: Jacopo Mondi <[email protected]>

Thanks for your patch!

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
> @@ -0,0 +1,33 @@
> +* Renesas R-Car Color Management Module (CMM)
> +
> +Renesas R-Car image enhancement module connected to R-Car DU video channels.
> +
> +Required properties:
> + - compatible: shall be one or more of the following:
> + - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
> + - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
> + - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
> + - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
> + - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.

Please use "renesas,<socype->-cmm" instead of "renesas,cmm-<soctype>".

> + - "renesas,rcar-gen3-cmm": for a generic R-Car Gen3 compatible CMM.
> + - "renesas,rcar-gen2-cmm": for a generic R-Car Gen2 compatible CMM.
> +
> + When the generic compatible string is specified, the SoC-specific
> + version corresponding to the platform should be listed first.
> +
> + - reg: the address base and length of the memory area where CMM control
> + registers are mapped to.
> +
> + - clocks: phandle and clock-specifier pair to the CMM functional clock
> + supplier.

Thinking about yaml validation:

power-domains?
resets?

> +Example:
> +--------
> +
> + cmm0: cmm@fea40000 {
> + compatible = "renesas,cmm-r8a7796";
> + reg = <0 0xfea40000 0 0x1000>;
> + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
> + clocks = <&cpg CPG_MOD 711>;
> + resets = <&cpg 711>;
> + };

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-08-26 08:00:50

by jacopo mondi

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Geert,

On Mon, Aug 26, 2019 at 09:34:41AM +0200, Geert Uytterhoeven wrote:
> Hi Jacopo,
>
> On Sun, Aug 25, 2019 at 3:50 PM Jacopo Mondi <[email protected]> wrote:
> > Add device tree bindings documentation for the Renesas R-Car Display
> > Unit Color Management Module.
> >
> > CMM is the image enhancement module available on each R-Car DU video
> > channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).
> >
> > Signed-off-by: Jacopo Mondi <[email protected]>
>
> Thanks for your patch!
>
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
> > @@ -0,0 +1,33 @@
> > +* Renesas R-Car Color Management Module (CMM)
> > +
> > +Renesas R-Car image enhancement module connected to R-Car DU video channels.
> > +
> > +Required properties:
> > + - compatible: shall be one or more of the following:
> > + - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
> > + - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
> > + - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
> > + - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
> > + - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.
>
> Please use "renesas,<socype->-cmm" instead of "renesas,cmm-<soctype>".
>

I actually copied it from the r-car gpio bindings, and I liked
cmm-<soctype> better. If you prefer I can change it though.

> > + - "renesas,rcar-gen3-cmm": for a generic R-Car Gen3 compatible CMM.
> > + - "renesas,rcar-gen2-cmm": for a generic R-Car Gen2 compatible CMM.
> > +
> > + When the generic compatible string is specified, the SoC-specific
> > + version corresponding to the platform should be listed first.
> > +
> > + - reg: the address base and length of the memory area where CMM control
> > + registers are mapped to.
> > +
> > + - clocks: phandle and clock-specifier pair to the CMM functional clock
> > + supplier.
>
> Thinking about yaml validation:
>
> power-domains?
> resets?
>

They should indeed be documented.

Thanks
j

> > +Example:
> > +--------
> > +
> > + cmm0: cmm@fea40000 {
> > + compatible = "renesas,cmm-r8a7796";
> > + reg = <0 0xfea40000 0 0x1000>;
> > + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
> > + clocks = <&cpg CPG_MOD 711>;
> > + resets = <&cpg 711>;
> > + };
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds


Attachments:
(No filename) (2.78 kB)
signature.asc (849.00 B)
Download all attachments

2019-08-26 08:48:35

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Jacopo,

On Mon, Aug 26, 2019 at 9:58 AM Jacopo Mondi <[email protected]> wrote:
> On Mon, Aug 26, 2019 at 09:34:41AM +0200, Geert Uytterhoeven wrote:
> > On Sun, Aug 25, 2019 at 3:50 PM Jacopo Mondi <[email protected]> wrote:
> > > Add device tree bindings documentation for the Renesas R-Car Display
> > > Unit Color Management Module.
> > >
> > > CMM is the image enhancement module available on each R-Car DU video
> > > channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).
> > >
> > > Signed-off-by: Jacopo Mondi <[email protected]>
> >
> > Thanks for your patch!
> >
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
> > > @@ -0,0 +1,33 @@
> > > +* Renesas R-Car Color Management Module (CMM)
> > > +
> > > +Renesas R-Car image enhancement module connected to R-Car DU video channels.
> > > +
> > > +Required properties:
> > > + - compatible: shall be one or more of the following:
> > > + - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
> > > + - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
> > > + - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
> > > + - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
> > > + - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.
> >
> > Please use "renesas,<socype->-cmm" instead of "renesas,cmm-<soctype>".
> >
>
> I actually copied it from the r-car gpio bindings, and I liked
> cmm-<soctype> better. If you prefer I can change it though.

We switched from "renesas,cmm-<soctype>" to "renesas,<socype->-cmm"
a few years ago, upon request from the DT people:

vendor -> family/SoC -> IP core

Unfortunately we cannot change the old style in existing bindings, without
great effort and backwards compatibility ramifications.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2019-08-26 10:41:13

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Jacopo,

On Mon, Aug 26, 2019 at 09:59:43AM +0200, Jacopo Mondi wrote:
> On Mon, Aug 26, 2019 at 09:34:41AM +0200, Geert Uytterhoeven wrote:
> > On Sun, Aug 25, 2019 at 3:50 PM Jacopo Mondi <[email protected]> wrote:
> > > Add device tree bindings documentation for the Renesas R-Car Display
> > > Unit Color Management Module.
> > >
> > > CMM is the image enhancement module available on each R-Car DU video
> > > channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).
> > >
> > > Signed-off-by: Jacopo Mondi <[email protected]>
> >
> > Thanks for your patch!
> >
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
> > > @@ -0,0 +1,33 @@
> > > +* Renesas R-Car Color Management Module (CMM)
> > > +
> > > +Renesas R-Car image enhancement module connected to R-Car DU video channels.
> > > +
> > > +Required properties:
> > > + - compatible: shall be one or more of the following:
> > > + - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
> > > + - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
> > > + - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
> > > + - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
> > > + - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.
> >
> > Please use "renesas,<socype->-cmm" instead of "renesas,cmm-<soctype>".
>
> I actually copied it from the r-car gpio bindings, and I liked
> cmm-<soctype> better. If you prefer I can change it though.
>
> > > + - "renesas,rcar-gen3-cmm": for a generic R-Car Gen3 compatible CMM.
> > > + - "renesas,rcar-gen2-cmm": for a generic R-Car Gen2 compatible CMM.
> > > +
> > > + When the generic compatible string is specified, the SoC-specific
> > > + version corresponding to the platform should be listed first.
> > > +
> > > + - reg: the address base and length of the memory area where CMM control
> > > + registers are mapped to.
> > > +
> > > + - clocks: phandle and clock-specifier pair to the CMM functional clock
> > > + supplier.
> >
> > Thinking about yaml validation:
> >
> > power-domains?
> > resets?
>
> They should indeed be documented.

How about converting this binding to yaml alreay ? It should be fairly
simple.

> > > +Example:
> > > +--------
> > > +
> > > + cmm0: cmm@fea40000 {
> > > + compatible = "renesas,cmm-r8a7796";
> > > + reg = <0 0xfea40000 0 0x1000>;
> > > + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
> > > + clocks = <&cpg CPG_MOD 711>;
> > > + resets = <&cpg 711>;
> > > + };

--
Regards,

Laurent Pinchart

2019-08-26 22:46:59

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 04/14] arm64: dts: renesas: r8a7795: Add CMM units

Hi Jacopo,

Thank you for the patch.

On Sun, Aug 25, 2019 at 03:51:44PM +0200, Jacopo Mondi wrote:
> Add CMM units to Renesas R-Car H3 device tree and reference them from
> the Display Unit they are connected to.
>
> While at it, re-sort the du device node properties to match the ordering
> found in other SoCs.
>
> Signed-off-by: Jacopo Mondi <[email protected]>

Apart from the issue with compatible string as pointed out for patch
03/14,

Reviewed-by: Laurent Pinchart <[email protected]>

> ---
> arch/arm64/boot/dts/renesas/r8a7795.dtsi | 36 +++++++++++++++++++++++-
> 1 file changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/renesas/r8a7795.dtsi b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> index 95deff66eeb6..21b4069f07e7 100644
> --- a/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a7795.dtsi
> @@ -2909,6 +2909,38 @@
> iommus = <&ipmmu_vi1 10>;
> };
>
> + cmm0: cmm@fea40000 {
> + compatible = "renesas,cmm-r8a7795";
> + reg = <0 0xfea40000 0 0x1000>;
> + clocks = <&cpg CPG_MOD 711>;
> + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
> + resets = <&cpg 711>;
> + };
> +
> + cmm1: cmm@fea50000 {
> + compatible = "renesas,cmm-r8a7795";
> + reg = <0 0xfea50000 0 0x1000>;
> + clocks = <&cpg CPG_MOD 710>;
> + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
> + resets = <&cpg 710>;
> + };
> +
> + cmm2: cmm@fea60000 {
> + compatible = "renesas,cmm-r8a7795";
> + reg = <0 0xfea60000 0 0x1000>;
> + clocks = <&cpg CPG_MOD 709>;
> + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
> + resets = <&cpg 709>;
> + };
> +
> + cmm3: cmm@fea70000 {
> + compatible = "renesas,cmm-r8a7795";
> + reg = <0 0xfea70000 0 0x1000>;
> + clocks = <&cpg CPG_MOD 708>;
> + power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
> + resets = <&cpg 708>;
> + };
> +
> csi20: csi2@fea80000 {
> compatible = "renesas,r8a7795-csi2";
> reg = <0 0xfea80000 0 0x10000>;
> @@ -3112,9 +3144,11 @@
> <&cpg CPG_MOD 722>,
> <&cpg CPG_MOD 721>;
> clock-names = "du.0", "du.1", "du.2", "du.3";
> - vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
> status = "disabled";
>
> + vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
> + cmms = <&cmm0 &cmm1 &cmm2 &cmm3>;
> +
> ports {
> #address-cells = <1>;
> #size-cells = <0>;

--
Regards,

Laurent Pinchart

2019-08-26 22:50:00

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 06/14] arm64: dts: renesas: r8a77990: Add CMM units

Hi Jacopo,

Thank you for the patch.

On Sun, Aug 25, 2019 at 03:51:46PM +0200, Jacopo Mondi wrote:
> Add CMM units to Renesas R-Car E3 device tree and reference them from
> the Display Unit they are connected to.
>
> While at it, re-sort the du device node properties to match the ordering
> found in other SoCs.
>
> Signed-off-by: Jacopo Mondi <[email protected]>

Apart from the issue with compatible string as pointed out for patch
03/14,

Reviewed-by: Laurent Pinchart <[email protected]>

> ---
> arch/arm64/boot/dts/renesas/r8a77990.dtsi | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> index 455954c3d98e..89ebe6f565af 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi
> @@ -1727,6 +1727,22 @@
> iommus = <&ipmmu_vi0 9>;
> };
>
> + cmm0: cmm@fea40000 {
> + compatible = "renesas,cmm-r8a77990";
> + reg = <0 0xfea40000 0 0x1000>;
> + clocks = <&cpg CPG_MOD 711>;
> + power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
> + resets = <&cpg 711>;
> + };
> +
> + cmm1: cmm@fea50000 {
> + compatible = "renesas,cmm-r8a77990";
> + reg = <0 0xfea50000 0 0x1000>;
> + clocks = <&cpg CPG_MOD 710>;
> + power-domains = <&sysc R8A77990_PD_ALWAYS_ON>;
> + resets = <&cpg 710>;
> + };
> +
> csi40: csi2@feaa0000 {
> compatible = "renesas,r8a77990-csi2";
> reg = <0 0xfeaa0000 0 0x10000>;
> @@ -1768,9 +1784,11 @@
> clock-names = "du.0", "du.1";
> resets = <&cpg 724>;
> reset-names = "du.0";
> - vsps = <&vspd0 0>, <&vspd1 0>;
> status = "disabled";
>
> + vsps = <&vspd0 0>, <&vspd1 0>;
> + cmms = <&cmm0 &cmm1>;
> +
> ports {
> #address-cells = <1>;
> #size-cells = <0>;

--
Regards,

Laurent Pinchart

2019-08-27 00:01:35

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 13/14] drm: rcar-du: kms: Update CMM in atomic commit tail

Hi Jacopo,

Thank you for the patch.

On Sun, Aug 25, 2019 at 03:51:53PM +0200, Jacopo Mondi wrote:
> Update CMM settings at in the atomic commit tail helper method.
>
> The CMM is updated with new gamma values provided to the driver
> in the GAMMA_LUT blob property.
>
> Reviewed-by: Ulrich Hecht <[email protected]>
> Reviewed-by: Laurent Pinchart <[email protected]>
> Signed-off-by: Jacopo Mondi <[email protected]>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index 61ca1d3c379a..047fdb982a11 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -22,6 +22,7 @@
> #include <linux/of_platform.h>
> #include <linux/wait.h>
>
> +#include "rcar_cmm.h"
> #include "rcar_du_crtc.h"
> #include "rcar_du_drv.h"
> #include "rcar_du_encoder.h"
> @@ -368,6 +369,37 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
> * Atomic Check and Update
> */
>
> +static void rcar_du_atomic_commit_update_cmm(struct drm_crtc *crtc,
> + struct drm_crtc_state *old_state)
> +{
> + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> + struct rcar_cmm_config cmm_config = {};
> +
> + if (!rcrtc->cmm || !crtc->state->color_mgmt_changed)
> + return;
> +
> + if (!crtc->state->gamma_lut) {
> + cmm_config.lut.enable = false;
> + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> +
> + return;
> + }
> +
> + cmm_config.lut.enable = true;
> + cmm_config.lut.table = (struct drm_color_lut *)
> + crtc->state->gamma_lut->data;
> +
> + /* Set LUT table size to 0 if entries should not be updated. */
> + if (!old_state->gamma_lut ||
> + old_state->gamma_lut->base.id != crtc->state->gamma_lut->base.id)
> + cmm_config.lut.size = crtc->state->gamma_lut->length
> + / sizeof(cmm_config.lut.table[0]);

It has just occurred to me that the hardware only support LUTs of
exactly 256 entries. Should we remove cmm_config.lut.size (simplifying
the code in the CMM driver), and add a check to the CRTC .atomic_check()
handler to reject invalid LUTs ? Sorry for not having caught this
earlier.

> + else
> + cmm_config.lut.size = 0;
> +
> + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> +}
> +
> static int rcar_du_atomic_check(struct drm_device *dev,
> struct drm_atomic_state *state)
> {
> @@ -410,6 +442,9 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
> rcdu->dpad1_source = rcrtc->index;
> }
>
> + for_each_old_crtc_in_state(old_state, crtc, crtc_state, i)
> + rcar_du_atomic_commit_update_cmm(crtc, crtc_state);
> +
> /* Apply the atomic update. */
> drm_atomic_helper_commit_modeset_disables(dev, old_state);
> drm_atomic_helper_commit_planes(dev, old_state,

--
Regards,

Laurent Pinchart

2019-08-27 00:06:33

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 14/14] drm: rcar-du: Force CMM enablement when resuming

Hi Jacopo,

(Question for Daniel below)

Thank you for the patch.

On Sun, Aug 25, 2019 at 03:51:54PM +0200, Jacopo Mondi wrote:
> When resuming from system suspend, the DU driver is responsible for
> reprogramming and enabling the CMM unit if it was in use at the time
> the system entered the suspend state.
>
> Force the color_mgmt_changed flag to true if any of the DRM color
> transformation properties was set in the CRTC state duplicated at
> suspend time, as the CMM gets reprogrammed only if said flag is active in
> the rcar_du_atomic_commit_update_cmm() method.
>
> Signed-off-by: Jacopo Mondi <[email protected]>
> ---
> drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 018480a8f35c..6e38495fb78f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -17,6 +17,7 @@
> #include <linux/slab.h>
> #include <linux/wait.h>
>
> +#include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_fb_cma_helper.h>
> #include <drm/drm_fb_helper.h>
> @@ -482,6 +483,26 @@ static int rcar_du_pm_suspend(struct device *dev)
> static int rcar_du_pm_resume(struct device *dev)
> {
> struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> + struct drm_atomic_state *state = rcdu->ddev->mode_config.suspend_state;
> + unsigned int i;
> +
> + for (i = 0; i < rcdu->num_crtcs; ++i) {
> + struct drm_crtc *crtc = &rcdu->crtcs[i].crtc;
> + struct drm_crtc_state *crtc_state;
> +
> + crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
> + if (!crtc_state)
> + continue;

Shouldn't you get the new state here ?

> +
> + /*
> + * Force re-enablement of CMM after system resume if any
> + * of the DRM color transformation properties was set in
> + * the state saved at system suspend time.
> + */
> + if (crtc_state->gamma_lut || crtc_state->degamma_lut ||
> + crtc_state->ctm)

We don't support degamma_lut or crm, so I would drop those.

With these small issues addressed,

Reviewed-by: Laurent Pinchart <[email protected]>

Shouldn't we however squash this with the previous patch to avoid
bisection issues ?

> + crtc_state->color_mgmt_changed = true;

Daniel, is this something that would make sense in the KMS core (or
helpers) ?

> + }
>
> return drm_mode_config_helper_resume(rcdu->ddev);
> }

--
Regards,

Laurent Pinchart

2019-08-27 00:20:44

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 13/14] drm: rcar-du: kms: Update CMM in atomic commit tail

On Tue, Aug 27, 2019 at 03:00:17AM +0300, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Sun, Aug 25, 2019 at 03:51:53PM +0200, Jacopo Mondi wrote:
> > Update CMM settings at in the atomic commit tail helper method.
> >
> > The CMM is updated with new gamma values provided to the driver
> > in the GAMMA_LUT blob property.
> >
> > Reviewed-by: Ulrich Hecht <[email protected]>
> > Reviewed-by: Laurent Pinchart <[email protected]>
> > Signed-off-by: Jacopo Mondi <[email protected]>
> > ---
> > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++++++
> > 1 file changed, 35 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > index 61ca1d3c379a..047fdb982a11 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > @@ -22,6 +22,7 @@
> > #include <linux/of_platform.h>
> > #include <linux/wait.h>
> >
> > +#include "rcar_cmm.h"
> > #include "rcar_du_crtc.h"
> > #include "rcar_du_drv.h"
> > #include "rcar_du_encoder.h"
> > @@ -368,6 +369,37 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
> > * Atomic Check and Update
> > */
> >
> > +static void rcar_du_atomic_commit_update_cmm(struct drm_crtc *crtc,
> > + struct drm_crtc_state *old_state)
> > +{
> > + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> > + struct rcar_cmm_config cmm_config = {};
> > +
> > + if (!rcrtc->cmm || !crtc->state->color_mgmt_changed)
> > + return;
> > +
> > + if (!crtc->state->gamma_lut) {
> > + cmm_config.lut.enable = false;
> > + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> > +
> > + return;
> > + }
> > +
> > + cmm_config.lut.enable = true;
> > + cmm_config.lut.table = (struct drm_color_lut *)
> > + crtc->state->gamma_lut->data;
> > +
> > + /* Set LUT table size to 0 if entries should not be updated. */
> > + if (!old_state->gamma_lut ||
> > + old_state->gamma_lut->base.id != crtc->state->gamma_lut->base.id)
> > + cmm_config.lut.size = crtc->state->gamma_lut->length
> > + / sizeof(cmm_config.lut.table[0]);
>
> It has just occurred to me that the hardware only support LUTs of
> exactly 256 entries. Should we remove cmm_config.lut.size (simplifying
> the code in the CMM driver), and add a check to the CRTC .atomic_check()
> handler to reject invalid LUTs ? Sorry for not having caught this
> earlier.

Just an additional comment, if we drop the size field, then the
cmm_config.lut.table pointer should be set to NULL when the LUT contents
don't need to be updated.

> > + else
> > + cmm_config.lut.size = 0;
> > +
> > + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> > +}
> > +
> > static int rcar_du_atomic_check(struct drm_device *dev,
> > struct drm_atomic_state *state)
> > {
> > @@ -410,6 +442,9 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
> > rcdu->dpad1_source = rcrtc->index;
> > }
> >
> > + for_each_old_crtc_in_state(old_state, crtc, crtc_state, i)
> > + rcar_du_atomic_commit_update_cmm(crtc, crtc_state);
> > +
> > /* Apply the atomic update. */
> > drm_atomic_helper_commit_modeset_disables(dev, old_state);
> > drm_atomic_helper_commit_planes(dev, old_state,
>
> --
> Regards,
>
> Laurent Pinchart

--
Regards,

Laurent Pinchart

2019-08-27 14:45:42

by jacopo mondi

[permalink] [raw]
Subject: Re: [PATCH v3 13/14] drm: rcar-du: kms: Update CMM in atomic commit tail

HI Laurent,

On Tue, Aug 27, 2019 at 03:19:27AM +0300, Laurent Pinchart wrote:
> On Tue, Aug 27, 2019 at 03:00:17AM +0300, Laurent Pinchart wrote:
> > Hi Jacopo,
> >
> > Thank you for the patch.
> >
> > On Sun, Aug 25, 2019 at 03:51:53PM +0200, Jacopo Mondi wrote:
> > > Update CMM settings at in the atomic commit tail helper method.
> > >
> > > The CMM is updated with new gamma values provided to the driver
> > > in the GAMMA_LUT blob property.
> > >
> > > Reviewed-by: Ulrich Hecht <[email protected]>
> > > Reviewed-by: Laurent Pinchart <[email protected]>
> > > Signed-off-by: Jacopo Mondi <[email protected]>
> > > ---
> > > drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++++++
> > > 1 file changed, 35 insertions(+)
> > >
> > > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > > index 61ca1d3c379a..047fdb982a11 100644
> > > --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > > +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> > > @@ -22,6 +22,7 @@
> > > #include <linux/of_platform.h>
> > > #include <linux/wait.h>
> > >
> > > +#include "rcar_cmm.h"
> > > #include "rcar_du_crtc.h"
> > > #include "rcar_du_drv.h"
> > > #include "rcar_du_encoder.h"
> > > @@ -368,6 +369,37 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
> > > * Atomic Check and Update
> > > */
> > >
> > > +static void rcar_du_atomic_commit_update_cmm(struct drm_crtc *crtc,
> > > + struct drm_crtc_state *old_state)
> > > +{
> > > + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> > > + struct rcar_cmm_config cmm_config = {};
> > > +
> > > + if (!rcrtc->cmm || !crtc->state->color_mgmt_changed)
> > > + return;
> > > +
> > > + if (!crtc->state->gamma_lut) {
> > > + cmm_config.lut.enable = false;
> > > + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> > > +
> > > + return;
> > > + }
> > > +
> > > + cmm_config.lut.enable = true;
> > > + cmm_config.lut.table = (struct drm_color_lut *)
> > > + crtc->state->gamma_lut->data;
> > > +
> > > + /* Set LUT table size to 0 if entries should not be updated. */
> > > + if (!old_state->gamma_lut ||
> > > + old_state->gamma_lut->base.id != crtc->state->gamma_lut->base.id)
> > > + cmm_config.lut.size = crtc->state->gamma_lut->length
> > > + / sizeof(cmm_config.lut.table[0]);
> >
> > It has just occurred to me that the hardware only support LUTs of

Where did you find this strict requirement ? I have tried programming
less than 256 entries in the 1-D LUT table, and it seems to me things
are working fine (from a visual inspection of the output image, I
don't see much differences from when I program the full table, maybe
that's an indication something is bad?)

Thanks
j
> > exactly 256 entries. Should we remove cmm_config.lut.size (simplifying
> > the code in the CMM driver), and add a check to the CRTC .atomic_check()
> > handler to reject invalid LUTs ? Sorry for not having caught this
> > earlier.
>
> Just an additional comment, if we drop the size field, then the
> cmm_config.lut.table pointer should be set to NULL when the LUT contents
> don't need to be updated.
>
> > > + else
> > > + cmm_config.lut.size = 0;
> > > +
> > > + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> > > +}
> > > +
> > > static int rcar_du_atomic_check(struct drm_device *dev,
> > > struct drm_atomic_state *state)
> > > {
> > > @@ -410,6 +442,9 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
> > > rcdu->dpad1_source = rcrtc->index;
> > > }
> > >
> > > + for_each_old_crtc_in_state(old_state, crtc, crtc_state, i)
> > > + rcar_du_atomic_commit_update_cmm(crtc, crtc_state);
> > > +
> > > /* Apply the atomic update. */
> > > drm_atomic_helper_commit_modeset_disables(dev, old_state);
> > > drm_atomic_helper_commit_planes(dev, old_state,
> >
> > --
> > Regards,
> >
> > Laurent Pinchart
>
> --
> Regards,
>
> Laurent Pinchart


Attachments:
(No filename) (3.96 kB)
signature.asc (849.00 B)
Download all attachments

2019-08-27 16:40:10

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 13/14] drm: rcar-du: kms: Update CMM in atomic commit tail

Hi Jacopo,

On Tue, Aug 27, 2019 at 04:44:21PM +0200, Jacopo Mondi wrote:
> On Tue, Aug 27, 2019 at 03:19:27AM +0300, Laurent Pinchart wrote:
> > On Tue, Aug 27, 2019 at 03:00:17AM +0300, Laurent Pinchart wrote:
> >> On Sun, Aug 25, 2019 at 03:51:53PM +0200, Jacopo Mondi wrote:
> >>> Update CMM settings at in the atomic commit tail helper method.
> >>>
> >>> The CMM is updated with new gamma values provided to the driver
> >>> in the GAMMA_LUT blob property.
> >>>
> >>> Reviewed-by: Ulrich Hecht <[email protected]>
> >>> Reviewed-by: Laurent Pinchart <[email protected]>
> >>> Signed-off-by: Jacopo Mondi <[email protected]>
> >>> ---
> >>> drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++++++
> >>> 1 file changed, 35 insertions(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >>> index 61ca1d3c379a..047fdb982a11 100644
> >>> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> >>> @@ -22,6 +22,7 @@
> >>> #include <linux/of_platform.h>
> >>> #include <linux/wait.h>
> >>>
> >>> +#include "rcar_cmm.h"
> >>> #include "rcar_du_crtc.h"
> >>> #include "rcar_du_drv.h"
> >>> #include "rcar_du_encoder.h"
> >>> @@ -368,6 +369,37 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
> >>> * Atomic Check and Update
> >>> */
> >>>
> >>> +static void rcar_du_atomic_commit_update_cmm(struct drm_crtc *crtc,
> >>> + struct drm_crtc_state *old_state)
> >>> +{
> >>> + struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> >>> + struct rcar_cmm_config cmm_config = {};
> >>> +
> >>> + if (!rcrtc->cmm || !crtc->state->color_mgmt_changed)
> >>> + return;
> >>> +
> >>> + if (!crtc->state->gamma_lut) {
> >>> + cmm_config.lut.enable = false;
> >>> + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> >>> +
> >>> + return;
> >>> + }
> >>> +
> >>> + cmm_config.lut.enable = true;
> >>> + cmm_config.lut.table = (struct drm_color_lut *)
> >>> + crtc->state->gamma_lut->data;
> >>> +
> >>> + /* Set LUT table size to 0 if entries should not be updated. */
> >>> + if (!old_state->gamma_lut ||
> >>> + old_state->gamma_lut->base.id != crtc->state->gamma_lut->base.id)
> >>> + cmm_config.lut.size = crtc->state->gamma_lut->length
> >>> + / sizeof(cmm_config.lut.table[0]);
> >>
> >> It has just occurred to me that the hardware only support LUTs of
>
> Where did you find this strict requirement ? I have tried programming
> less than 256 entries in the 1-D LUT table, and it seems to me things
> are working fine (from a visual inspection of the output image, I
> don't see much differences from when I program the full table, maybe
> that's an indication something is bad?)

Or maybe a previous write of the full 256 entries has initialised the
LUT correctly ?

There's no hardware register telling how many LUT entries the hardware
should use, and the documentation makes it quite clear that the LUT
contains 256 entries. It is indexed by the values of the 8-bit pixel
components, so it has to be written fully.

> >> exactly 256 entries. Should we remove cmm_config.lut.size (simplifying
> >> the code in the CMM driver), and add a check to the CRTC .atomic_check()
> >> handler to reject invalid LUTs ? Sorry for not having caught this
> >> earlier.
> >
> > Just an additional comment, if we drop the size field, then the
> > cmm_config.lut.table pointer should be set to NULL when the LUT contents
> > don't need to be updated.
> >
> >>> + else
> >>> + cmm_config.lut.size = 0;
> >>> +
> >>> + rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> >>> +}
> >>> +
> >>> static int rcar_du_atomic_check(struct drm_device *dev,
> >>> struct drm_atomic_state *state)
> >>> {
> >>> @@ -410,6 +442,9 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
> >>> rcdu->dpad1_source = rcrtc->index;
> >>> }
> >>>
> >>> + for_each_old_crtc_in_state(old_state, crtc, crtc_state, i)
> >>> + rcar_du_atomic_commit_update_cmm(crtc, crtc_state);
> >>> +
> >>> /* Apply the atomic update. */
> >>> drm_atomic_helper_commit_modeset_disables(dev, old_state);
> >>> drm_atomic_helper_commit_planes(dev, old_state,

--
Regards,

Laurent Pinchart

2019-08-30 18:00:57

by jacopo mondi

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Laurent,

On Mon, Aug 26, 2019 at 01:15:50PM +0300, Laurent Pinchart wrote:
> Hi Jacopo,
>
> On Mon, Aug 26, 2019 at 09:59:43AM +0200, Jacopo Mondi wrote:
> > On Mon, Aug 26, 2019 at 09:34:41AM +0200, Geert Uytterhoeven wrote:
> > > On Sun, Aug 25, 2019 at 3:50 PM Jacopo Mondi <[email protected]> wrote:
> > > > Add device tree bindings documentation for the Renesas R-Car Display
> > > > Unit Color Management Module.
> > > >
> > > > CMM is the image enhancement module available on each R-Car DU video
> > > > channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).
> > > >
> > > > Signed-off-by: Jacopo Mondi <[email protected]>
> > >
> > > Thanks for your patch!
> > >
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
> > > > @@ -0,0 +1,33 @@
> > > > +* Renesas R-Car Color Management Module (CMM)
> > > > +
> > > > +Renesas R-Car image enhancement module connected to R-Car DU video channels.
> > > > +
> > > > +Required properties:
> > > > + - compatible: shall be one or more of the following:
> > > > + - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
> > > > + - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
> > > > + - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
> > > > + - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
> > > > + - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.
> > >
> > > Please use "renesas,<socype->-cmm" instead of "renesas,cmm-<soctype>".
> >
> > I actually copied it from the r-car gpio bindings, and I liked
> > cmm-<soctype> better. If you prefer I can change it though.
> >
> > > > + - "renesas,rcar-gen3-cmm": for a generic R-Car Gen3 compatible CMM.
> > > > + - "renesas,rcar-gen2-cmm": for a generic R-Car Gen2 compatible CMM.
> > > > +
> > > > + When the generic compatible string is specified, the SoC-specific
> > > > + version corresponding to the platform should be listed first.
> > > > +
> > > > + - reg: the address base and length of the memory area where CMM control
> > > > + registers are mapped to.
> > > > +
> > > > + - clocks: phandle and clock-specifier pair to the CMM functional clock
> > > > + supplier.
> > >
> > > Thinking about yaml validation:
> > >
> > > power-domains?
> > > resets?
> >
> > They should indeed be documented.
>
> How about converting this binding to yaml alreay ? It should be fairly
> simple.

I'm trying to, and I'm having my portion of fun time at it.

The definition of the schema itself seems good, but I wonder, is this
the first renesas schema we have? Because it seems to me the schema
validator is having an hard time to digest the examplea 'clocks' and
'power-domains' properties, which have 1 phandle and 2 specifiers and 1
phandle and 1 specifier respectively for Rensas SoCs.

In other words, if in the example I have:

examples:
- |
cmm0: cmm@fea40000 {
compatible = "renesas,r8a7796-cmm";
reg = <0 0xfea40000 0 0x1000>;
clocks = <&cpg 711> <---- 1 phandle + 1 specifier
resets = <&cpg 711>;
power-domains = <&sysc>; <---- 1 phandle
};

The schema validation is good.

While if I use an actual example
- |
cmm0: cmm@fea40000 {
compatible = "renesas,r8a7796-cmm";
reg = <0 0xfea40000 0 0x1000>;
clocks = <&cpg CPG_MOD 711> <---- 1 phandle + 2 specifier
resets = <&cpg 711>;
power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; <---- 1 phandle
}; + 1 specfier

The schema validation fails...
Error: Documentation/devicetree/bindings/display/renesas,cmm.example.dts:20.29-30 syntax error
FATAL ERROR: Unable to parse input tree

Are clocks properties with > 2 entries and power-domains properties with
> 1 entries supported?

Because from what I read here:
https://github.com/robherring/yaml-bindings/blob/master/schemas/clock/clock.yaml
"The length of a clock specifier is defined by the value of a #clock-cells
property in the clock provider node."

And that's expected, but is the examples actually validated against the
clock provider pointed by the phandle? Because in that case, if we had a
yaml schema for the cpg-mssr provider, it would indeed specify clock-cells=2.

Do we need a schema for cpg-mssr first, or am I doing something else
wrong?

Thanks
j

>
> > > > +Example:
> > > > +--------
> > > > +
> > > > + cmm0: cmm@fea40000 {
> > > > + compatible = "renesas,cmm-r8a7796";
> > > > + reg = <0 0xfea40000 0 0x1000>;
> > > > + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
> > > > + clocks = <&cpg CPG_MOD 711>;
> > > > + resets = <&cpg 711>;
> > > > + };
>
> --
> Regards,
>
> Laurent Pinchart


Attachments:
(No filename) (4.88 kB)
signature.asc (849.00 B)
Download all attachments

2019-09-05 10:58:01

by jacopo mondi

[permalink] [raw]
Subject: Re: [PATCH v3 14/14] drm: rcar-du: Force CMM enablement when resuming

Hi Laurent,

On Tue, Aug 27, 2019 at 03:05:17AM +0300, Laurent Pinchart wrote:
> Hi Jacopo,
>
> (Question for Daniel below)
>
> Thank you for the patch.
>
> On Sun, Aug 25, 2019 at 03:51:54PM +0200, Jacopo Mondi wrote:
> > When resuming from system suspend, the DU driver is responsible for
> > reprogramming and enabling the CMM unit if it was in use at the time
> > the system entered the suspend state.
> >
> > Force the color_mgmt_changed flag to true if any of the DRM color
> > transformation properties was set in the CRTC state duplicated at
> > suspend time, as the CMM gets reprogrammed only if said flag is active in
> > the rcar_du_atomic_commit_update_cmm() method.
> >
> > Signed-off-by: Jacopo Mondi <[email protected]>
> > ---
> > drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 +++++++++++++++++++++
> > 1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > index 018480a8f35c..6e38495fb78f 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > @@ -17,6 +17,7 @@
> > #include <linux/slab.h>
> > #include <linux/wait.h>
> >
> > +#include <drm/drm_atomic.h>
> > #include <drm/drm_atomic_helper.h>
> > #include <drm/drm_fb_cma_helper.h>
> > #include <drm/drm_fb_helper.h>
> > @@ -482,6 +483,26 @@ static int rcar_du_pm_suspend(struct device *dev)
> > static int rcar_du_pm_resume(struct device *dev)
> > {
> > struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> > + struct drm_atomic_state *state = rcdu->ddev->mode_config.suspend_state;
> > + unsigned int i;
> > +
> > + for (i = 0; i < rcdu->num_crtcs; ++i) {
> > + struct drm_crtc *crtc = &rcdu->crtcs[i].crtc;
> > + struct drm_crtc_state *crtc_state;
> > +
> > + crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
> > + if (!crtc_state)
> > + continue;
>
> Shouldn't you get the new state here ?
>

I have followed the drm_atomic_helper_suspend() call stack, that calls
drm_atomic_helper_duplicate_state() which then assign the crtct state
with drm_atomic_get_crtc_state(), where I read:

crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
...
state->crtcs[index].state = crtc_state;
state->crtcs[index].old_state = crtc->state;
state->crtcs[index].new_state = crtc_state;

So state or new_state for the purpose of getting back the crtc state
are the same if I'm not mistaken.

> > +
> > + /*
> > + * Force re-enablement of CMM after system resume if any
> > + * of the DRM color transformation properties was set in
> > + * the state saved at system suspend time.
> > + */
> > + if (crtc_state->gamma_lut || crtc_state->degamma_lut ||
> > + crtc_state->ctm)
>
> We don't support degamma_lut or crm, so I would drop those.

yeah, I added them as it was less code to change when we'll support
them. But for now they could be removed.

>
> With these small issues addressed,
>
> Reviewed-by: Laurent Pinchart <[email protected]>
>
> Shouldn't we however squash this with the previous patch to avoid
> bisection issues ?
>

Which one in your opinion?
"drm: rcar-du: kms: Update CMM in atomic commit tail" ?
It seems to me they do quite different things though..

Thanks
j

> > + crtc_state->color_mgmt_changed = true;
>
> Daniel, is this something that would make sense in the KMS core (or
> helpers) ?
>
> > + }
> >
> > return drm_mode_config_helper_resume(rcdu->ddev);
> > }
>
> --
> Regards,
>
> Laurent Pinchart


Attachments:
(No filename) (3.54 kB)
signature.asc (849.00 B)
Download all attachments

2019-09-05 13:06:26

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 14/14] drm: rcar-du: Force CMM enablement when resuming

Hi Jacopo,

On Thu, Sep 05, 2019 at 12:58:09PM +0200, Jacopo Mondi wrote:
> On Tue, Aug 27, 2019 at 03:05:17AM +0300, Laurent Pinchart wrote:
> > Hi Jacopo,
> >
> > (Question for Daniel below)
> >
> > Thank you for the patch.
> >
> > On Sun, Aug 25, 2019 at 03:51:54PM +0200, Jacopo Mondi wrote:
> >> When resuming from system suspend, the DU driver is responsible for
> >> reprogramming and enabling the CMM unit if it was in use at the time
> >> the system entered the suspend state.
> >>
> >> Force the color_mgmt_changed flag to true if any of the DRM color
> >> transformation properties was set in the CRTC state duplicated at
> >> suspend time, as the CMM gets reprogrammed only if said flag is active in
> >> the rcar_du_atomic_commit_update_cmm() method.
> >>
> >> Signed-off-by: Jacopo Mondi <[email protected]>
> >> ---
> >> drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 +++++++++++++++++++++
> >> 1 file changed, 21 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> >> index 018480a8f35c..6e38495fb78f 100644
> >> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> >> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> >> @@ -17,6 +17,7 @@
> >> #include <linux/slab.h>
> >> #include <linux/wait.h>
> >>
> >> +#include <drm/drm_atomic.h>
> >> #include <drm/drm_atomic_helper.h>
> >> #include <drm/drm_fb_cma_helper.h>
> >> #include <drm/drm_fb_helper.h>
> >> @@ -482,6 +483,26 @@ static int rcar_du_pm_suspend(struct device *dev)
> >> static int rcar_du_pm_resume(struct device *dev)
> >> {
> >> struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> >> + struct drm_atomic_state *state = rcdu->ddev->mode_config.suspend_state;
> >> + unsigned int i;
> >> +
> >> + for (i = 0; i < rcdu->num_crtcs; ++i) {
> >> + struct drm_crtc *crtc = &rcdu->crtcs[i].crtc;
> >> + struct drm_crtc_state *crtc_state;
> >> +
> >> + crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
> >> + if (!crtc_state)
> >> + continue;
> >
> > Shouldn't you get the new state here ?
>
> I have followed the drm_atomic_helper_suspend() call stack, that calls
> drm_atomic_helper_duplicate_state() which then assign the crtct state
> with drm_atomic_get_crtc_state(), where I read:
>
> crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
> ...
> state->crtcs[index].state = crtc_state;
> state->crtcs[index].old_state = crtc->state;
> state->crtcs[index].new_state = crtc_state;
>
> So state or new_state for the purpose of getting back the crtc state
> are the same if I'm not mistaken.

It seems to be the case, but the documentation of
drm_atomic_get_existing_crtc_state() states

* This function is deprecated, @drm_atomic_get_old_crtc_state or
* @drm_atomic_get_new_crtc_state should be used instead.

I would thus use drm_atomic_get_new_crtc_state().

> >> +
> >> + /*
> >> + * Force re-enablement of CMM after system resume if any
> >> + * of the DRM color transformation properties was set in
> >> + * the state saved at system suspend time.
> >> + */
> >> + if (crtc_state->gamma_lut || crtc_state->degamma_lut ||
> >> + crtc_state->ctm)
> >
> > We don't support degamma_lut or crm, so I would drop those.
>
> yeah, I added them as it was less code to change when we'll support
> them. But for now they could be removed.
>
> > With these small issues addressed,
> >
> > Reviewed-by: Laurent Pinchart <[email protected]>
> >
> > Shouldn't we however squash this with the previous patch to avoid
> > bisection issues ?
>
> Which one in your opinion?
> "drm: rcar-du: kms: Update CMM in atomic commit tail" ?
> It seems to me they do quite different things though..

Yes, but suspend/resume will be broken after 13/14 without 14/14. Not
the end of the world, but not really nice if we need to bisect
suspend/resume issues.

> >> + crtc_state->color_mgmt_changed = true;
> >
> > Daniel, is this something that would make sense in the KMS core (or
> > helpers) ?
> >
> >> + }
> >>
> >> return drm_mode_config_helper_resume(rcdu->ddev);
> >> }

--
Regards,

Laurent Pinchart

2019-09-05 13:17:31

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Jacopo,

On Fri, Aug 30, 2019 at 08:01:09PM +0200, Jacopo Mondi wrote:
> On Mon, Aug 26, 2019 at 01:15:50PM +0300, Laurent Pinchart wrote:
> > On Mon, Aug 26, 2019 at 09:59:43AM +0200, Jacopo Mondi wrote:
> >> On Mon, Aug 26, 2019 at 09:34:41AM +0200, Geert Uytterhoeven wrote:
> >>> On Sun, Aug 25, 2019 at 3:50 PM Jacopo Mondi <[email protected]> wrote:
> >>>> Add device tree bindings documentation for the Renesas R-Car Display
> >>>> Unit Color Management Module.
> >>>>
> >>>> CMM is the image enhancement module available on each R-Car DU video
> >>>> channel on R-Car Gen2 and Gen3 SoCs (V3H and V3M excluded).
> >>>>
> >>>> Signed-off-by: Jacopo Mondi <[email protected]>
> >>>
> >>> Thanks for your patch!
> >>>
> >>>> --- /dev/null
> >>>> +++ b/Documentation/devicetree/bindings/display/renesas,cmm.txt
> >>>> @@ -0,0 +1,33 @@
> >>>> +* Renesas R-Car Color Management Module (CMM)
> >>>> +
> >>>> +Renesas R-Car image enhancement module connected to R-Car DU video channels.
> >>>> +
> >>>> +Required properties:
> >>>> + - compatible: shall be one or more of the following:
> >>>> + - "renesas,cmm-r8a7795": for R8A7795 (R-Car H3) compatible CMM.
> >>>> + - "renesas,cmm-r8a7796": for R8A7796 (R-Car M3-W) compatible CMM.
> >>>> + - "renesas,cmm-r8a77965": for R8A77965 (R-Car M3-N) compatible CMM.
> >>>> + - "renesas,cmm-r8a77990": for R8A77990 (R-Car E3) compatible CMM.
> >>>> + - "renesas,cmm-r8a77995": for R8A77995 (R-Car D3) compatible CMM.
> >>>
> >>> Please use "renesas,<socype->-cmm" instead of "renesas,cmm-<soctype>".
> >>
> >> I actually copied it from the r-car gpio bindings, and I liked
> >> cmm-<soctype> better. If you prefer I can change it though.
> >>
> >>>> + - "renesas,rcar-gen3-cmm": for a generic R-Car Gen3 compatible CMM.
> >>>> + - "renesas,rcar-gen2-cmm": for a generic R-Car Gen2 compatible CMM.
> >>>> +
> >>>> + When the generic compatible string is specified, the SoC-specific
> >>>> + version corresponding to the platform should be listed first.
> >>>> +
> >>>> + - reg: the address base and length of the memory area where CMM control
> >>>> + registers are mapped to.
> >>>> +
> >>>> + - clocks: phandle and clock-specifier pair to the CMM functional clock
> >>>> + supplier.
> >>>
> >>> Thinking about yaml validation:
> >>>
> >>> power-domains?
> >>> resets?
> >>
> >> They should indeed be documented.
> >
> > How about converting this binding to yaml alreay ? It should be fairly
> > simple.
>
> I'm trying to, and I'm having my portion of fun time at it.
>
> The definition of the schema itself seems good, but I wonder, is this
> the first renesas schema we have? Because it seems to me the schema
> validator is having an hard time to digest the examplea 'clocks' and
> 'power-domains' properties, which have 1 phandle and 2 specifiers and 1
> phandle and 1 specifier respectively for Rensas SoCs.
>
> In other words, if in the example I have:
>
> examples:
> - |
> cmm0: cmm@fea40000 {
> compatible = "renesas,r8a7796-cmm";
> reg = <0 0xfea40000 0 0x1000>;
> clocks = <&cpg 711> <---- 1 phandle + 1 specifier
> resets = <&cpg 711>;
> power-domains = <&sysc>; <---- 1 phandle
> };
>
> The schema validation is good.
>
> While if I use an actual example
> - |
> cmm0: cmm@fea40000 {
> compatible = "renesas,r8a7796-cmm";
> reg = <0 0xfea40000 0 0x1000>;
> clocks = <&cpg CPG_MOD 711> <---- 1 phandle + 2 specifier
> resets = <&cpg 711>;
> power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; <---- 1 phandle
> }; + 1 specfier
>
> The schema validation fails...
> Error: Documentation/devicetree/bindings/display/renesas,cmm.example.dts:20.29-30 syntax error
> FATAL ERROR: Unable to parse input tree
>
> Are clocks properties with > 2 entries and power-domains properties with
> > 1 entries supported?
>
> Because from what I read here:
> https://github.com/robherring/yaml-bindings/blob/master/schemas/clock/clock.yaml
> "The length of a clock specifier is defined by the value of a #clock-cells
> property in the clock provider node."
>
> And that's expected, but is the examples actually validated against the
> clock provider pointed by the phandle? Because in that case, if we had a
> yaml schema for the cpg-mssr provider, it would indeed specify clock-cells=2.
>
> Do we need a schema for cpg-mssr first, or am I doing something else
> wrong?

I think you just need to #include the headers that define CPG_MOD and
R8A7796_PD_ALWAYS_ON.

> >>>> +Example:
> >>>> +--------
> >>>> +
> >>>> + cmm0: cmm@fea40000 {
> >>>> + compatible = "renesas,cmm-r8a7796";
> >>>> + reg = <0 0xfea40000 0 0x1000>;
> >>>> + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
> >>>> + clocks = <&cpg CPG_MOD 711>;
> >>>> + resets = <&cpg 711>;
> >>>> + };

--
Regards,

Laurent Pinchart

2019-09-05 13:35:44

by Laurent Pinchart

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Geert,

On Thu, Sep 05, 2019 at 02:05:34PM +0200, Geert Uytterhoeven wrote:
> On Thu, Sep 5, 2019 at 1:50 PM Laurent Pinchart wrote:
> > On Fri, Aug 30, 2019 at 08:01:09PM +0200, Jacopo Mondi wrote:
> > > On Mon, Aug 26, 2019 at 01:15:50PM +0300, Laurent Pinchart wrote:
> > > > How about converting this binding to yaml alreay ? It should be fairly
> > > > simple.
> > >
> > > I'm trying to, and I'm having my portion of fun time at it.
> > >
> > > The definition of the schema itself seems good, but I wonder, is this
> > > the first renesas schema we have? Because it seems to me the schema
> > > validator is having an hard time to digest the examplea 'clocks' and
> > > 'power-domains' properties, which have 1 phandle and 2 specifiers and 1
> > > phandle and 1 specifier respectively for Rensas SoCs.
> > >
> > > In other words, if in the example I have:
> > >
> > > examples:
> > > - |
> > > cmm0: cmm@fea40000 {
> > > compatible = "renesas,r8a7796-cmm";
> > > reg = <0 0xfea40000 0 0x1000>;
> > > clocks = <&cpg 711> <---- 1 phandle + 1 specifier
> > > resets = <&cpg 711>;
> > > power-domains = <&sysc>; <---- 1 phandle
> > > };
> > >
> > > The schema validation is good.
> > >
> > > While if I use an actual example
> > > - |
> > > cmm0: cmm@fea40000 {
> > > compatible = "renesas,r8a7796-cmm";
> > > reg = <0 0xfea40000 0 0x1000>;
> > > clocks = <&cpg CPG_MOD 711> <---- 1 phandle + 2 specifier
> > > resets = <&cpg 711>;
> > > power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; <---- 1 phandle
> > > }; + 1 specfier
> > >
> > > The schema validation fails...
> > > Error: Documentation/devicetree/bindings/display/renesas,cmm.example.dts:20.29-30 syntax error
> > > FATAL ERROR: Unable to parse input tree
> > >
> > > Are clocks properties with > 2 entries and power-domains properties with
> > > > 1 entries supported?
> > >
> > > Because from what I read here:
> > > https://github.com/robherring/yaml-bindings/blob/master/schemas/clock/clock.yaml
> > > "The length of a clock specifier is defined by the value of a #clock-cells
> > > property in the clock provider node."
> > >
> > > And that's expected, but is the examples actually validated against the
> > > clock provider pointed by the phandle? Because in that case, if we had a
> > > yaml schema for the cpg-mssr provider, it would indeed specify clock-cells=2.
> > >
> > > Do we need a schema for cpg-mssr first, or am I doing something else
> > > wrong?
> >
> > I think you just need to #include the headers that define CPG_MOD and
> > R8A7796_PD_ALWAYS_ON.
>
> If that helps, you might want to replace the symbols in the examples by their
> actual values (1 resp. 32).
>
> And perhaps keep the symbols as comments?
>
> clocks = <&cpg 1 /* CPG_MOD */ 711>;
> power-domains = <&sysc 32 /* R8A7796_PD_ALWAYS_ON */>;

I think adding the required #include at the beginning of the example is
a better solution.

--
Regards,

Laurent Pinchart

2019-09-05 14:03:34

by jacopo mondi

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Laurent, Geert,


On Thu, Sep 05, 2019 at 03:20:59PM +0300, Laurent Pinchart wrote:
> Hi Geert,
>
> On Thu, Sep 05, 2019 at 02:05:34PM +0200, Geert Uytterhoeven wrote:
> > On Thu, Sep 5, 2019 at 1:50 PM Laurent Pinchart wrote:
> > > On Fri, Aug 30, 2019 at 08:01:09PM +0200, Jacopo Mondi wrote:
> > > > On Mon, Aug 26, 2019 at 01:15:50PM +0300, Laurent Pinchart wrote:
> > > > > How about converting this binding to yaml alreay ? It should be fairly
> > > > > simple.
> > > >
> > > > I'm trying to, and I'm having my portion of fun time at it.
> > > >
> > > > The definition of the schema itself seems good, but I wonder, is this
> > > > the first renesas schema we have? Because it seems to me the schema
> > > > validator is having an hard time to digest the examplea 'clocks' and
> > > > 'power-domains' properties, which have 1 phandle and 2 specifiers and 1
> > > > phandle and 1 specifier respectively for Rensas SoCs.
> > > >
> > > > In other words, if in the example I have:
> > > >
> > > > examples:
> > > > - |
> > > > cmm0: cmm@fea40000 {
> > > > compatible = "renesas,r8a7796-cmm";
> > > > reg = <0 0xfea40000 0 0x1000>;
> > > > clocks = <&cpg 711> <---- 1 phandle + 1 specifier
> > > > resets = <&cpg 711>;
> > > > power-domains = <&sysc>; <---- 1 phandle
> > > > };
> > > >
> > > > The schema validation is good.
> > > >
> > > > While if I use an actual example
> > > > - |
> > > > cmm0: cmm@fea40000 {
> > > > compatible = "renesas,r8a7796-cmm";
> > > > reg = <0 0xfea40000 0 0x1000>;
> > > > clocks = <&cpg CPG_MOD 711> <---- 1 phandle + 2 specifier
> > > > resets = <&cpg 711>;
> > > > power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; <---- 1 phandle
> > > > }; + 1 specfier
> > > >
> > > > The schema validation fails...
> > > > Error: Documentation/devicetree/bindings/display/renesas,cmm.example.dts:20.29-30 syntax error
> > > > FATAL ERROR: Unable to parse input tree
> > > >
> > > > Are clocks properties with > 2 entries and power-domains properties with
> > > > > 1 entries supported?
> > > >
> > > > Because from what I read here:
> > > > https://github.com/robherring/yaml-bindings/blob/master/schemas/clock/clock.yaml
> > > > "The length of a clock specifier is defined by the value of a #clock-cells
> > > > property in the clock provider node."
> > > >
> > > > And that's expected, but is the examples actually validated against the
> > > > clock provider pointed by the phandle? Because in that case, if we had a
> > > > yaml schema for the cpg-mssr provider, it would indeed specify clock-cells=2.
> > > >
> > > > Do we need a schema for cpg-mssr first, or am I doing something else
> > > > wrong?
> > >
> > > I think you just need to #include the headers that define CPG_MOD and
> > > R8A7796_PD_ALWAYS_ON.
> >
> > If that helps, you might want to replace the symbols in the examples by their
> > actual values (1 resp. 32).
> >
> > And perhaps keep the symbols as comments?
> >
> > clocks = <&cpg 1 /* CPG_MOD */ 711>;
> > power-domains = <&sysc 32 /* R8A7796_PD_ALWAYS_ON */>;
>
> I think adding the required #include at the beginning of the example is
> a better solution.

I didn't realize that, but it actually makes sense, as the example is
extracted and actually compiled from the yaml schema.. brilliant!

With a simple:

--- a/Documentation/devicetree/bindings/display/renesas,cmm.yaml
+++ b/Documentation/devicetree/bindings/display/renesas,cmm.yaml
@@ -51,6 +51,9 @@ additionalProperties: false

examples:
- |
+ #include <dt-bindings/clock/r8a7796-cpg-mssr.h>
+ #include <dt-bindings/power/r8a7796-sysc.h>

The example now compiles.

Thanks, I will submit the bindings in yaml format in next iteration.

>
> --
> Regards,
>
> Laurent Pinchart


Attachments:
(No filename) (3.93 kB)
signature.asc (849.00 B)
Download all attachments

2019-09-05 16:44:55

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation

Hi Laurent,

On Thu, Sep 5, 2019 at 1:50 PM Laurent Pinchart
<[email protected]> wrote:
> On Fri, Aug 30, 2019 at 08:01:09PM +0200, Jacopo Mondi wrote:
> > On Mon, Aug 26, 2019 at 01:15:50PM +0300, Laurent Pinchart wrote:
> > > How about converting this binding to yaml alreay ? It should be fairly
> > > simple.
> >
> > I'm trying to, and I'm having my portion of fun time at it.
> >
> > The definition of the schema itself seems good, but I wonder, is this
> > the first renesas schema we have? Because it seems to me the schema
> > validator is having an hard time to digest the examplea 'clocks' and
> > 'power-domains' properties, which have 1 phandle and 2 specifiers and 1
> > phandle and 1 specifier respectively for Rensas SoCs.
> >
> > In other words, if in the example I have:
> >
> > examples:
> > - |
> > cmm0: cmm@fea40000 {
> > compatible = "renesas,r8a7796-cmm";
> > reg = <0 0xfea40000 0 0x1000>;
> > clocks = <&cpg 711> <---- 1 phandle + 1 specifier
> > resets = <&cpg 711>;
> > power-domains = <&sysc>; <---- 1 phandle
> > };
> >
> > The schema validation is good.
> >
> > While if I use an actual example
> > - |
> > cmm0: cmm@fea40000 {
> > compatible = "renesas,r8a7796-cmm";
> > reg = <0 0xfea40000 0 0x1000>;
> > clocks = <&cpg CPG_MOD 711> <---- 1 phandle + 2 specifier
> > resets = <&cpg 711>;
> > power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; <---- 1 phandle
> > }; + 1 specfier
> >
> > The schema validation fails...
> > Error: Documentation/devicetree/bindings/display/renesas,cmm.example.dts:20.29-30 syntax error
> > FATAL ERROR: Unable to parse input tree
> >
> > Are clocks properties with > 2 entries and power-domains properties with
> > > 1 entries supported?
> >
> > Because from what I read here:
> > https://github.com/robherring/yaml-bindings/blob/master/schemas/clock/clock.yaml
> > "The length of a clock specifier is defined by the value of a #clock-cells
> > property in the clock provider node."
> >
> > And that's expected, but is the examples actually validated against the
> > clock provider pointed by the phandle? Because in that case, if we had a
> > yaml schema for the cpg-mssr provider, it would indeed specify clock-cells=2.
> >
> > Do we need a schema for cpg-mssr first, or am I doing something else
> > wrong?
>
> I think you just need to #include the headers that define CPG_MOD and
> R8A7796_PD_ALWAYS_ON.

If that helps, you might want to replace the symbols in the examples by their
actual values (1 resp. 32).

And perhaps keep the symbols as comments?

clocks = <&cpg 1 /* CPG_MOD */ 711>;
power-domains = <&sysc 32 /* R8A7796_PD_ALWAYS_ON */>;

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds