xref: /openbmc/skeleton/libopenbmc_intf/GPIOS.md (revision fc80b70ef73b6324cfb534f42771f73c7490cd38)
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:
11b468fdebSPatrick Williams
12*fc80b70eSGeorge Liu```json
13*fc80b70eSGeorge Liu{
1424cbe78dSMatt Spinler    "gpio_configs": {
1524cbe78dSMatt Spinler        "power_config": {
1624cbe78dSMatt Spinler
1724cbe78dSMatt Spinler            #See code in op-pwrctl for details
1824cbe78dSMatt Spinler
1924cbe78dSMatt Spinler            #Required
2024cbe78dSMatt Spinler            "power_good_in": "...",
2124cbe78dSMatt Spinler
2224cbe78dSMatt Spinler            #Required
2324cbe78dSMatt Spinler            "power_up_outs": [
2424cbe78dSMatt Spinler                {"name": "...", "polarity": true/false},
2524cbe78dSMatt Spinler                {"name": "...", "polarity": true/false}
2624cbe78dSMatt Spinler            ],
2724cbe78dSMatt Spinler
2824cbe78dSMatt Spinler            #Optional
2924cbe78dSMatt Spinler            "reset_outs": [
3024cbe78dSMatt Spinler                {"name": "...", "polarity": true/false}
3124cbe78dSMatt Spinler            ],
3224cbe78dSMatt Spinler
3324cbe78dSMatt Spinler            #Optional
3424cbe78dSMatt Spinler            "latch_out": "...",
3524cbe78dSMatt Spinler
3624cbe78dSMatt Spinler            #Optional
3724cbe78dSMatt Spinler            "pci_reset_outs": [
3824cbe78dSMatt Spinler                {"name": "...", "polarity": true/false, "hold": true/false}
3924cbe78dSMatt Spinler            ]
4024cbe78dSMatt Spinler        }
4124cbe78dSMatt Spinler    }
42*fc80b70eSGeorge Liu}
4324cbe78dSMatt Spinler```
4424cbe78dSMatt Spinler
4524cbe78dSMatt Spinler## gpio_definitions
4624cbe78dSMatt Spinler
4724cbe78dSMatt SpinlerThis section contains The GPIO pins and directions.
4824cbe78dSMatt Spinler
4924cbe78dSMatt SpinlerIt looks like:
50b468fdebSPatrick Williams
51*fc80b70eSGeorge Liu```json
52*fc80b70eSGeorge Liu{
5324cbe78dSMatt Spinler"gpio_definitions": [
5424cbe78dSMatt Spinler        {
5524cbe78dSMatt Spinler
5624cbe78dSMatt Spinler            #The name to look up this entry.
5724cbe78dSMatt Spinler            "name": "SOFTWARE_PGOOD",
5824cbe78dSMatt Spinler
5924cbe78dSMatt Spinler            #The GPIO pin.
6024cbe78dSMatt Spinler            "pin": "R1",
6124cbe78dSMatt Spinler
6224cbe78dSMatt Spinler            #Alternatively to the pin, can use 'num' which is the
6324cbe78dSMatt Spinler            #raw number the GPIO would be accessed with.
6424cbe78dSMatt Spinler            "num": 7,
6524cbe78dSMatt Spinler
6624cbe78dSMatt Spinler            #The GPIO direction - in, out, rising, falling, or both
6724cbe78dSMatt Spinler            "direction": "out"
6824cbe78dSMatt Spinler        },
6924cbe78dSMatt Spinler        {
7024cbe78dSMatt Spinler            ...
7124cbe78dSMatt Spinler        }
7224cbe78dSMatt Spinler    ]
73*fc80b70eSGeorge Liu}
7424cbe78dSMatt Spinler```
75