# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/media/i2c/toshiba,tc358743.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Toshiba TC358743 HDMI-RX to MIPI CSI2-TX Bridge

maintainers:
  - Hans Verkuil <hverkuil@kernel.org>

description:
  The Toshiba TC358743 HDMI-RX to MIPI CSI2-TX (H2C) is a bridge that converts
  a HDMI stream to MIPI CSI-2 TX. It is programmable through I2C.

properties:
  compatible:
    const: toshiba,tc358743

  reg:
    maxItems: 1

  clocks:
    maxItems: 1

  clock-names:
    const: refclk

  reset-gpios:
    maxItems: 1

  interrupts:
    maxItems: 1

  port:
    $ref: /schemas/graph.yaml#/$defs/port-base
    unevaluatedProperties: false

    properties:
      endpoint:
        $ref: /schemas/media/video-interfaces.yaml#
        unevaluatedProperties: false

        properties:
          data-lanes:
            oneOf:
              - items:
                  - const: 1
                  - const: 2
              - items:
                  - const: 1
                  - const: 2
                  - const: 3
                  - const: 4

required:
  - compatible
  - reg
  - clocks
  - clock-names
  - port

additionalProperties: false

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
    #include <dt-bindings/interrupt-controller/irq.h>

    i2c {
        #address-cells = <1>;
        #size-cells = <0>;

        bridge@f {
            compatible = "toshiba,tc358743";
            reg = <0x0f>;
            clocks = <&hdmi_osc>;
            clock-names = "refclk";
            reset-gpios = <&gpio6 9 GPIO_ACTIVE_LOW>;
            interrupt-parent = <&gpio2>;
            interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;

            port {
                 endpoint {
                     remote-endpoint = <&mipi_csi2_in>;
                     data-lanes = <1 2 3 4>;
                     clock-lanes = <0>;
                     clock-noncontinuous;
                     link-frequencies = /bits/ 64 <297000000>;
                 };
            };
        };
    };