Re: [PATCH v8 07/10] dt-bindings: display: add i.MX6 MIPI DSI host controller doc

2020-05-01 Thread Rob Herring
On Mon, Apr 27, 2020 at 11:19:49AM +0300, Adrian Ratiu wrote:
> This provides an example DT binding for the MIPI DSI host controller
> present on the i.MX6 SoC based on Synopsis DesignWare v1.01 IP.
> 
> Cc: Rob Herring 
> Cc: Neil Armstrong 
> Cc: Fabio Estevam 
> Cc: Laurent Pinchart 
> Cc: devicet...@vger.kernel.org
> Tested-by: Adrian Pop 
> Tested-by: Arnaud Ferraris 
> Signed-off-by: Sjoerd Simons 
> Signed-off-by: Martyn Welch 
> Signed-off-by: Adrian Ratiu 
> ---
> Changes since v7:
>   - Clarified port@0,1 descriptions, marked them as required and
>   added missing port@0 in example (Laurent)
> 
> Changes since v6:
>   - Added ref to the newly created snps,dw-mipi-dsi.yaml (Laurent)
>   - Moved *-cells properties outside patternProperties (Laurent)
>   - Removed the panel port documentation (Laurent)
>   - Wrapped lines at 80 chars, typo fixes, sort includes (Laurent)
> 
> Changes since v5:
>   - Fixed missing reg warning (Fabio)
>   - Updated dt-schema and fixed warnings (Rob)
> 
> Changes since v4:
>   - Fixed yaml binding to pass `make dt_binding_check dtbs_check`
>   and addressed received binding feedback (Rob)
> 
> Changes since v3:
>   - Added commit message (Neil)
>   - Converted to yaml format (Neil)
>   - Minor dt node + driver fixes (Rob)
>   - Added small panel example to the host controller binding
> 
> Changes since v2:
>   - Fixed commit tags (Emil)
> ---
>  .../display/imx/fsl,mipi-dsi-imx6.yaml| 145 ++
>  1 file changed, 145 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml 
> b/Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml
> new file mode 100644
> index 0..c2c3489e63fa3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml
> @@ -0,0 +1,145 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/display/imx/fsl,mipi-dsi-imx6.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Freescale i.MX6 DW MIPI DSI Host Controller
> +
> +maintainers:
> +  - Adrian Ratiu 
> +
> +description: |
> +  The i.MX6 DSI host controller is a Synopsys DesignWare MIPI DSI v1.01
> +  IP block with a companion PHY IP.
> +
> +  These DT bindings follow the Synopsys DW MIPI DSI bindings defined in
> +  Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt with
> +  the following device-specific properties.
> +
> +allOf:
> +  - $ref: ../bridge/snps,dw-mipi-dsi.yaml#
> +
> +properties:
> +  '#address-cells':
> +const: 1
> +
> +  '#size-cells':
> +const: 0
> +
> +  compatible:
> +items:
> +  - const: fsl,imx6q-mipi-dsi
> +  - const: snps,dw-mipi-dsi

This schema is going to be applied on any node with 'snps,dw-mipi-dsi'. 
You'll need a custom 'select' with only 'fsl,imx6q-mipi-dsi'. There's a 
few examples in the tree.

> +
> +  reg:
> +maxItems: 1
> +
> +  interrupts:
> +maxItems: 1
> +
> +  clocks:
> +items:
> +  - description: Module Clock
> +  - description: DSI bus clock
> +
> +  clock-names:
> +items:
> +  - const: ref
> +  - const: pclk
> +
> +  fsl,gpr:
> +description:
> +  Phandle to the iomuxc-gpr region containing the multiplexer ctrl 
> register.
> +$ref: /schemas/types.yaml#/definitions/phandle
> +
> +  ports:
> +type: object
> +description: |
> +  A node containing DSI input & output port nodes with endpoint
> +  definitions as documented in
> +  Documentation/devicetree/bindings/media/video-interfaces.txt
> +  Documentation/devicetree/bindings/graph.txt
> +properties:
> +  port@0:
> +type: object
> +description:
> +  DSI input port connected to a parallel RGB LTDC output port.
> +
> +  port@1:
> +type: object
> +description:
> +  DSI serial RGB output port connected to a panel or bridge input 
> port.
> +
> +required:
> +  - port@0
> +  - port@1
> +
> +additionalProperties: false

When including other schemas, you need 'unevalatedProperties: false' 
instead. Then you can drop anything here that doesn't have more 
constraints like the next property:

> +
> +patternProperties:
> +  "^panel@[0-3]$":
> +type: object
> +
> +required:
> +  - "#address-cells"
> +  - "#size-cells"
> +  - compatible
> +  - reg
> +  - interrupts
> +  - clocks
> +  - clock-names
> +  - ports
> +
> +examples:
> +  - |+
> +#include 
> +#include 
> +#include 
> +
> +dsi: dsi@21e {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +compatible = "fsl,imx6q-mipi-dsi", "snps,dw-mipi-dsi";
> +reg = <0x021e 0x4000>;
> +interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
> +fsl,gpr = <>;
> +clocks = < IMX6QDL_CLK_MIPI_CORE_CFG>,
> + < 

[PATCH v8 07/10] dt-bindings: display: add i.MX6 MIPI DSI host controller doc

2020-04-27 Thread Adrian Ratiu
This provides an example DT binding for the MIPI DSI host controller
present on the i.MX6 SoC based on Synopsis DesignWare v1.01 IP.

Cc: Rob Herring 
Cc: Neil Armstrong 
Cc: Fabio Estevam 
Cc: Laurent Pinchart 
Cc: devicet...@vger.kernel.org
Tested-by: Adrian Pop 
Tested-by: Arnaud Ferraris 
Signed-off-by: Sjoerd Simons 
Signed-off-by: Martyn Welch 
Signed-off-by: Adrian Ratiu 
---
Changes since v7:
  - Clarified port@0,1 descriptions, marked them as required and
  added missing port@0 in example (Laurent)

Changes since v6:
  - Added ref to the newly created snps,dw-mipi-dsi.yaml (Laurent)
  - Moved *-cells properties outside patternProperties (Laurent)
  - Removed the panel port documentation (Laurent)
  - Wrapped lines at 80 chars, typo fixes, sort includes (Laurent)

Changes since v5:
  - Fixed missing reg warning (Fabio)
  - Updated dt-schema and fixed warnings (Rob)

Changes since v4:
  - Fixed yaml binding to pass `make dt_binding_check dtbs_check`
  and addressed received binding feedback (Rob)

Changes since v3:
  - Added commit message (Neil)
  - Converted to yaml format (Neil)
  - Minor dt node + driver fixes (Rob)
  - Added small panel example to the host controller binding

Changes since v2:
  - Fixed commit tags (Emil)
---
 .../display/imx/fsl,mipi-dsi-imx6.yaml| 145 ++
 1 file changed, 145 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml

diff --git 
a/Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml 
b/Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml
new file mode 100644
index 0..c2c3489e63fa3
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml
@@ -0,0 +1,145 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/imx/fsl,mipi-dsi-imx6.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Freescale i.MX6 DW MIPI DSI Host Controller
+
+maintainers:
+  - Adrian Ratiu 
+
+description: |
+  The i.MX6 DSI host controller is a Synopsys DesignWare MIPI DSI v1.01
+  IP block with a companion PHY IP.
+
+  These DT bindings follow the Synopsys DW MIPI DSI bindings defined in
+  Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt with
+  the following device-specific properties.
+
+allOf:
+  - $ref: ../bridge/snps,dw-mipi-dsi.yaml#
+
+properties:
+  '#address-cells':
+const: 1
+
+  '#size-cells':
+const: 0
+
+  compatible:
+items:
+  - const: fsl,imx6q-mipi-dsi
+  - const: snps,dw-mipi-dsi
+
+  reg:
+maxItems: 1
+
+  interrupts:
+maxItems: 1
+
+  clocks:
+items:
+  - description: Module Clock
+  - description: DSI bus clock
+
+  clock-names:
+items:
+  - const: ref
+  - const: pclk
+
+  fsl,gpr:
+description:
+  Phandle to the iomuxc-gpr region containing the multiplexer ctrl 
register.
+$ref: /schemas/types.yaml#/definitions/phandle
+
+  ports:
+type: object
+description: |
+  A node containing DSI input & output port nodes with endpoint
+  definitions as documented in
+  Documentation/devicetree/bindings/media/video-interfaces.txt
+  Documentation/devicetree/bindings/graph.txt
+properties:
+  port@0:
+type: object
+description:
+  DSI input port connected to a parallel RGB LTDC output port.
+
+  port@1:
+type: object
+description:
+  DSI serial RGB output port connected to a panel or bridge input port.
+
+required:
+  - port@0
+  - port@1
+
+additionalProperties: false
+
+patternProperties:
+  "^panel@[0-3]$":
+type: object
+
+required:
+  - "#address-cells"
+  - "#size-cells"
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - ports
+
+examples:
+  - |+
+#include 
+#include 
+#include 
+
+dsi: dsi@21e {
+#address-cells = <1>;
+#size-cells = <0>;
+compatible = "fsl,imx6q-mipi-dsi", "snps,dw-mipi-dsi";
+reg = <0x021e 0x4000>;
+interrupts = <0 102 IRQ_TYPE_LEVEL_HIGH>;
+fsl,gpr = <>;
+clocks = < IMX6QDL_CLK_MIPI_CORE_CFG>,
+ < IMX6QDL_CLK_MIPI_IPG>;
+clock-names = "ref", "pclk";
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+port@0 {
+reg = <0>;
+mipi_mux_0: endpoint {
+remote-endpoint = <_di0_mipi>;
+};
+};
+port@1 {
+reg = <1>;
+dsi_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+
+panel@0 {
+compatible = "sharp,ls032b3sx01";
+reg = <0>;
+reset-gpios = < 8 GPIO_ACTIVE_LOW>;
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+