xref: /openbmc/skeleton/libopenbmc_intf/GPIOS.md (revision 75fe8cc4)
1# GPIO JSON format
2
3GPIO definitions are stored in '/etc/default/obmc/gpio/gpio_defs.json' on the
4BMC.  That file has 2 sections - 'gpio_configs' and 'gpio_definitions'.
5
6## gpio_configs
7
8This section contains the GPIOs used in power control.
9
10It looks like:
11```
12"gpio_configs": {
13    "power_config": {
14
15        #See code in op-pwrctl for details
16
17        #Required
18        "power_good_in": "...",
19
20        #Required
21        "power_up_outs": [
22            {"name": "...", "polarity": true/false},
23            {"name": "...", "polarity": true/false}
24        ],
25
26        #Optional
27        "reset_outs": [
28            {"name": "...", "polarity": true/false}
29        ],
30
31        #Optional
32        "latch_out": "...",
33
34        #Optional
35        "pci_reset_outs": [
36            {"name": "...", "polarity": true/false, "hold": true/false}
37        ]
38    }
39}
40```
41
42## gpio_definitions
43
44This section contains The GPIO pins and directions.
45
46It looks like:
47```
48    "gpio_definitions": [
49        {
50
51            #The name to look up this entry.
52            "name": "SOFTWARE_PGOOD",
53
54            #The GPIO pin.
55            "pin": "R1",
56
57            #Alternatively to the pin, can use 'num' which is the
58            #raw number the GPIO would be accessed with.
59            "num": 7,
60
61            #The GPIO direction - in, out, rising, falling, or both
62            "direction": "out"
63        },
64        {
65            ...
66        }
67    ]
68```
69
70