# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/i2c/i2c-gpio-shared.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: mulitple GPIO bitbanged I2C busses with shared SCL

maintainers:
  - Markus Stockhausen <markus.stockhausen@gmx.de>

allOf:
  - $ref: /schemas/i2c/i2c-controller.yaml#

properties:
  compatible:
    items:
      - const: i2c-gpio-shared

  scl-gpios:
    description:
      gpio used for the shared scl signal, this should be flagged as
      active high using open drain with (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)
      from <dt-bindings/gpio/gpio.h> since the signal is by definition
      open drain.
    maxItems: 1

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

    i2c-gpio-shared {
      compatible = "i2c-gpio-shared";
      scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
      #address-cells = <1>;
      #size-cells = <0>;

      i2c0: i2c@0 {
        sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
        i2c-gpio,delay-us = <2>;
      };

      i2c1: i2c@1 {
        sda-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
        i2c-gpio,delay-us = <2>;
      };
    };

required:
  - compatible
  - scl-gpios