devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
@ 2018-01-12  0:58 Laurent Pinchart
  2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
                   ` (4 more replies)
  0 siblings, 5 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12  0:58 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Sergei Shtylyov, devicetree

Hello,

This patch series addresses a design mistake that dates back from the initial
DU support. Support for the LVDS encoders, which are IP cores separate from
the DU, was bundled in the DU driver. Worse, both the DU and LVDS were
described through a single DT node.

To fix the, patches 01/10 and 02/10 define new DT bindings for the LVDS
encoders, and deprecate their description inside the DU bindings. To retain
backward compatibility with existing DT, patch 03/10 then patches the device
tree at runtime to convert the legacy bindings to the new ones.

With the DT side addressed, patch 04/10 then converts the LVDS support code to
a separate bridge driver. After a small fix to the Porter board device tree in
patch 05/10, patches 06/10 to 10/10 then update all the device tree sources to
the new LVDS encoders bindings.

I decided to go for live DT patching in patch 03/10 because implementing
support for both the legacy and new bindings in the driver would have been
very intrusive, and prevented further cleanups. I'm in a way both proud and 
ashamed of that patch that I would call a neat and dirty hack. It was fun to
write perhaps in a similar way that one would enjoy researching and developing
proof-of-concepts for security holes: they're good and bad at the same time.

Anyway, with this philosophical considerations aside, there were a few
shortcomings in the OF API that I worked around with local code in the driver.
If anyone is interested in performing similar live DT patching I think we
could move some of the code to the OF core. For instance I was surprised
to not find a device node lookup by path function that would start at a
given node instead of the root of the live device tree, and had to write
rcar_du_of_find_node_by_path(). Utility functions to add or modify properties
or to rename nodes could similarly be added.

Laurent Pinchart (10):
  dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  dt-bindings: display: renesas: Deprecate LVDS support in the DU
    bindings
  drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
  drm: rcar-du: Convert LVDS encoder code to bridge driver
  ARM: dts: porter: Fix HDMI output routing
  ARM: dts: r8a7790: Convert to new LVDS DT bindings
  ARM: dts: r8a7791: Convert to new LVDS DT bindings
  ARM: dts: r8a7793: Convert to new LVDS DT bindings
  arm64: dts: renesas: r8a7795: Convert to new LVDS DT bindings
  arm64: dts: renesas: r8a7796: Convert to new LVDS DT bindings

 .../bindings/display/bridge/renesas,lvds.txt       |  54 ++
 .../devicetree/bindings/display/renesas,du.txt     |  26 +-
 MAINTAINERS                                        |   1 +
 arch/arm/boot/dts/r8a7790-lager.dts                |  22 +-
 arch/arm/boot/dts/r8a7790.dtsi                     |  61 ++-
 arch/arm/boot/dts/r8a7791-koelsch.dts              |  10 +-
 arch/arm/boot/dts/r8a7791-porter.dts               |  18 +-
 arch/arm/boot/dts/r8a7791.dtsi                     |  35 +-
 arch/arm/boot/dts/r8a7793-gose.dts                 |  10 +-
 arch/arm/boot/dts/r8a7793.dtsi                     |  35 +-
 .../boot/dts/renesas/r8a7795-es1-salvator-x.dts    |   3 +-
 arch/arm64/boot/dts/renesas/r8a7795-h3ulcb.dts     |   3 +-
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts |   3 +-
 .../arm64/boot/dts/renesas/r8a7795-salvator-xs.dts |   3 +-
 arch/arm64/boot/dts/renesas/r8a7795.dtsi           |  35 +-
 arch/arm64/boot/dts/renesas/r8a7796-m3ulcb.dts     |   3 +-
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts |   3 +-
 arch/arm64/boot/dts/renesas/r8a7796.dtsi           |  35 +-
 drivers/gpu/drm/rcar-du/Kconfig                    |   5 +-
 drivers/gpu/drm/rcar-du/Makefile                   |   6 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c              |  21 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.h              |   5 -
 drivers/gpu/drm/rcar-du/rcar_du_encoder.c          | 175 +------
 drivers/gpu/drm/rcar-du/rcar_du_encoder.h          |  12 -
 drivers/gpu/drm/rcar-du/rcar_du_kms.c              |  14 +-
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c          |  93 ----
 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h          |  24 -
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c          | 270 ----------
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h          |  64 ---
 drivers/gpu/drm/rcar-du/rcar_du_of.c               | 440 ++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_of.h               |  16 +
 drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts        |  82 +++
 drivers/gpu/drm/rcar-du/rcar_lvds.c                | 554 +++++++++++++++++++++
 33 files changed, 1420 insertions(+), 721 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdscon.h
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
 delete mode 100644 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.h
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of.c
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of.h
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_lvds.c

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12  0:58 [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Laurent Pinchart
@ 2018-01-12  0:58 ` Laurent Pinchart
  2018-01-12  9:45   ` Geert Uytterhoeven
                     ` (3 more replies)
  2018-01-12  0:58 ` [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
                   ` (3 subsequent siblings)
  4 siblings, 4 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12  0:58 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, devicetree, Sergei Shtylyov

The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
corresponding device tree bindings.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../bindings/display/bridge/renesas,lvds.txt       | 54 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt

diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
new file mode 100644
index 000000000000..459c56822eda
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
@@ -0,0 +1,54 @@
+Renesas R-Car LVDS Encoder
+==========================
+
+These DT bindings describe the LVDS encoder embedded in the Renesas R-Car Gen2
+and Gen3 SoCs.
+
+Required properties:
+
+- compatible : Shall contain one of
+  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS encoders
+  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS encoders
+  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS encoders
+  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS encoders
+  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS encoders
+  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS encoders
+
+- reg: Base address and length for the memory-mapped registers
+- clocks: A phandle + clock-specifier pair for the functional clock
+
+Requires nodes:
+
+The LVDS encoder has two video ports. Their connections are modelled using the
+OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
+
+- Video port 0 corresponds to the parallel input
+- Video port 1 corresponds to the LVDS output
+
+Each port shall have a single endpoint.
+
+
+Example:
+
+	lvds0: lvds@feb90000 {
+		compatible = "renesas,lvds-r8a7790";
+		reg = <0 0xfeb90000 0 0x1c>;
+		clocks = <&cpg CPG_MOD 726>;
+
+		ports {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			port@0 {
+				reg = <0>;
+				lvds0_in: endpoint {
+					remote-endpoint = <&du_out_lvds0>;
+				};
+			};
+			port@1 {
+				reg = <1>;
+				lvds0_out: endpoint {
+				};
+			};
+		};
+	};
diff --git a/MAINTAINERS b/MAINTAINERS
index 40aea858c7ea..5609a7f5ac4d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4725,6 +4725,7 @@ F:	drivers/gpu/drm/rcar-du/
 F:	drivers/gpu/drm/shmobile/
 F:	include/linux/platform_data/shmob_drm.h
 F:	Documentation/devicetree/bindings/display/bridge/renesas,dw-hdmi.txt
+F:	Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
 F:	Documentation/devicetree/bindings/display/renesas,du.txt
 
 DRM DRIVERS FOR ROCKCHIP
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12  0:58 [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Laurent Pinchart
  2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
@ 2018-01-12  0:58 ` Laurent Pinchart
  2018-01-12  9:49   ` Geert Uytterhoeven
                     ` (3 more replies)
  2018-01-12  0:58 ` [PATCH 03/10] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes Laurent Pinchart
                   ` (2 subsequent siblings)
  4 siblings, 4 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12  0:58 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Sergei Shtylyov, devicetree

The internal LVDS encoders now have their own DT bindings, representing
them as part of the DU is deprecated.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../devicetree/bindings/display/renesas,du.txt     | 26 +++++++++-------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt b/Documentation/devicetree/bindings/display/renesas,du.txt
index cd48aba3bc8c..8f6e0e118e3e 100644
--- a/Documentation/devicetree/bindings/display/renesas,du.txt
+++ b/Documentation/devicetree/bindings/display/renesas,du.txt
@@ -17,9 +17,7 @@ Required Properties:
   - reg: A list of base address and length of each memory resource, one for
     each entry in the reg-names property.
   - reg-names: Name of the memory resources. The DU requires one memory
-    resource for the DU core (named "du") and one memory resource for each
-    LVDS encoder (named "lvds.x" with "x" being the LVDS controller numerical
-    index).
+    resource for the DU core (named "du").
 
   - interrupt-parent: phandle of the parent interrupt controller.
   - interrupts: Interrupt specifiers for the DU interrupts.
@@ -29,14 +27,13 @@ Required Properties:
   - clock-names: Name of the clocks. This property is model-dependent.
     - R8A7779 uses a single functional clock. The clock doesn't need to be
       named.
-    - All other DU instances use one functional clock per channel and one
-      clock per LVDS encoder (if available). The functional clocks must be
-      named "du.x" with "x" being the channel numerical index. The LVDS clocks
-      must be named "lvds.x" with "x" being the LVDS encoder numerical index.
-    - In addition to the functional and encoder clocks, all DU versions also
-      support externally supplied pixel clocks. Those clocks are optional.
-      When supplied they must be named "dclkin.x" with "x" being the input
-      clock numerical index.
+    - All other DU instances use one functional clock per channel The
+      functional clocks must be named "du.x" with "x" being the channel
+      numerical index.
+    - In addition to the functional clocks, all DU versions also support
+      externally supplied pixel clocks. Those clocks are optional. When
+      supplied they must be named "dclkin.x" with "x" being the input clock
+      numerical index.
 
   - vsps: A list of phandle and channel index tuples to the VSPs that handle
     the memory interfaces for the DU channels. The phandle identifies the VSP
@@ -71,7 +68,7 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
 		compatible = "renesas,du-r8a7795";
 		reg = <0 0xfeb00000 0 0x80000>,
 		      <0 0xfeb90000 0 0x14>;
-		reg-names = "du", "lvds.0";
+		reg-names = "du";
 		interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
 			     <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>,
@@ -79,9 +76,8 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
 		clocks = <&cpg CPG_MOD 724>,
 			 <&cpg CPG_MOD 723>,
 			 <&cpg CPG_MOD 722>,
-			 <&cpg CPG_MOD 721>,
-			 <&cpg CPG_MOD 727>;
-		clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0";
+			 <&cpg CPG_MOD 721>;
+		clock-names = "du.0", "du.1", "du.2", "du.3";
 		vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
 
 		ports {
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 03/10] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
  2018-01-12  0:58 [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Laurent Pinchart
  2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
  2018-01-12  0:58 ` [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
@ 2018-01-12  0:58 ` Laurent Pinchart
       [not found]   ` <20180112005858.26472-4-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  2018-01-12  9:47 ` [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Geert Uytterhoeven
       [not found] ` <20180112005858.26472-1-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  4 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12  0:58 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Sergei Shtylyov, devicetree

The internal LVDS encoders now have their own DT bindings. Before
switching the driver infrastructure to those new bindings, implement
backward-compatibility through live DT patching.

Patching is disabled and will be enabled along with support for the new
DT bindings in the DU driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/Kconfig             |   1 +
 drivers/gpu/drm/rcar-du/Makefile            |   2 +
 drivers/gpu/drm/rcar-du/rcar_du_of.c        | 440 ++++++++++++++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_of.h        |  16 +
 drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts |  82 ++++++
 5 files changed, 541 insertions(+)
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of.c
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of.h
 create mode 100644 drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts

diff --git a/drivers/gpu/drm/rcar-du/Kconfig b/drivers/gpu/drm/rcar-du/Kconfig
index 8a50dab19e5c..e3193ebd3ced 100644
--- a/drivers/gpu/drm/rcar-du/Kconfig
+++ b/drivers/gpu/drm/rcar-du/Kconfig
@@ -22,6 +22,7 @@ config DRM_RCAR_LVDS
 	bool "R-Car DU LVDS Encoder Support"
 	depends on DRM_RCAR_DU
 	select DRM_PANEL
+	select OF_OVERLAY
 	help
 	  Enable support for the R-Car Display Unit embedded LVDS encoders.
 
diff --git a/drivers/gpu/drm/rcar-du/Makefile b/drivers/gpu/drm/rcar-du/Makefile
index 0cf5c11030e8..0cf457bef1f2 100644
--- a/drivers/gpu/drm/rcar-du/Makefile
+++ b/drivers/gpu/drm/rcar-du/Makefile
@@ -5,6 +5,8 @@ rcar-du-drm-y := rcar_du_crtc.o \
 		 rcar_du_group.o \
 		 rcar_du_kms.o \
 		 rcar_du_lvdscon.o \
+		 rcar_du_of.o \
+		 rcar_du_of_lvds.dtb.o \
 		 rcar_du_plane.o
 
 rcar-du-drm-$(CONFIG_DRM_RCAR_LVDS)	+= rcar_du_lvdsenc.o
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_of.c b/drivers/gpu/drm/rcar-du/rcar_du_of.c
new file mode 100644
index 000000000000..c2726e29bd59
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c
@@ -0,0 +1,440 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * rcar_du_of.c - Legacy DT bindings compatibility
+ *
+ * Copyright (C) 2018 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * Based on work from Jyri Sarha <jsarha@ti.com>
+ * Copyright (C) 2015 Texas Instruments
+ */
+
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_fdt.h>
+#include <linux/of_graph.h>
+#include <linux/slab.h>
+
+#include "rcar_du_crtc.h"
+#include "rcar_du_drv.h"
+
+extern u8 __dtb_rcar_du_of_lvds_begin[];
+extern u8 __dtb_rcar_du_of_lvds_end[];
+
+struct rcar_du_of_overlay {
+	struct device_node *np;
+	void *data;
+	void *mem;
+};
+
+static void __init rcar_du_of_free_overlay(struct rcar_du_of_overlay *overlay)
+{
+	of_node_put(overlay->np);
+	kfree(overlay->data);
+	kfree(overlay->mem);
+}
+
+static int __init rcar_du_of_get_overlay(struct rcar_du_of_overlay *overlay,
+					 u8 *begin, u8 *end)
+{
+	const size_t size = end - begin;
+
+	memset(overlay, 0, sizeof(*overlay));
+
+	if (!size)
+		return -EINVAL;
+
+	overlay->data = kmemdup(begin, size, GFP_KERNEL);
+	if (!overlay->data)
+		return -ENOMEM;
+
+	overlay->mem = of_fdt_unflatten_tree(overlay->data, NULL, &overlay->np);
+	if (!overlay->mem) {
+		rcar_du_of_free_overlay(overlay);
+		return -ENOMEM;
+	}
+
+	return 0;
+}
+
+static struct device_node __init *
+rcar_du_of_find_node_by_path(struct device_node *parent, const char *path)
+{
+	parent = of_node_get(parent);
+	if (!parent)
+		return NULL;
+
+	while (parent && *path == '/') {
+		struct device_node *child = NULL;
+		struct device_node *node;
+		const char *next;
+		size_t len;
+
+		/* Skip the initial '/' delimiter and find the next one. */
+		path++;
+		next = strchrnul(path, '/');
+		len = next - path;
+		if (!len)
+			goto error;
+
+		for_each_child_of_node(parent, node) {
+			const char *name = kbasename(node->full_name);
+
+			if (strncmp(path, name, len) == 0 &&
+			    strlen(name) == len) {
+				child = node;
+				break;
+			}
+		}
+
+		if (!child)
+			goto error;
+
+		of_node_put(parent);
+		parent = child;
+		path = next;
+	}
+
+	return parent;
+
+error:
+	of_node_put(parent);
+	return NULL;
+}
+
+static int __init rcar_du_of_add_property(struct device_node *np,
+					  const char *name, const void *value,
+					  size_t length)
+{
+	struct property *prop;
+
+	prop = kzalloc(sizeof(*prop), GFP_KERNEL);
+	if (!prop)
+		return -ENOMEM;
+
+	prop->name = kstrdup(name, GFP_KERNEL);
+	prop->value = kmemdup(value, length, GFP_KERNEL);
+	prop->length = length;
+
+	if (!prop->name || !prop->value) {
+		kfree(prop->name);
+		kfree(prop->value);
+		kfree(prop);
+		return -ENOMEM;
+	}
+
+	of_property_set_flag(prop, OF_DYNAMIC);
+
+	prop->next = np->properties;
+	np->properties = prop;
+
+	return 0;
+}
+
+/* Free properties allocated dynamically by rcar_du_of_add_property(). */
+static void __init rcar_du_of_free_properties(struct device_node *np)
+{
+	while (np->properties) {
+		struct property *prop = np->properties;
+
+		np->properties = prop->next;
+
+		if (OF_IS_DYNAMIC(prop)) {
+			kfree(prop->name);
+			kfree(prop->value);
+			kfree(prop);
+		}
+	}
+}
+
+static int __init rcar_du_of_update_target_path(struct device_node *du,
+						struct device_node *remote,
+						struct device_node *np)
+{
+	struct device_node *target = NULL;
+	struct property **prev;
+	struct property *prop;
+	char *path;
+	int ret;
+
+	for (prop = np->properties, prev = &prop; prop != NULL;
+	     prev = &prop->next, prop = prop->next) {
+		if (of_prop_cmp(prop->name, "target-path"))
+			continue;
+
+		if (!of_prop_cmp(prop->value, "soc")) {
+			target = of_get_parent(du);
+			break;
+		}
+		if (!of_prop_cmp(prop->value, "du")) {
+			target = of_node_get(du);
+			break;
+		}
+		if (!of_prop_cmp(prop->value, "lvds-sink")) {
+			target = of_graph_get_port_parent(remote);
+			break;
+		}
+
+		return -EINVAL;
+	}
+
+	if (!target)
+		return -EINVAL;
+
+	path = kasprintf(GFP_KERNEL, "%pOF", target);
+	of_node_put(target);
+	if (!path)
+		return -ENOMEM;
+
+	/*
+	 * Remove the existing target-path property that has not been
+	 * dynamically allocated and replace it with a new dynamic one to
+	 * ensure that the value will be properly freed.
+	 */
+	*prev = prop->next;
+	ret = rcar_du_of_add_property(np, "target-path", path,
+				      strlen(path) + 1);
+	if (ret < 0) {
+		kfree(path);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void __init rcar_du_of_lvds_patch_one(struct device_node *du,
+					     unsigned int port_id,
+					     const struct resource *res,
+					     const __be32 *reg,
+					     const struct of_phandle_args *clkspec,
+					     struct device_node *local,
+					     struct device_node *remote)
+{
+	struct rcar_du_of_overlay overlay;
+	struct device_node *du_port, *du_port_fixup;
+	struct device_node *lvds_endpoints[2];
+	struct device_node *lvds;
+	struct device_node *fragment;
+	struct property *prop;
+	const char *compatible;
+	const char *soc_suffix;
+	unsigned int psize;
+	unsigned int i;
+	__be32 value[4];
+	char name[23];
+	int ovcs_id;
+	int ret;
+
+	/* Skip if the LVDS node already exists. */
+	sprintf(name, "lvds@%llx", (u64)res->start);
+	lvds = of_get_child_by_name(du->parent, name);
+	if (lvds) {
+		of_node_put(lvds);
+		return;
+	}
+
+	/* Parse the overlay. */
+	ret = rcar_du_of_get_overlay(&overlay, __dtb_rcar_du_of_lvds_begin,
+				     __dtb_rcar_du_of_lvds_end);
+	if (ret < 0)
+		return;
+
+	/*
+	 * Patch the LVDS and DU port nodes names and the associated fixup
+	 * entries.
+	 */
+	lvds = rcar_du_of_find_node_by_path(overlay.np,
+		"/fragment@0/__overlay__/lvds");
+	lvds_endpoints[0] = rcar_du_of_find_node_by_path(overlay.np,
+		"/fragment@0/__overlay__/lvds/ports/port@0/endpoint");
+	lvds_endpoints[1] = rcar_du_of_find_node_by_path(overlay.np,
+		"/fragment@0/__overlay__/lvds/ports/port@1/endpoint");
+	du_port = rcar_du_of_find_node_by_path(overlay.np,
+		"/fragment@1/__overlay__/ports/port@0");
+	du_port_fixup = rcar_du_of_find_node_by_path(overlay.np,
+		"/__local_fixups__/fragment@1/__overlay__/ports/port@0");
+	if (!lvds || !lvds_endpoints[0] || !lvds_endpoints[1] ||
+	    !du_port || !du_port_fixup)
+		goto out_put_nodes;
+
+	lvds->full_name = kstrdup(name, GFP_KERNEL);
+
+	sprintf(name, "port@%u", port_id);
+	du_port->full_name = kstrdup(name, GFP_KERNEL);
+	du_port_fixup->full_name = kstrdup(name, GFP_KERNEL);
+
+	if (!lvds->full_name || !du_port->full_name ||
+	    !du_port_fixup->full_name)
+		goto out_free_names;
+
+	/* Patch the target paths in all fragments. */
+	for_each_child_of_node(overlay.np, fragment) {
+		if (strncmp("fragment@", of_node_full_name(fragment), 9))
+			continue;
+
+		ret = rcar_du_of_update_target_path(du, remote, fragment);
+		if (ret < 0) {
+			of_node_put(fragment);
+			goto out_free_properties;
+		}
+	}
+
+	/*
+	 * Create a compatible string for the LVDS node using the SoC model
+	 * from the DU node.
+	 */
+	ret = of_property_read_string(du, "compatible", &compatible);
+	if (ret < 0)
+		goto out_free_properties;
+
+	soc_suffix = strchr(compatible, '-');
+	if (!soc_suffix || strlen(soc_suffix) > 10)
+		goto out_free_properties;
+
+	psize = sprintf(name, "renesas,lvds%s", soc_suffix) + 1;
+	ret = rcar_du_of_add_property(lvds, "compatible", name, psize);
+	if (ret < 0)
+		goto out_free_properties;
+
+	/* Copy the LVDS reg and clocks properties from the DU node. */
+	psize = (of_n_addr_cells(du) + of_n_size_cells(du)) * 4;
+	ret = rcar_du_of_add_property(lvds, "reg", reg, psize);
+	if (ret < 0)
+		goto out_free_properties;
+
+	if (clkspec->args_count >= ARRAY_SIZE(value) - 1)
+		goto out_free_properties;
+
+	value[0] = cpu_to_be32(clkspec->np->phandle);
+	for (i = 0; i < clkspec->args_count; ++i)
+		value[i + 1] = cpu_to_be32(clkspec->args[i]);
+
+	psize = (clkspec->args_count + 1) * 4;
+	ret = rcar_du_of_add_property(lvds, "clocks", value, psize);
+	if (ret < 0)
+		goto out_free_properties;
+
+	/*
+	 * Insert the node in the OF graph: patch the LVDS ports remote-endpoint
+	 * properties to point to the endpoints of the sibling nodes in the
+	 * graph.
+	 */
+	prop = of_find_property(lvds_endpoints[0], "remote-endpoint", NULL);
+	if (!prop)
+		goto out_free_properties;
+
+	*(__be32 *)prop->value = cpu_to_be32(local->phandle);
+
+	prop = of_find_property(lvds_endpoints[1], "remote-endpoint", NULL);
+	if (!prop)
+		goto out_free_properties;
+
+	*(__be32 *)prop->value = cpu_to_be32(remote->phandle);
+
+	/* Apply the overlay, this will resolve phandles. */
+	ovcs_id = 0;
+	ret = of_overlay_apply(overlay.np, &ovcs_id);
+
+	/* We're done, free all allocated memory. */
+out_free_properties:
+	rcar_du_of_free_properties(lvds);
+	rcar_du_of_free_properties(du_port);
+	rcar_du_of_free_properties(du_port_fixup);
+out_free_names:
+	kfree(lvds->full_name);
+	kfree(du_port->full_name);
+	kfree(du_port_fixup->full_name);
+out_put_nodes:
+	of_node_put(lvds);
+	of_node_put(lvds_endpoints[0]);
+	of_node_put(lvds_endpoints[1]);
+	of_node_put(du_port);
+	of_node_put(du_port_fixup);
+
+	rcar_du_of_free_overlay(&overlay);
+}
+
+static void __init rcar_du_of_lvds_patch(const struct of_device_id *of_ids)
+{
+	const struct rcar_du_device_info *info;
+	const struct of_device_id *match;
+	struct device_node *du;
+	unsigned int i;
+	int ret;
+
+	/* Get the DU node and exit if not present or disabled. */
+	du = of_find_matching_node_and_match(NULL, of_ids, &match);
+	if (!du || !of_device_is_available(du))
+		goto done;
+
+	info = match->data;
+
+	/* Patch every LVDS encoder. */
+	for (i = 0; i < info->num_lvds; ++i) {
+		struct of_phandle_args clkspec;
+		struct device_node *local, *remote;
+		struct resource res;
+		unsigned int port_id;
+		const __be32 *reg;
+		char name[7];
+		int index;
+
+		/*
+		 * Retrieve the register specifier, the clock specifier and the
+		 * local and remote endpoints of the LVDS link.
+		 */
+		sprintf(name, "lvds.%u", i);
+		index = of_property_match_string(du, "reg-names", name);
+		if (index < 0)
+			continue;
+
+		reg = of_get_address(du, index, NULL, NULL);
+		if (!reg)
+			continue;
+
+		ret = of_address_to_resource(du, index, &res);
+		if (ret < 0)
+			continue;
+
+		index = of_property_match_string(du, "clock-names", name);
+		if (index < 0)
+			continue;
+
+		ret = of_parse_phandle_with_args(du, "clocks", "#clock-cells",
+						 index, &clkspec);
+		if (ret < 0)
+			continue;
+
+		port_id = info->routes[RCAR_DU_OUTPUT_LVDS0 + i].port;
+
+		local = of_graph_get_endpoint_by_regs(du, port_id, 0);
+		if (!local) {
+			of_node_put(clkspec.np);
+			continue;
+		}
+
+		remote = of_graph_get_remote_endpoint(local);
+		if (!remote) {
+			of_node_put(local);
+			of_node_put(clkspec.np);
+			continue;
+		}
+
+		/* Patch the LVDS encoder. */
+		rcar_du_of_lvds_patch_one(du, port_id, &res, reg, &clkspec,
+					  local, remote);
+
+		of_node_put(clkspec.np);
+		of_node_put(remote);
+		of_node_put(local);
+	}
+
+done:
+	of_node_put(du);
+}
+
+void __init rcar_du_of_init(const struct of_device_id *of_ids)
+{
+	rcar_du_of_lvds_patch(of_ids);
+}
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_of.h b/drivers/gpu/drm/rcar-du/rcar_du_of.h
new file mode 100644
index 000000000000..d96bb80df4c2
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_of.h
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * rcar_du_of.h - Legacy DT bindings compatibility
+ *
+ * Copyright (C) 2018 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ */
+#ifndef __RCAR_DU_OF_H__
+#define __RCAR_DU_OF_H__
+
+#include <linux/init.h>
+
+struct of_device_id;
+
+void __init rcar_du_of_init(const struct of_device_id *of_ids);
+
+#endif /* __RCAR_DU_OF_H__ */
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts b/drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts
new file mode 100644
index 000000000000..89ababf15768
--- /dev/null
+++ b/drivers/gpu/drm/rcar-du/rcar_du_of_lvds.dts
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * rcar_du_of_lvds.dts - Legacy LVDS DT bindings conversion
+ *
+ * Copyright (C) 2018 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * Based on work from Jyri Sarha <jsarha@ti.com>
+ * Copyright (C) 2015 Texas Instruments
+ */
+
+/*
+ * The target-paths, lvds node name, DU port number and LVDS remote endpoints
+ * will be patched dynamically at runtime.
+ */
+
+/dts-v1/;
+/ {
+	fragment@0 {
+		target-path = "soc";
+		__overlay__ {
+			lvds {
+				ports {
+					#address-cells = <1>;
+					#size-cells = <0>;
+
+					port@0 {
+						reg = <0>;
+						lvds_input: endpoint {
+							remote-endpoint = <0>;
+						};
+					};
+
+					port@1 {
+						reg = <1>;
+						lvds_output: endpoint {
+							remote-endpoint = <0>;
+						};
+					};
+				};
+			};
+		};
+	};
+
+	fragment@1 {
+		target-path = "du";
+		__overlay__ {
+			ports {
+				port@0 {
+					endpoint {
+						remote-endpoint = <&lvds_input>;
+					};
+				};
+			};
+		};
+	};
+
+	fragment@2 {
+		target-path = "lvds-sink";
+		__overlay__ {
+			remote-endpoint = <&lvds_output>;
+		};
+	};
+
+	__local_fixups__ {
+		fragment@1 {
+			__overlay__ {
+				ports {
+					port@0 {
+						endpoint {
+							remote-endpoint	= <0>;
+						};
+					};
+				};
+			};
+		};
+		fragment@2 {
+			__overlay__ {
+				remote-endpoint	= <0>;
+			};
+		};
+	};
+};
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
@ 2018-01-12  9:45   ` Geert Uytterhoeven
       [not found]     ` <CAMuHMdWMgst-1evod+0hZujU2xPtO3UmO9c2CPPrTg=gpHpTbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2018-01-12 10:13   ` Geert Uytterhoeven
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2018-01-12  9:45 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: DRI Development, Linux-Renesas, Sergei Shtylyov, devicetree

Hi Laurent,

On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> corresponding device tree bindings.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> @@ -0,0 +1,54 @@
> +Renesas R-Car LVDS Encoder
> +==========================
> +
> +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car Gen2
> +and Gen3 SoCs.
> +
> +Required properties:
> +
> +- compatible : Shall contain one of
> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS encoders
> +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS encoders
> +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS encoders
> +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS encoders
> +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS encoders
> +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS encoders
> +
> +- reg: Base address and length for the memory-mapped registers
> +- clocks: A phandle + clock-specifier pair for the functional clock

Please document the "resets" property, too, and add it to the example.
According to the rcar-3.6.0 BSP, reset support is needed desperately.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
  2018-01-12  0:58 [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Laurent Pinchart
                   ` (2 preceding siblings ...)
  2018-01-12  0:58 ` [PATCH 03/10] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes Laurent Pinchart
@ 2018-01-12  9:47 ` Geert Uytterhoeven
  2018-01-12 13:48   ` Laurent Pinchart
       [not found] ` <20180112005858.26472-1-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  4 siblings, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2018-01-12  9:47 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: DRI Development, Linux-Renesas, Sergei Shtylyov, devicetree

Hi Laurent,

On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> This patch series addresses a design mistake that dates back from the initial
> DU support. Support for the LVDS encoders, which are IP cores separate from
> the DU, was bundled in the DU driver. Worse, both the DU and LVDS were
> described through a single DT node.
>
> To fix the, patches 01/10 and 02/10 define new DT bindings for the LVDS
> encoders, and deprecate their description inside the DU bindings. To retain
> backward compatibility with existing DT, patch 03/10 then patches the device
> tree at runtime to convert the legacy bindings to the new ones.

Looks like we will have to postpone the R-Car Gen2 Modern DT flag day
again by a few kernel releases?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12  0:58 ` [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
@ 2018-01-12  9:49   ` Geert Uytterhoeven
       [not found]     ` <CAMuHMdXYJmh8ssSRt8u75fTv5gyrpcoPKAuCT=BaF1Eu27CaiQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
       [not found]   ` <20180112005858.26472-3-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2018-01-12  9:49 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: DRI Development, Linux-Renesas, Sergei Shtylyov, devicetree

Hi Laurent,

On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> The internal LVDS encoders now have their own DT bindings, representing
> them as part of the DU is deprecated.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

FWIW, you're not really deprecating the LVDS part, but removing it completely.
Do you want to keep a reference instead?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
       [not found]   ` <20180112005858.26472-3-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2018-01-12  9:54     ` Vladimir Zapolskiy
  2018-01-12 10:43       ` Laurent Pinchart
  0 siblings, 1 reply; 36+ messages in thread
From: Vladimir Zapolskiy @ 2018-01-12  9:54 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Laurent,

On 01/12/2018 02:58 AM, Laurent Pinchart wrote:
> The internal LVDS encoders now have their own DT bindings, representing
> them as part of the DU is deprecated.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
>  .../devicetree/bindings/display/renesas,du.txt     | 26 +++++++++-------------
>  1 file changed, 11 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt b/Documentation/devicetree/bindings/display/renesas,du.txt
> index cd48aba3bc8c..8f6e0e118e3e 100644
> --- a/Documentation/devicetree/bindings/display/renesas,du.txt
> +++ b/Documentation/devicetree/bindings/display/renesas,du.txt
> @@ -17,9 +17,7 @@ Required Properties:
>    - reg: A list of base address and length of each memory resource, one for
>      each entry in the reg-names property.
>    - reg-names: Name of the memory resources. The DU requires one memory
> -    resource for the DU core (named "du") and one memory resource for each
> -    LVDS encoder (named "lvds.x" with "x" being the LVDS controller numerical
> -    index).
> +    resource for the DU core (named "du").
>  
>    - interrupt-parent: phandle of the parent interrupt controller.
>    - interrupts: Interrupt specifiers for the DU interrupts.
> @@ -29,14 +27,13 @@ Required Properties:
>    - clock-names: Name of the clocks. This property is model-dependent.
>      - R8A7779 uses a single functional clock. The clock doesn't need to be
>        named.
> -    - All other DU instances use one functional clock per channel and one
> -      clock per LVDS encoder (if available). The functional clocks must be
> -      named "du.x" with "x" being the channel numerical index. The LVDS clocks
> -      must be named "lvds.x" with "x" being the LVDS encoder numerical index.
> -    - In addition to the functional and encoder clocks, all DU versions also
> -      support externally supplied pixel clocks. Those clocks are optional.
> -      When supplied they must be named "dclkin.x" with "x" being the input
> -      clock numerical index.
> +    - All other DU instances use one functional clock per channel The
> +      functional clocks must be named "du.x" with "x" being the channel
> +      numerical index.
> +    - In addition to the functional clocks, all DU versions also support
> +      externally supplied pixel clocks. Those clocks are optional. When
> +      supplied they must be named "dclkin.x" with "x" being the input clock
> +      numerical index.
>  
>    - vsps: A list of phandle and channel index tuples to the VSPs that handle
>      the memory interfaces for the DU channels. The phandle identifies the VSP
> @@ -71,7 +68,7 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
>  		compatible = "renesas,du-r8a7795";
>  		reg = <0 0xfeb00000 0 0x80000>,
>  		      <0 0xfeb90000 0 0x14>;
> -		reg-names = "du", "lvds.0";
> +		reg-names = "du";

Since "reg-names" list is changed, I believe you'd like to update
the "reg" property value as well.

>  		interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
>  			     <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
>  			     <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>,
> @@ -79,9 +76,8 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
>  		clocks = <&cpg CPG_MOD 724>,
>  			 <&cpg CPG_MOD 723>,
>  			 <&cpg CPG_MOD 722>,
> -			 <&cpg CPG_MOD 721>,
> -			 <&cpg CPG_MOD 727>;
> -		clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0";
> +			 <&cpg CPG_MOD 721>;
> +		clock-names = "du.0", "du.1", "du.2", "du.3";
>  		vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
>  
>  		ports {
> 

--
With best wishes,
Vladimir
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 03/10] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
       [not found]   ` <20180112005858.26472-4-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2018-01-12 10:09     ` Geert Uytterhoeven
       [not found]       ` <CAMuHMdW5wDj5gyTnh+Xa3J10b_6For0MdhcTFgdU_+sgx=BYmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2018-01-12 10:09 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: DRI Development, Linux-Renesas, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Laurent,

On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart
<laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org> wrote:
> The internal LVDS encoders now have their own DT bindings. Before
> switching the driver infrastructure to those new bindings, implement
> backward-compatibility through live DT patching.
>
> Patching is disabled and will be enabled along with support for the new
> DT bindings in the DU driver.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>

Thanks for your patch!

> --- a/drivers/gpu/drm/rcar-du/Kconfig
> +++ b/drivers/gpu/drm/rcar-du/Kconfig
> @@ -22,6 +22,7 @@ config DRM_RCAR_LVDS
>         bool "R-Car DU LVDS Encoder Support"
>         depends on DRM_RCAR_DU
>         select DRM_PANEL
> +       select OF_OVERLAY

select OF_FLATTREE for of_fdt_unflatten_tree()

(you can probably check with sparc all*config)

> --- /dev/null
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c
> @@ -0,0 +1,440 @@
> +// SPDX-License-Identifier: GPL-2.0-only

-ENOENT in Documentation/process/license-rules.rst ;-)

> +extern u8 __dtb_rcar_du_of_lvds_begin[];
> +extern u8 __dtb_rcar_du_of_lvds_end[];

Typically sections are declared using char, not u8.

> +static int __init rcar_du_of_get_overlay(struct rcar_du_of_overlay *overlay,
> +                                        u8 *begin, u8 *end)

"void *begin, void *end" sounds more natural to me.

> +static void __init rcar_du_of_lvds_patch_one(struct device_node *du,
> +                                            unsigned int port_id,
> +                                            const struct resource *res,
> +                                            const __be32 *reg,
> +                                            const struct of_phandle_args *clkspec,
> +                                            struct device_node *local,
> +                                            struct device_node *remote)
> +{

> +
> +       /* Skip if the LVDS node already exists. */
> +       sprintf(name, "lvds@%llx", (u64)res->start);

I guess you cannot use %pa because you don't want a 0x prefix?

> +       /*
> +        * Patch the LVDS and DU port nodes names and the associated fixup
> +        * entries.
> +        */
> +       lvds = rcar_du_of_find_node_by_path(overlay.np,
> +               "/fragment@0/__overlay__/lvds");
> +       lvds_endpoints[0] = rcar_du_of_find_node_by_path(overlay.np,
> +               "/fragment@0/__overlay__/lvds/ports/port@0/endpoint");
> +       lvds_endpoints[1] = rcar_du_of_find_node_by_path(overlay.np,
> +               "/fragment@0/__overlay__/lvds/ports/port@1/endpoint");
> +       du_port = rcar_du_of_find_node_by_path(overlay.np,
> +               "/fragment@1/__overlay__/ports/port@0");
> +       du_port_fixup = rcar_du_of_find_node_by_path(overlay.np,
> +               "/__local_fixups__/fragment@1/__overlay__/ports/port@0");

Many strings with similar prefixes or substrings?
Would it make sense to e.g. locate "/fragment@0/__overlay__/lvds/ports"
first, and continue from there?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

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
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
  2018-01-12  9:45   ` Geert Uytterhoeven
@ 2018-01-12 10:13   ` Geert Uytterhoeven
  2018-01-12 13:29     ` Laurent Pinchart
       [not found]   ` <20180112005858.26472-2-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  2018-01-12 15:13   ` Sergei Shtylyov
  3 siblings, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2018-01-12 10:13 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: DRI Development, Linux-Renesas, Sergei Shtylyov, devicetree

Hi Laurent,

On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> corresponding device tree bindings.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> @@ -0,0 +1,54 @@
> +Renesas R-Car LVDS Encoder
> +==========================
> +
> +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car Gen2
> +and Gen3 SoCs.
> +
> +Required properties:
> +
> +- compatible : Shall contain one of
> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS encoders
> +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS encoders
> +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS encoders
> +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS encoders
> +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS encoders
> +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS encoders

As this is a new binding, please use "renesas,<soc>-lvds".

BTW, would it make sense to use "renesas,<soc>-du" for the new DU binding, too?
Or have you reserved that for the future version that will have a one-to-one
mapping between device nodes and DU channels? ;-)

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12  9:54     ` Vladimir Zapolskiy
@ 2018-01-12 10:43       ` Laurent Pinchart
  2018-01-12 14:52         ` Sergei Shtylyov
  0 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 10:43 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Laurent Pinchart, dri-devel, linux-renesas-soc, Sergei Shtylyov,
	devicetree

Hi Vladimir,

On Friday, 12 January 2018 11:54:57 EET Vladimir Zapolskiy wrote:
> On 01/12/2018 02:58 AM, Laurent Pinchart wrote:
> > The internal LVDS encoders now have their own DT bindings, representing
> > them as part of the DU is deprecated.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../devicetree/bindings/display/renesas,du.txt     | 26
> >  +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt
> > b/Documentation/devicetree/bindings/display/renesas,du.txt index
> > cd48aba3bc8c..8f6e0e118e3e 100644
> > --- a/Documentation/devicetree/bindings/display/renesas,du.txt
> > +++ b/Documentation/devicetree/bindings/display/renesas,du.txt
> > @@ -17,9 +17,7 @@ Required Properties:
> >    - reg: A list of base address and length of each memory resource, one
> >    for
> >      each entry in the reg-names property.
> >    - reg-names: Name of the memory resources. The DU requires one memory
> > -    resource for the DU core (named "du") and one memory resource for
> > each
> > -    LVDS encoder (named "lvds.x" with "x" being the LVDS controller
> > numerical
> > -    index).
> > +    resource for the DU core (named "du").
> >    - interrupt-parent: phandle of the parent interrupt controller.
> >    - interrupts: Interrupt specifiers for the DU interrupts.
> > 
> > @@ -29,14 +27,13 @@ Required Properties:
> >    - clock-names: Name of the clocks. This property is model-dependent.
> >      - R8A7779 uses a single functional clock. The clock doesn't need to
> >      be
> >        named.
> > -    - All other DU instances use one functional clock per channel and one
> > -      clock per LVDS encoder (if available). The functional clocks must
> > be
> > -      named "du.x" with "x" being the channel numerical index. The LVDS
> > clocks
> > -      must be named "lvds.x" with "x" being the LVDS encoder numerical
> > index.
> > -    - In addition to the functional and encoder clocks, all DU versions
> > also
> > -      support externally supplied pixel clocks. Those clocks are
> > optional.
> > -      When supplied they must be named "dclkin.x" with "x" being the
> > input
> > -      clock numerical index.
> > +    - All other DU instances use one functional clock per channel The
> > +      functional clocks must be named "du.x" with "x" being the channel
> > +      numerical index.
> > +    - In addition to the functional clocks, all DU versions also support
> > +      externally supplied pixel clocks. Those clocks are optional. When
> > +      supplied they must be named "dclkin.x" with "x" being the input
> > clock
> > +      numerical index.
> > 
> >    - vsps: A list of phandle and channel index tuples to the VSPs that
> >      handle
> >      the memory interfaces for the DU channels. The phandle identifies the
> >      VSP
> > @@ -71,7 +68,7 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
> >  		compatible = "renesas,du-r8a7795";
> >  		reg = <0 0xfeb00000 0 0x80000>,
> >  		      <0 0xfeb90000 0 0x14>;
> > -		reg-names = "du", "lvds.0";
> > +		reg-names = "du";
> 
> Since "reg-names" list is changed, I believe you'd like to update
> the "reg" property value as well.

Good point, I'll fix it.

> >  		interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>,
> >  			     <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>,
> >  			     <GIC_SPI 269 IRQ_TYPE_LEVEL_HIGH>,
> > @@ -79,9 +76,8 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
> >  		clocks = <&cpg CPG_MOD 724>,
> >  			 <&cpg CPG_MOD 723>,
> >  			 <&cpg CPG_MOD 722>,
> > -			 <&cpg CPG_MOD 721>,
> > -			 <&cpg CPG_MOD 727>;
> > -		clock-names = "du.0", "du.1", "du.2", "du.3", "lvds.0";
> > +			 <&cpg CPG_MOD 721>;
> > +		clock-names = "du.0", "du.1", "du.2", "du.3";
> >  		vsps = <&vspd0 0>, <&vspd1 0>, <&vspd2 0>, <&vspd0 1>;
> >  		
> >  		ports {

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
       [not found]     ` <CAMuHMdXYJmh8ssSRt8u75fTv5gyrpcoPKAuCT=BaF1Eu27CaiQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-01-12 10:44       ` Laurent Pinchart
  2018-01-19 21:23         ` Rob Herring
  0 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 10:44 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Geert,

On Friday, 12 January 2018 11:49:28 EET Geert Uytterhoeven wrote:
> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > The internal LVDS encoders now have their own DT bindings, representing
> > them as part of the DU is deprecated.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> 
> FWIW, you're not really deprecating the LVDS part, but removing it
> completely. Do you want to keep a reference instead?

I don't think we should keep a reference as it would only confuse DT authors. 
The information is kept in the git history. I can rewrite the commit message, 
but I consider this as deprecating the legacy bindings.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
       [not found]   ` <20180112005858.26472-2-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2018-01-12 12:59     ` Biju Das
  2018-01-12 13:26       ` Laurent Pinchart
  0 siblings, 1 reply; 36+ messages in thread
From: Biju Das @ 2018-01-12 12:59 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi,

> Subject: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder
> DT bindings
>
> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> corresponding device tree bindings.
>
> Signed-off-by: Laurent Pinchart
> <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
>  .../bindings/display/bridge/renesas,lvds.txt       | 54
> ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 55 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
>
> diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> new file mode 100644
> index 000000000000..459c56822eda
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> @@ -0,0 +1,54 @@
> +Renesas R-Car LVDS Encoder
> +==========================
> +
> +These DT bindings describe the LVDS encoder embedded in the Renesas
> +R-Car Gen2 and Gen3 SoCs.
> +
> +Required properties:
> +
> +- compatible : Shall contain one of
> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> +encoders

Typo. It should be R8A7743 .

Regards,
Biju




Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12 12:59     ` Biju Das
@ 2018-01-12 13:26       ` Laurent Pinchart
  2018-01-12 14:00         ` Fabrizio Castro
  0 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 13:26 UTC (permalink / raw)
  To: Biju Das
  Cc: Laurent Pinchart, dri-devel, linux-renesas-soc, Sergei Shtylyov,
	devicetree

Hi Biju,

On Friday, 12 January 2018 14:59:53 EET Biju Das wrote:
> Hi,
> 
> > Subject: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS
> > encoder DT bindings
> > 
> > The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > corresponding device tree bindings.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../bindings/display/bridge/renesas,lvds.txt       | 54 +++++++++++++++++
> >  MAINTAINERS                                        |  1 +
> >  2 files changed, 55 insertions(+)
> >  create mode 100644
> > 
> > Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt new
> > file mode 100644
> > index 000000000000..459c56822eda
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > @@ -0,0 +1,54 @@
> > +Renesas R-Car LVDS Encoder
> > +==========================
> > +
> > +These DT bindings describe the LVDS encoder embedded in the Renesas
> > +R-Car Gen2 and Gen3 SoCs.
> > +
> > +Required properties:
> > +
> > +- compatible : Shall contain one of
> > +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> > +encoders
> 
> Typo. It should be R8A7743 .

Oops. Will fix in v2.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12 10:13   ` Geert Uytterhoeven
@ 2018-01-12 13:29     ` Laurent Pinchart
  2018-01-15  6:55       ` Simon Horman
  0 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 13:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree

Hi Geert,

On Friday, 12 January 2018 12:13:18 EET Geert Uytterhoeven wrote:
> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > corresponding device tree bindings.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > 
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > @@ -0,0 +1,54 @@
> > +Renesas R-Car LVDS Encoder
> > +==========================
> > +
> > +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car
> > Gen2 +and Gen3 SoCs.
> > +
> > +Required properties:
> > +
> > +- compatible : Shall contain one of
> > +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS
> > encoders
> 
> As this is a new binding, please use "renesas,<soc>-lvds".

I've recently been thinking that we made the wrong choice, <ip>-<soc> would be 
better in my opinion as it aligns with <ip>-<version>, but it's too late to 
change that, so I'll change the order here.

> BTW, would it make sense to use "renesas,<soc>-du" for the new DU binding,
> too? Or have you reserved that for the future version that will have a
> one-to-one mapping between device nodes and DU channels? ;-)

It's a good idea, let's reserve it for that evolution. If it ever happens ;-)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
       [not found]     ` <CAMuHMdWMgst-1evod+0hZujU2xPtO3UmO9c2CPPrTg=gpHpTbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-01-12 13:36       ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 13:36 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Geert,

On Friday, 12 January 2018 11:45:56 EET Geert Uytterhoeven wrote:
> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > corresponding device tree bindings.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > 
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > @@ -0,0 +1,54 @@
> > +Renesas R-Car LVDS Encoder
> > +==========================
> > +
> > +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car
> > Gen2 +and Gen3 SoCs.
> > +
> > +Required properties:
> > +
> > +- compatible : Shall contain one of
> > +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS
> > encoders
> > +
> > +- reg: Base address and length for the memory-mapped registers
> > +- clocks: A phandle + clock-specifier pair for the functional clock
> 
> Please document the "resets" property, too, and add it to the example.
> According to the rcar-3.6.0 BSP, reset support is needed desperately.

Good point. I'll make it mandatory in the new bindings but treat it as 
optional in the driver as the live DT patching doesn't create the reset 
properties.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
  2018-01-12  9:47 ` [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Geert Uytterhoeven
@ 2018-01-12 13:48   ` Laurent Pinchart
  2018-01-15  6:57     ` Simon Horman
  0 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 13:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree

Hi Geert,

On Friday, 12 January 2018 11:47:03 EET Geert Uytterhoeven wrote:
> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > This patch series addresses a design mistake that dates back from the
> > initial DU support. Support for the LVDS encoders, which are IP cores
> > separate from the DU, was bundled in the DU driver. Worse, both the DU
> > and LVDS were described through a single DT node.
> > 
> > To fix the, patches 01/10 and 02/10 define new DT bindings for the LVDS
> > encoders, and deprecate their description inside the DU bindings. To
> > retain backward compatibility with existing DT, patch 03/10 then patches
> > the device tree at runtime to convert the legacy bindings to the new ones.
> 
> Looks like we will have to postpone the R-Car Gen2 Modern DT flag day
> again by a few kernel releases?

Why so ? We don't have to drop support for all legacy DT bindings at the same 
time, do we ? We can switch to the new-style clock bindings on Gen2 already, 
and drop the legacy LVDS bindings later.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 03/10] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
       [not found]       ` <CAMuHMdW5wDj5gyTnh+Xa3J10b_6For0MdhcTFgdU_+sgx=BYmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2018-01-12 13:53         ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 13:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Geert,

On Friday, 12 January 2018 12:09:45 EET Geert Uytterhoeven wrote:
> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > The internal LVDS encoders now have their own DT bindings. Before
> > switching the driver infrastructure to those new bindings, implement
> > backward-compatibility through live DT patching.
> > 
> > Patching is disabled and will be enabled along with support for the new
> > DT bindings in the DU driver.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> 
> Thanks for your patch!
> 
> > --- a/drivers/gpu/drm/rcar-du/Kconfig
> > +++ b/drivers/gpu/drm/rcar-du/Kconfig
> > @@ -22,6 +22,7 @@ config DRM_RCAR_LVDS
> >         bool "R-Car DU LVDS Encoder Support"
> >         depends on DRM_RCAR_DU
> >         select DRM_PANEL
> > +       select OF_OVERLAY
> 
> select OF_FLATTREE for of_fdt_unflatten_tree()

I'll fix that.

> (you can probably check with sparc all*config)

I'd have to install a sparc cross-compiler :-)

> > --- /dev/null
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_of.c
> > @@ -0,0 +1,440 @@

[snip]

> > +static void __init rcar_du_of_lvds_patch_one(struct device_node *du,
> > +                                            unsigned int port_id,
> > +                                            const struct resource *res,
> > +                                            const __be32 *reg,
> > +                                            const struct of_phandle_args
> > *clkspec,
> > +                                            struct device_node *local,
> > +                                            struct device_node *remote)
> > +{
> > 
> > +
> > +       /* Skip if the LVDS node already exists. */
> > +       sprintf(name, "lvds@%llx", (u64)res->start);
> 
> I guess you cannot use %pa because you don't want a 0x prefix?

Correct.

> > +       /*
> > +        * Patch the LVDS and DU port nodes names and the associated fixup
> > +        * entries.
> > +        */
> > +       lvds = rcar_du_of_find_node_by_path(overlay.np,
> > +               "/fragment@0/__overlay__/lvds");
> > +       lvds_endpoints[0] = rcar_du_of_find_node_by_path(overlay.np,
> > +               "/fragment@0/__overlay__/lvds/ports/port@0/endpoint");
> > +       lvds_endpoints[1] = rcar_du_of_find_node_by_path(overlay.np,
> > +               "/fragment@0/__overlay__/lvds/ports/port@1/endpoint");
> > +       du_port = rcar_du_of_find_node_by_path(overlay.np,
> > +               "/fragment@1/__overlay__/ports/port@0");
> > +       du_port_fixup = rcar_du_of_find_node_by_path(overlay.np,
> > +               "/__local_fixups__/fragment@1/__overlay__/ports/port@0");
> 
> Many strings with similar prefixes or substrings?
> Would it make sense to e.g. locate "/fragment@0/__overlay__/lvds/ports"
> first, and continue from there?

I can do that for the first three, yes.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* RE: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12 13:26       ` Laurent Pinchart
@ 2018-01-12 14:00         ` Fabrizio Castro
  2018-01-12 14:25           ` Laurent Pinchart
  0 siblings, 1 reply; 36+ messages in thread
From: Fabrizio Castro @ 2018-01-12 14:00 UTC (permalink / raw)
  To: Laurent Pinchart, Biju Das
  Cc: Laurent Pinchart, dri-devel, linux-renesas-soc, Sergei Shtylyov,
	devicetree

Hi Laurent,

> Subject: Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
>
> Hi Biju,
>
> On Friday, 12 January 2018 14:59:53 EET Biju Das wrote:
> > Hi,
> >
> > > Subject: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS
> > > encoder DT bindings
> > >
> > > The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > > corresponding device tree bindings.
> > >
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas@ideasonboard.com>
> > > ---
> > >
> > >  .../bindings/display/bridge/renesas,lvds.txt       | 54 +++++++++++++++++
> > >  MAINTAINERS                                        |  1 +
> > >  2 files changed, 55 insertions(+)
> > >  create mode 100644
> > >
> > > Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > >
> > > diff --git
> > > a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > > b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt new
> > > file mode 100644
> > > index 000000000000..459c56822eda
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > > @@ -0,0 +1,54 @@
> > > +Renesas R-Car LVDS Encoder
> > > +==========================
> > > +
> > > +These DT bindings describe the LVDS encoder embedded in the Renesas
> > > +R-Car Gen2 and Gen3 SoCs.
> > > +
> > > +Required properties:
> > > +
> > > +- compatible : Shall contain one of
> > > +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS

The following also needs polishing for v2:
"(R-Car RZ/G1M)" -> "(RZ/G1M)"

Thanks,
Fab

> > > +encoders
> >
> > Typo. It should be R8A7743 .
>
> Oops. Will fix in v2.
>
> --
> Regards,
>
> Laurent Pinchart




Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12 14:00         ` Fabrizio Castro
@ 2018-01-12 14:25           ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 14:25 UTC (permalink / raw)
  To: Fabrizio Castro
  Cc: devicetree, Laurent Pinchart, Sergei Shtylyov, dri-devel,
	Biju Das, linux-renesas-soc

Hi Fabrizio,

On Friday, 12 January 2018 16:00:31 EET Fabrizio Castro wrote:
> Hi Laurent,
> 
> > Subject: Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS
> > encoder DT bindings
> > On Friday, 12 January 2018 14:59:53 EET Biju Das wrote:
> >> Hi,
> >> 
> >>> Subject: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS
> >>> encoder DT bindings
> >>> 
> >>> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> >>> corresponding device tree bindings.
> >>> 
> >>> Signed-off-by: Laurent Pinchart
> >>> <laurent.pinchart+renesas@ideasonboard.com>
> >>> ---
> >>> 
> >>>  .../bindings/display/bridge/renesas,lvds.txt       | 54 +++++++++++++++
> >>>  MAINTAINERS                                        |  1 +
> >>>  2 files changed, 55 insertions(+)
> >>>  create mode 100644
> >>> 
> >>> Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> >>> 
> >>> diff --git
> >>> a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> >>> b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> >>> new
> >>> file mode 100644
> >>> index 000000000000..459c56822eda
> >>> --- /dev/null
> >>> +++
> >>> b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> >>> @@ -0,0 +1,54 @@
> >>> +Renesas R-Car LVDS Encoder
> >>> +==========================
> >>> +
> >>> +These DT bindings describe the LVDS encoder embedded in the Renesas
> >>> +R-Car Gen2 and Gen3 SoCs.
> >>> +
> >>> +Required properties:
> >>> +
> >>> +- compatible : Shall contain one of
> >>> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> 
> The following also needs polishing for v2:
> "(R-Car RZ/G1M)" -> "(RZ/G1M)"

I'll fix it too.

> >>> +encoders
> >> 
> >> Typo. It should be R8A7743 .
> > 
> > Oops. Will fix in v2.

-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12 10:43       ` Laurent Pinchart
@ 2018-01-12 14:52         ` Sergei Shtylyov
  0 siblings, 0 replies; 36+ messages in thread
From: Sergei Shtylyov @ 2018-01-12 14:52 UTC (permalink / raw)
  To: Laurent Pinchart, Vladimir Zapolskiy
  Cc: Laurent Pinchart, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On 01/12/2018 01:43 PM, Laurent Pinchart wrote:

>>> The internal LVDS encoders now have their own DT bindings, representing
>>> them as part of the DU is deprecated.
>>>
>>> Signed-off-by: Laurent Pinchart
>>> <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
>>> ---
>>>
>>>   .../devicetree/bindings/display/renesas,du.txt     | 26
>>>   +++++++++------------- 1 file changed, 11 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt
>>> b/Documentation/devicetree/bindings/display/renesas,du.txt index
>>> cd48aba3bc8c..8f6e0e118e3e 100644
>>> --- a/Documentation/devicetree/bindings/display/renesas,du.txt
>>> +++ b/Documentation/devicetree/bindings/display/renesas,du.txt
[...]
>>> @@ -71,7 +68,7 @@ Example: R8A7795 (R-Car H3) ES2.0 DU
>>>   		compatible = "renesas,du-r8a7795";
>>>   		reg = <0 0xfeb00000 0 0x80000>,
>>>   		      <0 0xfeb90000 0 0x14>;
>>> -		reg-names = "du", "lvds.0";
>>> +		reg-names = "du";
>>
>> Since "reg-names" list is changed, I believe you'd like to update
>> the "reg" property value as well.
> 
> Good point, I'll fix it.

    Could you also totally drop "reg-names"? Or is that a strong requirement 
now? I mostly dislike how this memory region is named in /proc/iomem... :-)

[...]

MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
                     ` (2 preceding siblings ...)
       [not found]   ` <20180112005858.26472-2-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2018-01-12 15:13   ` Sergei Shtylyov
       [not found]     ` <81a9462b-6aaa-52c7-f741-e504c14838e9-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
  3 siblings, 1 reply; 36+ messages in thread
From: Sergei Shtylyov @ 2018-01-12 15:13 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: linux-renesas-soc, devicetree

Hello!

On 01/12/2018 03:58 AM, Laurent Pinchart wrote:

> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> corresponding device tree bindings.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>   .../bindings/display/bridge/renesas,lvds.txt       | 54 ++++++++++++++++++++++
>   MAINTAINERS                                        |  1 +
>   2 files changed, 55 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> 
> diff --git a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> new file mode 100644
> index 000000000000..459c56822eda
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> @@ -0,0 +1,54 @@
> +Renesas R-Car LVDS Encoder
> +==========================
> +
> +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car Gen2
> +and Gen3 SoCs.
> +
> +Required properties:
> +
> +- compatible : Shall contain one of
> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS encoders
> +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS encoders
> +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS encoders
> +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS encoders
> +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS encoders
> +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS encoders
> +
> +- reg: Base address and length for the memory-mapped registers
> +- clocks: A phandle + clock-specifier pair for the functional clock
> +
> +Requires nodes:
> +
> +The LVDS encoder has two video ports. Their connections are modelled using the
> +OF graph bindings specified in Documentation/devicetree/bindings/graph.txt.
> +
> +- Video port 0 corresponds to the parallel input

    s/parallel/RGB/, perhaps?

> +- Video port 1 corresponds to the LVDS output
> +
> +Each port shall have a single endpoint.
> +
> +
> +Example:
> +
> +	lvds0: lvds@feb90000 {
> +		compatible = "renesas,lvds-r8a7790";
> +		reg = <0 0xfeb90000 0 0x1c>;
> +		clocks = <&cpg CPG_MOD 726>;
> +
> +		ports {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +
> +			port@0 {
> +				reg = <0>;
> +				lvds0_in: endpoint {
> +					remote-endpoint = <&du_out_lvds0>;

    Err, that "du_out_lvds0" label no longer reflects reality, no?

[...]

MBR, Sergei

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12  0:58 ` [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
  2018-01-12  9:49   ` Geert Uytterhoeven
       [not found]   ` <20180112005858.26472-3-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2018-01-12 15:14   ` Sergei Shtylyov
  2018-01-12 16:46     ` Laurent Pinchart
  2018-01-19 21:24   ` Rob Herring
  3 siblings, 1 reply; 36+ messages in thread
From: Sergei Shtylyov @ 2018-01-12 15:14 UTC (permalink / raw)
  To: Laurent Pinchart, dri-devel; +Cc: linux-renesas-soc, devicetree

Hello!

On 01/12/2018 03:58 AM, Laurent Pinchart wrote:

> The internal LVDS encoders now have their own DT bindings, representing
> them as part of the DU is deprecated.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>   .../devicetree/bindings/display/renesas,du.txt     | 26 +++++++++-------------
>   1 file changed, 11 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt b/Documentation/devicetree/bindings/display/renesas,du.txt
> index cd48aba3bc8c..8f6e0e118e3e 100644
> --- a/Documentation/devicetree/bindings/display/renesas,du.txt
> +++ b/Documentation/devicetree/bindings/display/renesas,du.txt
> @@ -17,9 +17,7 @@ Required Properties:
>     - reg: A list of base address and length of each memory resource, one for
>       each entry in the reg-names property.
>     - reg-names: Name of the memory resources. The DU requires one memory
> -    resource for the DU core (named "du") and one memory resource for each
> -    LVDS encoder (named "lvds.x" with "x" being the LVDS controller numerical
> -    index).
> +    resource for the DU core (named "du").

    Could we get rid of this prop altogether?

[...]

MBR, Sergei
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12 15:14   ` Sergei Shtylyov
@ 2018-01-12 16:46     ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 16:46 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Laurent Pinchart, dri-devel, linux-renesas-soc, devicetree

Hi Sergei,

On Friday, 12 January 2018 17:14:33 EET Sergei Shtylyov wrote:
> On 01/12/2018 03:58 AM, Laurent Pinchart wrote:
> > The internal LVDS encoders now have their own DT bindings, representing
> > them as part of the DU is deprecated.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >  .../devicetree/bindings/display/renesas,du.txt     | 26 ++++++++---------
> >  1 file changed, 11 insertions(+), 15 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/display/renesas,du.txt
> > b/Documentation/devicetree/bindings/display/renesas,du.txt index
> > cd48aba3bc8c..8f6e0e118e3e 100644
> > --- a/Documentation/devicetree/bindings/display/renesas,du.txt
> > +++ b/Documentation/devicetree/bindings/display/renesas,du.txt
> > 
> > @@ -17,9 +17,7 @@ Required Properties:
> >     - reg: A list of base address and length of each memory resource, one
> >     for
> >       each entry in the reg-names property.
> >     - reg-names: Name of the memory resources. The DU requires one memory
> > 
> > -    resource for the DU core (named "du") and one memory resource for
> > each
> > -    LVDS encoder (named "lvds.x" with "x" being the LVDS controller
> > numerical
> > -    index).
> > +    resource for the DU core (named "du").
> 
>     Could we get rid of this prop altogether?

Actually yes, as unlike what I thought the driver doesn't use it. I'll drop it 
in v2.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
       [not found]     ` <81a9462b-6aaa-52c7-f741-e504c14838e9-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
@ 2018-01-12 20:34       ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-12 20:34 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Laurent Pinchart, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Sergei,

On Friday, 12 January 2018 17:13:06 EET Sergei Shtylyov wrote:
> On 01/12/2018 03:58 AM, Laurent Pinchart wrote:
> > The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > corresponding device tree bindings.
> > 
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > ---
> > 
> >  .../bindings/display/bridge/renesas,lvds.txt       | 54 +++++++++++++++++
> >  MAINTAINERS                                        |  1 +
> >   2 files changed, 55 insertions(+)
> >   create mode 100644
> >   Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt> 
> > diff --git
> > a/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt new
> > file mode 100644
> > index 000000000000..459c56822eda
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > @@ -0,0 +1,54 @@
> > +Renesas R-Car LVDS Encoder
> > +==========================
> > +
> > +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car
> > Gen2
> > +and Gen3 SoCs.
> > +
> > +Required properties:
> > +
> > +- compatible : Shall contain one of
> > +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS
> > encoders
> > +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS
> > encoders
> > +
> > +- reg: Base address and length for the memory-mapped registers
> > +- clocks: A phandle + clock-specifier pair for the functional clock
> > +
> > +Requires nodes:
> > +
> > +The LVDS encoder has two video ports. Their connections are modelled
> > using the
> > +OF graph bindings specified in Documentation/devicetree/bindings/
> > graph.txt.
> > +
> > +- Video port 0 corresponds to the parallel input
> 
> s/parallel/RGB/, perhaps?

Strictly speaking the LVDS output also carries RGB. I'll replace "parallel" 
with "parallel RGB".

> > +- Video port 1 corresponds to the LVDS output
> > +
> > +Each port shall have a single endpoint.
> > +
> > +
> > +Example:
> > +
> > +	lvds0: lvds@feb90000 {
> > +		compatible = "renesas,lvds-r8a7790";
> > +		reg = <0 0xfeb90000 0 0x1c>;
> > +		clocks = <&cpg CPG_MOD 726>;
> > +
> > +		ports {
> > +			#address-cells = <1>;
> > +			#size-cells = <0>;
> > +
> > +			port@0 {
> > +				reg = <0>;
> > +				lvds0_in: endpoint {
> > +					remote-endpoint = <&du_out_lvds0>;
> 
> Err, that "du_out_lvds0" label no longer reflects reality, no?

Well, it's the output of the DU connected to LVDS encoder 0, so I think the 
name still makes sense. If you can think of a better name feel free to propose 
one, otherwise I'll keep this one.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-12 13:29     ` Laurent Pinchart
@ 2018-01-15  6:55       ` Simon Horman
       [not found]         ` <20180115065528.cfelrll6dm6ggf4e-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
  0 siblings, 1 reply; 36+ messages in thread
From: Simon Horman @ 2018-01-15  6:55 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Jan 12, 2018 at 03:29:48PM +0200, Laurent Pinchart wrote:
> Hi Geert,
> 
> On Friday, 12 January 2018 12:13:18 EET Geert Uytterhoeven wrote:
> > On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > > The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > > corresponding device tree bindings.
> > > 
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > > 
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > > @@ -0,0 +1,54 @@
> > > +Renesas R-Car LVDS Encoder
> > > +==========================
> > > +
> > > +These DT bindings describe the LVDS encoder embedded in the Renesas R-Car
> > > Gen2 +and Gen3 SoCs.
> > > +
> > > +Required properties:
> > > +
> > > +- compatible : Shall contain one of
> > > +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> > > encoders
> > > +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS
> > > encoders
> > > +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS
> > > encoders
> > > +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS
> > > encoders
> > > +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS
> > > encoders
> > > +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS
> > > encoders
> > 
> > As this is a new binding, please use "renesas,<soc>-lvds".
> 
> I've recently been thinking that we made the wrong choice, <ip>-<soc> would be 
> better in my opinion as it aligns with <ip>-<version>, but it's too late to 
> change that, so I'll change the order here.

My recollection is that in the beginning we had a bit of a mixture but
leaned towards <ip>-<soc>, which made sense in my opinion. However, after
some discussion it was agreed that the best-practice for upstream was to
use <soc>-<ip>. Unless that situation has changed lets stock with using
<soc>-<ip> for new bindings.

> > BTW, would it make sense to use "renesas,<soc>-du" for the new DU binding,
> > too? Or have you reserved that for the future version that will have a
> > one-to-one mapping between device nodes and DU channels? ;-)
> 
> It's a good idea, let's reserve it for that evolution. If it ever happens ;-)
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
  2018-01-12 13:48   ` Laurent Pinchart
@ 2018-01-15  6:57     ` Simon Horman
  2018-01-15  7:00       ` Laurent Pinchart
  0 siblings, 1 reply; 36+ messages in thread
From: Simon Horman @ 2018-01-15  6:57 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Jan 12, 2018 at 03:48:25PM +0200, Laurent Pinchart wrote:
> Hi Geert,
> 
> On Friday, 12 January 2018 11:47:03 EET Geert Uytterhoeven wrote:
> > On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > > This patch series addresses a design mistake that dates back from the
> > > initial DU support. Support for the LVDS encoders, which are IP cores
> > > separate from the DU, was bundled in the DU driver. Worse, both the DU
> > > and LVDS were described through a single DT node.
> > > 
> > > To fix the, patches 01/10 and 02/10 define new DT bindings for the LVDS
> > > encoders, and deprecate their description inside the DU bindings. To
> > > retain backward compatibility with existing DT, patch 03/10 then patches
> > > the device tree at runtime to convert the legacy bindings to the new ones.
> > 
> > Looks like we will have to postpone the R-Car Gen2 Modern DT flag day
> > again by a few kernel releases?
> 
> Why so ? We don't have to drop support for all legacy DT bindings at the same 
> time, do we ? We can switch to the new-style clock bindings on Gen2 already, 
> and drop the legacy LVDS bindings later.

To clarify, after this patchset.
* Old DTs work with old and new kernels.
* New DTs require new kernels.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
       [not found] ` <20180112005858.26472-1-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2018-01-15  6:59   ` Simon Horman
  0 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2018-01-15  6:59 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Jan 12, 2018 at 02:58:48AM +0200, Laurent Pinchart wrote:
> Hello,
> 
> This patch series addresses a design mistake that dates back from the initial
> DU support. Support for the LVDS encoders, which are IP cores separate from
> the DU, was bundled in the DU driver. Worse, both the DU and LVDS were
> described through a single DT node.
> 
> To fix the, patches 01/10 and 02/10 define new DT bindings for the LVDS
> encoders, and deprecate their description inside the DU bindings. To retain
> backward compatibility with existing DT, patch 03/10 then patches the device
> tree at runtime to convert the legacy bindings to the new ones.
> 
> With the DT side addressed, patch 04/10 then converts the LVDS support code to
> a separate bridge driver. After a small fix to the Porter board device tree in
> patch 05/10, patches 06/10 to 10/10 then update all the device tree sources to
> the new LVDS encoders bindings.
> 
> I decided to go for live DT patching in patch 03/10 because implementing
> support for both the legacy and new bindings in the driver would have been
> very intrusive, and prevented further cleanups. I'm in a way both proud and 
> ashamed of that patch that I would call a neat and dirty hack. It was fun to
> write perhaps in a similar way that one would enjoy researching and developing
> proof-of-concepts for security holes: they're good and bad at the same time.
> 
> Anyway, with this philosophical considerations aside, there were a few
> shortcomings in the OF API that I worked around with local code in the driver.
> If anyone is interested in performing similar live DT patching I think we
> could move some of the code to the OF core. For instance I was surprised
> to not find a device node lookup by path function that would start at a
> given node instead of the root of the live device tree, and had to write
> rcar_du_of_find_node_by_path(). Utility functions to add or modify properties
> or to rename nodes could similarly be added.
> 
> Laurent Pinchart (10):
>   dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
>   dt-bindings: display: renesas: Deprecate LVDS support in the DU
>     bindings
>   drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
>   drm: rcar-du: Convert LVDS encoder code to bridge driver
>   ARM: dts: porter: Fix HDMI output routing
>   ARM: dts: r8a7790: Convert to new LVDS DT bindings
>   ARM: dts: r8a7791: Convert to new LVDS DT bindings
>   ARM: dts: r8a7793: Convert to new LVDS DT bindings
>   arm64: dts: renesas: r8a7795: Convert to new LVDS DT bindings
>   arm64: dts: renesas: r8a7796: Convert to new LVDS DT bindings

I understand that there will be a v2 to address review of the non DTS
patches. I am marking the DTS patches as "Changes Requested" as they
are dependent on the bindings patches from my PoV.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
       [not found]         ` <20180115065528.cfelrll6dm6ggf4e-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
@ 2018-01-15  6:59           ` Laurent Pinchart
  2018-01-15  7:57             ` Simon Horman
  2018-01-15  8:05             ` Geert Uytterhoeven
  0 siblings, 2 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-15  6:59 UTC (permalink / raw)
  To: Simon Horman
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

Hi Simon,

On Monday, 15 January 2018 08:55:29 EET Simon Horman wrote:
> On Fri, Jan 12, 2018 at 03:29:48PM +0200, Laurent Pinchart wrote:
> > On Friday, 12 January 2018 12:13:18 EET Geert Uytterhoeven wrote:
> >> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> >>> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> >>> corresponding device tree bindings.
> >>> 
> >>> Signed-off-by: Laurent Pinchart
> >>> <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> >>> 
> >>> --- /dev/null
> >>> +++
> >>> b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> >>> @@ -0,0 +1,54 @@
> >>> +Renesas R-Car LVDS Encoder
> >>> +==========================
> >>> +
> >>> +These DT bindings describe the LVDS encoder embedded in the Renesas
> >>> R-Car Gen2 +and Gen3 SoCs.
> >>> +
> >>> +Required properties:
> >>> +
> >>> +- compatible : Shall contain one of
> >>> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> >>> encoders
> >>> +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS
> >>> encoders
> >>> +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS
> >>> encoders
> >>> +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS
> >>> encoders
> >>> +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS
> >>> encoders
> >>> +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS
> >>> encoders
> >> 
> >> As this is a new binding, please use "renesas,<soc>-lvds".
> > 
> > I've recently been thinking that we made the wrong choice, <ip>-<soc>
> > would be better in my opinion as it aligns with <ip>-<version>, but it's
> > too late to change that, so I'll change the order here.
> 
> My recollection is that in the beginning we had a bit of a mixture but
> leaned towards <ip>-<soc>, which made sense in my opinion. However, after
> some discussion it was agreed that the best-practice for upstream was to
> use <soc>-<ip>. Unless that situation has changed lets stock with using
> <soc>-<ip> for new bindings.

Sure, that was my plan, and it seems I failed to explain it clearly. I too 
believe that <ip>-<soc> would be better, but as we have standardized on <soc>-
<ip> and as there's no strong reason to reconsider that decision at the 
moment, the next version of this patch will use <soc>-<ip>. It was a mistake 
in v1, not an attempt to change what we had agreed on.

> >> BTW, would it make sense to use "renesas,<soc>-du" for the new DU
> >> binding, too? Or have you reserved that for the future version that will
> >> have a one-to-one mapping between device nodes and DU channels? ;-)
> > 
> > It's a good idea, let's reserve it for that evolution. If it ever happens
> > ;-)

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
  2018-01-15  6:57     ` Simon Horman
@ 2018-01-15  7:00       ` Laurent Pinchart
  2018-01-15  7:58         ` Simon Horman
  0 siblings, 1 reply; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-15  7:00 UTC (permalink / raw)
  To: Simon Horman
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov, devicetree

Hi Simon,

On Monday, 15 January 2018 08:57:48 EET Simon Horman wrote:
> On Fri, Jan 12, 2018 at 03:48:25PM +0200, Laurent Pinchart wrote:
> > On Friday, 12 January 2018 11:47:03 EET Geert Uytterhoeven wrote:
> >> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> >>> This patch series addresses a design mistake that dates back from the
> >>> initial DU support. Support for the LVDS encoders, which are IP cores
> >>> separate from the DU, was bundled in the DU driver. Worse, both the DU
> >>> and LVDS were described through a single DT node.
> >>> 
> >>> To fix the, patches 01/10 and 02/10 define new DT bindings for the
> >>> LVDS encoders, and deprecate their description inside the DU bindings.
> >>> To retain backward compatibility with existing DT, patch 03/10 then
> >>> patches the device tree at runtime to convert the legacy bindings to the
> >>> new ones.
> >> 
> >> Looks like we will have to postpone the R-Car Gen2 Modern DT flag day
> >> again by a few kernel releases?
> > 
> > Why so ? We don't have to drop support for all legacy DT bindings at the
> > same time, do we ? We can switch to the new-style clock bindings on Gen2
> > already, and drop the legacy LVDS bindings later.
> 
> To clarify, after this patchset.
> * Old DTs work with old and new kernels.
> * New DTs require new kernels.

That's correct. I've tested old DTs with new kernels successfully on Lager, 
Salvator-X (both H3 ES1.x and M3-W) and Salvator-XS.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-15  6:59           ` Laurent Pinchart
@ 2018-01-15  7:57             ` Simon Horman
  2018-01-15  8:05             ` Geert Uytterhoeven
  1 sibling, 0 replies; 36+ messages in thread
From: Simon Horman @ 2018-01-15  7:57 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov, devicetree

On Mon, Jan 15, 2018 at 08:59:38AM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Monday, 15 January 2018 08:55:29 EET Simon Horman wrote:
> > On Fri, Jan 12, 2018 at 03:29:48PM +0200, Laurent Pinchart wrote:
> > > On Friday, 12 January 2018 12:13:18 EET Geert Uytterhoeven wrote:
> > >> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > >>> The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
> > >>> corresponding device tree bindings.
> > >>> 
> > >>> Signed-off-by: Laurent Pinchart
> > >>> <laurent.pinchart+renesas@ideasonboard.com>
> > >>> 
> > >>> --- /dev/null
> > >>> +++
> > >>> b/Documentation/devicetree/bindings/display/bridge/renesas,lvds.txt
> > >>> @@ -0,0 +1,54 @@
> > >>> +Renesas R-Car LVDS Encoder
> > >>> +==========================
> > >>> +
> > >>> +These DT bindings describe the LVDS encoder embedded in the Renesas
> > >>> R-Car Gen2 +and Gen3 SoCs.
> > >>> +
> > >>> +Required properties:
> > >>> +
> > >>> +- compatible : Shall contain one of
> > >>> +  - "renesas,lvds-r8a7743" for R8A7790 (R-Car RZ/G1M) compatible LVDS
> > >>> encoders
> > >>> +  - "renesas,lvds-r8a7790" for R8A7790 (R-Car H2) compatible LVDS
> > >>> encoders
> > >>> +  - "renesas,lvds-r8a7791" for R8A7791 (R-Car M2-W) compatible LVDS
> > >>> encoders
> > >>> +  - "renesas,lvds-r8a7793" for R8A7791 (R-Car M2-N) compatible LVDS
> > >>> encoders
> > >>> +  - "renesas,lvds-r8a7795" for R8A7795 (R-Car H3) compatible LVDS
> > >>> encoders
> > >>> +  - "renesas,lvds-r8a7796" for R8A7796 (R-Car M3-W) compatible LVDS
> > >>> encoders
> > >> 
> > >> As this is a new binding, please use "renesas,<soc>-lvds".
> > > 
> > > I've recently been thinking that we made the wrong choice, <ip>-<soc>
> > > would be better in my opinion as it aligns with <ip>-<version>, but it's
> > > too late to change that, so I'll change the order here.
> > 
> > My recollection is that in the beginning we had a bit of a mixture but
> > leaned towards <ip>-<soc>, which made sense in my opinion. However, after
> > some discussion it was agreed that the best-practice for upstream was to
> > use <soc>-<ip>. Unless that situation has changed lets stock with using
> > <soc>-<ip> for new bindings.
> 
> Sure, that was my plan, and it seems I failed to explain it clearly. I too 
> believe that <ip>-<soc> would be better, but as we have standardized on <soc>-
> <ip> and as there's no strong reason to reconsider that decision at the 
> moment, the next version of this patch will use <soc>-<ip>. It was a mistake 
> in v1, not an attempt to change what we had agreed on.

Thanks, it seems that we are in complete agreement.

> > >> BTW, would it make sense to use "renesas,<soc>-du" for the new DU
> > >> binding, too? Or have you reserved that for the future version that will
> > >> have a one-to-one mapping between device nodes and DU channels? ;-)
> > > 
> > > It's a good idea, let's reserve it for that evolution. If it ever happens
> > > ;-)
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver
  2018-01-15  7:00       ` Laurent Pinchart
@ 2018-01-15  7:58         ` Simon Horman
  0 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2018-01-15  7:58 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov, devicetree

On Mon, Jan 15, 2018 at 09:00:59AM +0200, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Monday, 15 January 2018 08:57:48 EET Simon Horman wrote:
> > On Fri, Jan 12, 2018 at 03:48:25PM +0200, Laurent Pinchart wrote:
> > > On Friday, 12 January 2018 11:47:03 EET Geert Uytterhoeven wrote:
> > >> On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > >>> This patch series addresses a design mistake that dates back from the
> > >>> initial DU support. Support for the LVDS encoders, which are IP cores
> > >>> separate from the DU, was bundled in the DU driver. Worse, both the DU
> > >>> and LVDS were described through a single DT node.
> > >>> 
> > >>> To fix the, patches 01/10 and 02/10 define new DT bindings for the
> > >>> LVDS encoders, and deprecate their description inside the DU bindings.
> > >>> To retain backward compatibility with existing DT, patch 03/10 then
> > >>> patches the device tree at runtime to convert the legacy bindings to the
> > >>> new ones.
> > >> 
> > >> Looks like we will have to postpone the R-Car Gen2 Modern DT flag day
> > >> again by a few kernel releases?
> > > 
> > > Why so ? We don't have to drop support for all legacy DT bindings at the
> > > same time, do we ? We can switch to the new-style clock bindings on Gen2
> > > already, and drop the legacy LVDS bindings later.
> > 
> > To clarify, after this patchset.
> > * Old DTs work with old and new kernels.
> > * New DTs require new kernels.
> 
> That's correct. I've tested old DTs with new kernels successfully on Lager, 
> Salvator-X (both H3 ES1.x and M3-W) and Salvator-XS.

Thanks, no objections to this approach from my side.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-15  6:59           ` Laurent Pinchart
  2018-01-15  7:57             ` Simon Horman
@ 2018-01-15  8:05             ` Geert Uytterhoeven
  2018-01-15  8:26               ` Laurent Pinchart
  1 sibling, 1 reply; 36+ messages in thread
From: Geert Uytterhoeven @ 2018-01-15  8:05 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Simon Horman, Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree

Hi Laurent,

On Mon, Jan 15, 2018 at 7:59 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Monday, 15 January 2018 08:55:29 EET Simon Horman wrote:
>> On Fri, Jan 12, 2018 at 03:29:48PM +0200, Laurent Pinchart wrote:
>> > On Friday, 12 January 2018 12:13:18 EET Geert Uytterhoeven wrote:
>> >> As this is a new binding, please use "renesas,<soc>-lvds".
>> >
>> > I've recently been thinking that we made the wrong choice, <ip>-<soc>
>> > would be better in my opinion as it aligns with <ip>-<version>, but it's
>> > too late to change that, so I'll change the order here.
>>
>> My recollection is that in the beginning we had a bit of a mixture but
>> leaned towards <ip>-<soc>, which made sense in my opinion. However, after
>> some discussion it was agreed that the best-practice for upstream was to
>> use <soc>-<ip>. Unless that situation has changed lets stock with using
>> <soc>-<ip> for new bindings.
>
> Sure, that was my plan, and it seems I failed to explain it clearly. I too
> believe that <ip>-<soc> would be better, but as we have standardized on <soc>-
> <ip> and as there's no strong reason to reconsider that decision at the
> moment, the next version of this patch will use <soc>-<ip>. It was a mistake
> in v1, not an attempt to change what we had agreed on.

Note that I believe you have to consider the full tuple "<vendor>,<soc>-<ip>"
to see the light: <soc> is more closely tied to <vendor>, than <ip> is.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  2018-01-15  8:05             ` Geert Uytterhoeven
@ 2018-01-15  8:26               ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2018-01-15  8:26 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Simon Horman, Laurent Pinchart, DRI Development, Linux-Renesas,
	Sergei Shtylyov, devicetree

Hi Geert,

On Monday, 15 January 2018 10:05:59 EET Geert Uytterhoeven wrote:
> On Mon, Jan 15, 2018 at 7:59 AM, Laurent Pinchart wrote:
> > On Monday, 15 January 2018 08:55:29 EET Simon Horman wrote:
> >> On Fri, Jan 12, 2018 at 03:29:48PM +0200, Laurent Pinchart wrote:
> >>> On Friday, 12 January 2018 12:13:18 EET Geert Uytterhoeven wrote:
> >>>> As this is a new binding, please use "renesas,<soc>-lvds".
> >>> 
> >>> I've recently been thinking that we made the wrong choice, <ip>-<soc>
> >>> would be better in my opinion as it aligns with <ip>-<version>, but
> >>> it's too late to change that, so I'll change the order here.
> >> 
> >> My recollection is that in the beginning we had a bit of a mixture but
> >> leaned towards <ip>-<soc>, which made sense in my opinion. However, after
> >> some discussion it was agreed that the best-practice for upstream was to
> >> use <soc>-<ip>. Unless that situation has changed lets stock with using
> >> <soc>-<ip> for new bindings.
> > 
> > Sure, that was my plan, and it seems I failed to explain it clearly. I too
> > believe that <ip>-<soc> would be better, but as we have standardized on
> > <soc>- <ip> and as there's no strong reason to reconsider that decision
> > at the moment, the next version of this patch will use <soc>-<ip>. It was
> > a mistake in v1, not an attempt to change what we had agreed on.
> 
> Note that I believe you have to consider the full tuple
> "<vendor>,<soc>-<ip>" to see the light: <soc> is more closely tied to
> <vendor>, than <ip> is.

I suppose there are pros and cons for both options :-) I see <soc> more as a 
version qualifier.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12 10:44       ` Laurent Pinchart
@ 2018-01-19 21:23         ` Rob Herring
  0 siblings, 0 replies; 36+ messages in thread
From: Rob Herring @ 2018-01-19 21:23 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Geert Uytterhoeven, Laurent Pinchart, DRI Development,
	Linux-Renesas, Sergei Shtylyov,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Fri, Jan 12, 2018 at 12:44:45PM +0200, Laurent Pinchart wrote:
> Hi Geert,
> 
> On Friday, 12 January 2018 11:49:28 EET Geert Uytterhoeven wrote:
> > On Fri, Jan 12, 2018 at 1:58 AM, Laurent Pinchart wrote:
> > > The internal LVDS encoders now have their own DT bindings, representing
> > > them as part of the DU is deprecated.
> > > 
> > > Signed-off-by: Laurent Pinchart
> > > <laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > 
> > FWIW, you're not really deprecating the LVDS part, but removing it
> > completely. Do you want to keep a reference instead?
> 
> I don't think we should keep a reference as it would only confuse DT authors. 
> The information is kept in the git history. I can rewrite the commit message, 
> but I consider this as deprecating the legacy bindings.

We've done it both ways. I'm fine with just deleting.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  2018-01-12  0:58 ` [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
                     ` (2 preceding siblings ...)
  2018-01-12 15:14   ` Sergei Shtylyov
@ 2018-01-19 21:24   ` Rob Herring
  3 siblings, 0 replies; 36+ messages in thread
From: Rob Herring @ 2018-01-19 21:24 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: dri-devel, linux-renesas-soc, Sergei Shtylyov, devicetree

On Fri, Jan 12, 2018 at 02:58:50AM +0200, Laurent Pinchart wrote:
> The internal LVDS encoders now have their own DT bindings, representing
> them as part of the DU is deprecated.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  .../devicetree/bindings/display/renesas,du.txt     | 26 +++++++++-------------
>  1 file changed, 11 insertions(+), 15 deletions(-)

This is the easy part. :)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2018-01-19 21:24 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12  0:58 [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Laurent Pinchart
2018-01-12  0:58 ` [PATCH 01/10] dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings Laurent Pinchart
2018-01-12  9:45   ` Geert Uytterhoeven
     [not found]     ` <CAMuHMdWMgst-1evod+0hZujU2xPtO3UmO9c2CPPrTg=gpHpTbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-12 13:36       ` Laurent Pinchart
2018-01-12 10:13   ` Geert Uytterhoeven
2018-01-12 13:29     ` Laurent Pinchart
2018-01-15  6:55       ` Simon Horman
     [not found]         ` <20180115065528.cfelrll6dm6ggf4e-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2018-01-15  6:59           ` Laurent Pinchart
2018-01-15  7:57             ` Simon Horman
2018-01-15  8:05             ` Geert Uytterhoeven
2018-01-15  8:26               ` Laurent Pinchart
     [not found]   ` <20180112005858.26472-2-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2018-01-12 12:59     ` Biju Das
2018-01-12 13:26       ` Laurent Pinchart
2018-01-12 14:00         ` Fabrizio Castro
2018-01-12 14:25           ` Laurent Pinchart
2018-01-12 15:13   ` Sergei Shtylyov
     [not found]     ` <81a9462b-6aaa-52c7-f741-e504c14838e9-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2018-01-12 20:34       ` Laurent Pinchart
2018-01-12  0:58 ` [PATCH 02/10] dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings Laurent Pinchart
2018-01-12  9:49   ` Geert Uytterhoeven
     [not found]     ` <CAMuHMdXYJmh8ssSRt8u75fTv5gyrpcoPKAuCT=BaF1Eu27CaiQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-12 10:44       ` Laurent Pinchart
2018-01-19 21:23         ` Rob Herring
     [not found]   ` <20180112005858.26472-3-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2018-01-12  9:54     ` Vladimir Zapolskiy
2018-01-12 10:43       ` Laurent Pinchart
2018-01-12 14:52         ` Sergei Shtylyov
2018-01-12 15:14   ` Sergei Shtylyov
2018-01-12 16:46     ` Laurent Pinchart
2018-01-19 21:24   ` Rob Herring
2018-01-12  0:58 ` [PATCH 03/10] drm: rcar-du: Fix legacy DT to create LVDS encoder nodes Laurent Pinchart
     [not found]   ` <20180112005858.26472-4-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2018-01-12 10:09     ` Geert Uytterhoeven
     [not found]       ` <CAMuHMdW5wDj5gyTnh+Xa3J10b_6For0MdhcTFgdU_+sgx=BYmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-12 13:53         ` Laurent Pinchart
2018-01-12  9:47 ` [PATCH 00/10] R-Car DU: Convert LVDS code to bridge driver Geert Uytterhoeven
2018-01-12 13:48   ` Laurent Pinchart
2018-01-15  6:57     ` Simon Horman
2018-01-15  7:00       ` Laurent Pinchart
2018-01-15  7:58         ` Simon Horman
     [not found] ` <20180112005858.26472-1-laurent.pinchart+renesas-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2018-01-15  6:59   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).