162306a36Sopenharmony_ci# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
262306a36Sopenharmony_ci%YAML 1.2
362306a36Sopenharmony_ci---
462306a36Sopenharmony_ci$id: http://devicetree.org/schemas/media/video-interfaces.yaml#
562306a36Sopenharmony_ci$schema: http://devicetree.org/meta-schemas/core.yaml#
662306a36Sopenharmony_ci
762306a36Sopenharmony_cititle: Common Properties for Video Receiver and Transmitter Interface Endpoints
862306a36Sopenharmony_ci
962306a36Sopenharmony_cimaintainers:
1062306a36Sopenharmony_ci  - Sakari Ailus <sakari.ailus@linux.intel.com>
1162306a36Sopenharmony_ci  - Laurent Pinchart <laurent.pinchart@ideasonboard.com>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cidescription: |
1462306a36Sopenharmony_ci  Video data pipelines usually consist of external devices, e.g. camera sensors,
1562306a36Sopenharmony_ci  controlled over an I2C, SPI or UART bus, and SoC internal IP blocks, including
1662306a36Sopenharmony_ci  video DMA engines and video data processors.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci  SoC internal blocks are described by DT nodes, placed similarly to other SoC
1962306a36Sopenharmony_ci  blocks.  External devices are represented as child nodes of their respective
2062306a36Sopenharmony_ci  bus controller nodes, e.g. I2C.
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci  Data interfaces on all video devices are described by their child 'port' nodes.
2362306a36Sopenharmony_ci  Configuration of a port depends on other devices participating in the data
2462306a36Sopenharmony_ci  transfer and is described by 'endpoint' subnodes.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci  device {
2762306a36Sopenharmony_ci      ...
2862306a36Sopenharmony_ci      ports {
2962306a36Sopenharmony_ci          #address-cells = <1>;
3062306a36Sopenharmony_ci          #size-cells = <0>;
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci          port@0 {
3362306a36Sopenharmony_ci              ...
3462306a36Sopenharmony_ci              endpoint@0 { ... };
3562306a36Sopenharmony_ci              endpoint@1 { ... };
3662306a36Sopenharmony_ci          };
3762306a36Sopenharmony_ci          port@1 { ... };
3862306a36Sopenharmony_ci      };
3962306a36Sopenharmony_ci  };
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci  If a port can be configured to work with more than one remote device on the same
4262306a36Sopenharmony_ci  bus, an 'endpoint' child node must be provided for each of them.  If more than
4362306a36Sopenharmony_ci  one port is present in a device node or there is more than one endpoint at a
4462306a36Sopenharmony_ci  port, or port node needs to be associated with a selected hardware interface,
4562306a36Sopenharmony_ci  a common scheme using '#address-cells', '#size-cells' and 'reg' properties is
4662306a36Sopenharmony_ci  used.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci  All 'port' nodes can be grouped under optional 'ports' node, which allows to
4962306a36Sopenharmony_ci  specify #address-cells, #size-cells properties independently for the 'port'
5062306a36Sopenharmony_ci  and 'endpoint' nodes and any child device nodes a device might have.
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci  Two 'endpoint' nodes are linked with each other through their 'remote-endpoint'
5362306a36Sopenharmony_ci  phandles.  An endpoint subnode of a device contains all properties needed for
5462306a36Sopenharmony_ci  configuration of this device for data exchange with other device.  In most
5562306a36Sopenharmony_ci  cases properties at the peer 'endpoint' nodes will be identical, however they
5662306a36Sopenharmony_ci  might need to be different when there is any signal modifications on the bus
5762306a36Sopenharmony_ci  between two devices, e.g. there are logic signal inverters on the lines.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci  It is allowed for multiple endpoints at a port to be active simultaneously,
6062306a36Sopenharmony_ci  where supported by a device.  For example, in case where a data interface of
6162306a36Sopenharmony_ci  a device is partitioned into multiple data busses, e.g. 16-bit input port
6262306a36Sopenharmony_ci  divided into two separate ITU-R BT.656 8-bit busses.  In such case bus-width
6362306a36Sopenharmony_ci  and data-shift properties can be used to assign physical data lines to each
6462306a36Sopenharmony_ci  endpoint node (logical bus).
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci  Documenting bindings for devices
6762306a36Sopenharmony_ci  --------------------------------
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci  All required and optional bindings the device supports shall be explicitly
7062306a36Sopenharmony_ci  documented in device DT binding documentation. This also includes port and
7162306a36Sopenharmony_ci  endpoint nodes for the device, including unit-addresses and reg properties
7262306a36Sopenharmony_ci  where relevant.
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ciallOf:
7562306a36Sopenharmony_ci  - $ref: /schemas/graph.yaml#/$defs/endpoint-base
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciproperties:
7862306a36Sopenharmony_ci  slave-mode:
7962306a36Sopenharmony_ci    type: boolean
8062306a36Sopenharmony_ci    description:
8162306a36Sopenharmony_ci      Indicates that the link is run in slave mode. The default when this
8262306a36Sopenharmony_ci      property is not specified is master mode. In the slave mode horizontal and
8362306a36Sopenharmony_ci      vertical synchronization signals are provided to the slave device (data
8462306a36Sopenharmony_ci      source) by the master device (data sink). In the master mode the data
8562306a36Sopenharmony_ci      source device is also the source of the synchronization signals.
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci  bus-type:
8862306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
8962306a36Sopenharmony_ci    enum:
9062306a36Sopenharmony_ci      - 1 # MIPI CSI-2 C-PHY
9162306a36Sopenharmony_ci      - 2 # MIPI CSI1
9262306a36Sopenharmony_ci      - 3 # CCP2
9362306a36Sopenharmony_ci      - 4 # MIPI CSI-2 D-PHY
9462306a36Sopenharmony_ci      - 5 # Parallel
9562306a36Sopenharmony_ci      - 6 # BT.656
9662306a36Sopenharmony_ci      - 7 # DPI
9762306a36Sopenharmony_ci    description:
9862306a36Sopenharmony_ci      Data bus type.
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci  bus-width:
10162306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
10262306a36Sopenharmony_ci    maximum: 64
10362306a36Sopenharmony_ci    description:
10462306a36Sopenharmony_ci      Number of data lines actively used, valid for the parallel busses.
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci  data-shift:
10762306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
10862306a36Sopenharmony_ci    maximum: 64
10962306a36Sopenharmony_ci    description:
11062306a36Sopenharmony_ci      On the parallel data busses, if bus-width is used to specify the number of
11162306a36Sopenharmony_ci      data lines, data-shift can be used to specify which data lines are used,
11262306a36Sopenharmony_ci      e.g. "bus-width=<8>; data-shift=<2>;" means, that lines 9:2 are used.
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci  hsync-active:
11562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
11662306a36Sopenharmony_ci    enum: [ 0, 1 ]
11762306a36Sopenharmony_ci    description:
11862306a36Sopenharmony_ci      Active state of the HSYNC signal, 0/1 for LOW/HIGH respectively.
11962306a36Sopenharmony_ci
12062306a36Sopenharmony_ci  vsync-active:
12162306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
12262306a36Sopenharmony_ci    enum: [ 0, 1 ]
12362306a36Sopenharmony_ci    description:
12462306a36Sopenharmony_ci      Active state of the VSYNC signal, 0/1 for LOW/HIGH respectively. Note,
12562306a36Sopenharmony_ci      that if HSYNC and VSYNC polarities are not specified, embedded
12662306a36Sopenharmony_ci      synchronization may be required, where supported.
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci  data-active:
12962306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
13062306a36Sopenharmony_ci    enum: [ 0, 1 ]
13162306a36Sopenharmony_ci    description:
13262306a36Sopenharmony_ci      Similar to HSYNC and VSYNC, specifies data line polarity.
13362306a36Sopenharmony_ci
13462306a36Sopenharmony_ci  data-enable-active:
13562306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
13662306a36Sopenharmony_ci    enum: [ 0, 1 ]
13762306a36Sopenharmony_ci    description:
13862306a36Sopenharmony_ci      Similar to HSYNC and VSYNC, specifies the data enable signal polarity.
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci  field-even-active:
14162306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
14262306a36Sopenharmony_ci    enum: [ 0, 1 ]
14362306a36Sopenharmony_ci    description:
14462306a36Sopenharmony_ci      Field signal level during the even field data transmission.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci  pclk-sample:
14762306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
14862306a36Sopenharmony_ci    enum: [ 0, 1, 2 ]
14962306a36Sopenharmony_ci    description:
15062306a36Sopenharmony_ci      Sample data on falling (0), rising (1) or both (2) edges of the pixel
15162306a36Sopenharmony_ci      clock signal.
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ci  sync-on-green-active:
15462306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
15562306a36Sopenharmony_ci    enum: [ 0, 1 ]
15662306a36Sopenharmony_ci    description:
15762306a36Sopenharmony_ci      Active state of Sync-on-green (SoG) signal, 0/1 for LOW/HIGH respectively.
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci  data-lanes:
16062306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32-array
16162306a36Sopenharmony_ci    minItems: 1
16262306a36Sopenharmony_ci    maxItems: 8
16362306a36Sopenharmony_ci    items:
16462306a36Sopenharmony_ci      # Assume up to 9 physical lane indices
16562306a36Sopenharmony_ci      maximum: 8
16662306a36Sopenharmony_ci    description:
16762306a36Sopenharmony_ci      An array of physical data lane indexes. Position of an entry determines
16862306a36Sopenharmony_ci      the logical lane number, while the value of an entry indicates physical
16962306a36Sopenharmony_ci      lane, e.g. for 2-lane MIPI CSI-2 bus we could have "data-lanes = <1 2>;",
17062306a36Sopenharmony_ci      assuming the clock lane is on hardware lane 0. If the hardware does not
17162306a36Sopenharmony_ci      support lane reordering, monotonically incremented values shall be used
17262306a36Sopenharmony_ci      from 0 or 1 onwards, depending on whether or not there is also a clock
17362306a36Sopenharmony_ci      lane. This property is valid for serial busses only (e.g. MIPI CSI-2).
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci  clock-lanes:
17662306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
17762306a36Sopenharmony_ci    # Assume up to 9 physical lane indices
17862306a36Sopenharmony_ci    maximum: 8
17962306a36Sopenharmony_ci    description:
18062306a36Sopenharmony_ci      Physical clock lane index. Position of an entry determines the logical
18162306a36Sopenharmony_ci      lane number, while the value of an entry indicates physical lane, e.g. for
18262306a36Sopenharmony_ci      a MIPI CSI-2 bus we could have "clock-lanes = <0>;", which places the
18362306a36Sopenharmony_ci      clock lane on hardware lane 0. This property is valid for serial busses
18462306a36Sopenharmony_ci      only (e.g. MIPI CSI-2).
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci  clock-noncontinuous:
18762306a36Sopenharmony_ci    type: boolean
18862306a36Sopenharmony_ci    description:
18962306a36Sopenharmony_ci      Allow MIPI CSI-2 non-continuous clock mode.
19062306a36Sopenharmony_ci
19162306a36Sopenharmony_ci  link-frequencies:
19262306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint64-array
19362306a36Sopenharmony_ci    description:
19462306a36Sopenharmony_ci      Allowed data bus frequencies. For MIPI CSI-2, for instance, this is the
19562306a36Sopenharmony_ci      actual frequency of the bus, not bits per clock per lane value. An array
19662306a36Sopenharmony_ci      of 64-bit unsigned integers.
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci  lane-polarities:
19962306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32-array
20062306a36Sopenharmony_ci    minItems: 1
20162306a36Sopenharmony_ci    maxItems: 9
20262306a36Sopenharmony_ci    items:
20362306a36Sopenharmony_ci      enum: [ 0, 1 ]
20462306a36Sopenharmony_ci    description:
20562306a36Sopenharmony_ci      An array of polarities of the lanes starting from the clock lane and
20662306a36Sopenharmony_ci      followed by the data lanes in the same order as in data-lanes. Valid
20762306a36Sopenharmony_ci      values are 0 (normal) and 1 (inverted). The length of the array should be
20862306a36Sopenharmony_ci      the combined length of data-lanes and clock-lanes properties. If the
20962306a36Sopenharmony_ci      lane-polarities property is omitted, the value must be interpreted as 0
21062306a36Sopenharmony_ci      (normal). This property is valid for serial busses only.
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci  strobe:
21362306a36Sopenharmony_ci    $ref: /schemas/types.yaml#/definitions/uint32
21462306a36Sopenharmony_ci    enum: [ 0, 1 ]
21562306a36Sopenharmony_ci    description:
21662306a36Sopenharmony_ci      Whether the clock signal is used as clock (0) or strobe (1). Used with
21762306a36Sopenharmony_ci      CCP2, for instance.
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ciadditionalProperties: true
220