xref: /openbmc/skeleton/libopenbmc_intf/GPIOS.md (revision b468fdeb)
124cbe78dSMatt Spinler# GPIO JSON format
224cbe78dSMatt Spinler
324cbe78dSMatt SpinlerGPIO definitions are stored in '/etc/default/obmc/gpio/gpio_defs.json' on the
424cbe78dSMatt SpinlerBMC. That file has 2 sections - 'gpio_configs' and 'gpio_definitions'.
524cbe78dSMatt Spinler
624cbe78dSMatt Spinler## gpio_configs
724cbe78dSMatt Spinler
824cbe78dSMatt SpinlerThis section contains the GPIOs used in power control.
924cbe78dSMatt Spinler
1024cbe78dSMatt SpinlerIt looks like:
11*b468fdebSPatrick Williams
1224cbe78dSMatt Spinler```
1324cbe78dSMatt Spinler"gpio_configs": {
1424cbe78dSMatt Spinler    "power_config": {
1524cbe78dSMatt Spinler
1624cbe78dSMatt Spinler        #See code in op-pwrctl for details
1724cbe78dSMatt Spinler
1824cbe78dSMatt Spinler        #Required
1924cbe78dSMatt Spinler        "power_good_in": "...",
2024cbe78dSMatt Spinler
2124cbe78dSMatt Spinler        #Required
2224cbe78dSMatt Spinler        "power_up_outs": [
2324cbe78dSMatt Spinler            {"name": "...", "polarity": true/false},
2424cbe78dSMatt Spinler            {"name": "...", "polarity": true/false}
2524cbe78dSMatt Spinler        ],
2624cbe78dSMatt Spinler
2724cbe78dSMatt Spinler        #Optional
2824cbe78dSMatt Spinler        "reset_outs": [
2924cbe78dSMatt Spinler            {"name": "...", "polarity": true/false}
3024cbe78dSMatt Spinler        ],
3124cbe78dSMatt Spinler
3224cbe78dSMatt Spinler        #Optional
3324cbe78dSMatt Spinler        "latch_out": "...",
3424cbe78dSMatt Spinler
3524cbe78dSMatt Spinler        #Optional
3624cbe78dSMatt Spinler        "pci_reset_outs": [
3724cbe78dSMatt Spinler            {"name": "...", "polarity": true/false, "hold": true/false}
3824cbe78dSMatt Spinler        ]
3924cbe78dSMatt Spinler    }
4024cbe78dSMatt Spinler}
4124cbe78dSMatt Spinler```
4224cbe78dSMatt Spinler
4324cbe78dSMatt Spinler## gpio_definitions
4424cbe78dSMatt Spinler
4524cbe78dSMatt SpinlerThis section contains The GPIO pins and directions.
4624cbe78dSMatt Spinler
4724cbe78dSMatt SpinlerIt looks like:
48*b468fdebSPatrick Williams
4924cbe78dSMatt Spinler```
5024cbe78dSMatt Spinler    "gpio_definitions": [
5124cbe78dSMatt Spinler        {
5224cbe78dSMatt Spinler
5324cbe78dSMatt Spinler            #The name to look up this entry.
5424cbe78dSMatt Spinler            "name": "SOFTWARE_PGOOD",
5524cbe78dSMatt Spinler
5624cbe78dSMatt Spinler            #The GPIO pin.
5724cbe78dSMatt Spinler            "pin": "R1",
5824cbe78dSMatt Spinler
5924cbe78dSMatt Spinler            #Alternatively to the pin, can use 'num' which is the
6024cbe78dSMatt Spinler            #raw number the GPIO would be accessed with.
6124cbe78dSMatt Spinler            "num": 7,
6224cbe78dSMatt Spinler
6324cbe78dSMatt Spinler            #The GPIO direction - in, out, rising, falling, or both
6424cbe78dSMatt Spinler            "direction": "out"
6524cbe78dSMatt Spinler        },
6624cbe78dSMatt Spinler        {
6724cbe78dSMatt Spinler            ...
6824cbe78dSMatt Spinler        }
6924cbe78dSMatt Spinler    ]
7024cbe78dSMatt Spinler```
71