# Copyright (c) 2021 Nuvoton Technology Corporation.
# SPDX-License-Identifier: Apache-2.0

description: |
    Nuvoton NCT38XX series I2C-based GPIO expander

    This must be a child of the NCT38xx multi-function device.

    Example:
      &i2c0_0 {
        nct3807@70 {
          compatible = "nuvoton,nct38xx";
          reg = <0x70>;

          nct3807-gpio {
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "nuvoton,nct38xx-gpio";

            gpio@0 {
              compatible = "nuvoton,nct38xx-gpio-port";
              reg = <0x0>;
              gpio-controller;
              #gpio-cells = <2>;
              ngpios = <8>;
              pin_mask = <0xff>;
              pinmux_mask = <0xf7>;
            };

            gpio@1 {
              compatible = "nuvoton,nct38xx-gpio-port";
              reg = <0x1>;
              gpio-controller;
              #gpio-cells = <2>;
              ngpios = <8>;
              pin_mask = <0xff>;
            };
          };
        };

        nct3808_0_P1@71 {
          compatible = "nuvoton,nct38xx";
          reg = <0x71>;

          nct3808-0-p1-gpio {
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "nuvoton,nct38xx-gpio";

            gpio@0 {
              compatible = "nuvoton,nct38xx-gpio-port";
              reg = <0x0>;
              gpio-controller;
              #gpio-cells = <2>;
              ngpios = <8>;
              pin_mask = <0xdc>;
              pinmux_mask = <0xff>;
            };
          };
        };

        nct3808_0_P2@75 {
          compatible = "nuvoton,nct38xx";
          reg = <0x75>;

          nct3808-0-P2-gpio {
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "nuvoton,nct38xx-gpio";

            gpio@0 {
              compatible = "nuvoton,nct38xx-gpio-port";
              reg = <0x0>;
              gpio-controller;
              #gpio-cells = <2>;
              ngpios = <8>;
              pin_mask = <0xdc>;
              pinmux_mask = <0xff>;
            };
          };
        };
      };

compatible: "nuvoton,nct38xx-gpio"

include: [base.yaml]
