xref: /openbmc/skeleton/libopenbmc_intf/GPIOS.md (revision fc80b70e)
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```json
13{
14    "gpio_configs": {
15        "power_config": {
16
17            #See code in op-pwrctl for details
18
19            #Required
20            "power_good_in": "...",
21
22            #Required
23            "power_up_outs": [
24                {"name": "...", "polarity": true/false},
25                {"name": "...", "polarity": true/false}
26            ],
27
28            #Optional
29            "reset_outs": [
30                {"name": "...", "polarity": true/false}
31            ],
32
33            #Optional
34            "latch_out": "...",
35
36            #Optional
37            "pci_reset_outs": [
38                {"name": "...", "polarity": true/false, "hold": true/false}
39            ]
40        }
41    }
42}
43```
44
45## gpio_definitions
46
47This section contains The GPIO pins and directions.
48
49It looks like:
50
51```json
52{
53"gpio_definitions": [
54        {
55
56            #The name to look up this entry.
57            "name": "SOFTWARE_PGOOD",
58
59            #The GPIO pin.
60            "pin": "R1",
61
62            #Alternatively to the pin, can use 'num' which is the
63            #raw number the GPIO would be accessed with.
64            "num": 7,
65
66            #The GPIO direction - in, out, rising, falling, or both
67            "direction": "out"
68        },
69        {
70            ...
71        }
72    ]
73}
74```
75