xref: /openbmc/phosphor-power/phosphor-regulators/docs/config_file/phase_fault_detection.md (revision 6151c286a8737f22e5297ff556f7304bd548ed0a)
1# phase_fault_detection
2
3## Description
4
5Specifies how to detect and log redundant phase faults in a voltage regulator.
6
7A voltage regulator is sometimes called a "phase controller" because it controls
8one or more phases that perform the actual voltage regulation.
9
10A regulator may have redundant phases. If a redundant phase fails, the regulator
11will continue to provide the desired output voltage. However, a phase fault
12error should be logged warning the user that the regulator has lost redundancy.
13
14The technique used to detect a phase fault varies depending on the regulator
15hardware. Often a bit is checked in a status register. The status register could
16exist in the regulator or in a related I/O expander.
17
18Phase fault detection is performed every 15 seconds. A phase fault must be
19detected two consecutive times (15 seconds apart) before an error is logged.
20This provides "de-glitching" to ignore transient hardware problems.
21
22Phase faults are detected and logged by executing actions:
23
24- Use the [if](if.md) action to implement the high level behavior "if a fault is
25  detected, then log an error".
26- Detecting the fault
27  - Use a comparison action like [i2c_compare_bit](i2c_compare_bit.md) to detect
28    the fault. For example, you may need to check a bit in a status register.
29- Logging the error
30  - Use the [i2c_capture_bytes](i2c_capture_bytes.md) action to capture
31    additional data about the fault if necessary.
32  - Use the [log_phase_fault](log_phase_fault.md) action to log a phase fault
33    error. The error log will include any data previously captured using
34    i2c_capture_bytes.
35
36The actions can be specified in two ways:
37
38- Use the "rule_id" property to specify a standard rule to run.
39- Use the "actions" property to specify an array of actions that are unique to
40  this regulator.
41
42The default device for the actions is the voltage regulator. You can specify a
43different device using the "device_id" property. If you need to access multiple
44devices, use the [set_device](set_device.md) action.
45
46## Properties
47
48| Name      |      Required       | Type                          | Description                                                                                                    |
49| :-------- | :-----------------: | :---------------------------- | :------------------------------------------------------------------------------------------------------------- |
50| comments  |         no          | array of strings              | One or more comment lines describing the phase fault detection.                                                |
51| device_id |         no          | string                        | Unique ID of the [device](device.md) to access. If not specified, the default device is the voltage regulator. |
52| rule_id   | see [notes](#notes) | string                        | Unique ID of the [rule](rule.md) to execute.                                                                   |
53| actions   | see [notes](#notes) | array of [actions](action.md) | One or more actions to execute.                                                                                |
54
55### Notes
56
57- You must specify either "rule_id" or "actions".
58
59## Examples
60
61```json
62{
63  "comments": ["Detect phase fault using I/O expander"],
64  "device_id": "io_expander",
65  "rule_id": "detect_phase_fault_rule"
66}
67```
68
69```json
70{
71  "comments": [
72    "Detect N phase fault using I/O expander.",
73    "A fault occurred if bit 3 is ON in register 0x02.",
74    "Capture value of registers 0x02 and 0x04 in error log."
75  ],
76  "device_id": "io_expander",
77  "actions": [
78    {
79      "if": {
80        "condition": {
81          "i2c_compare_bit": { "register": "0x02", "position": 3, "value": 1 }
82        },
83        "then": [
84          { "i2c_capture_bytes": { "register": "0x02", "count": 1 } },
85          { "i2c_capture_bytes": { "register": "0x04", "count": 1 } },
86          { "log_phase_fault": { "type": "n" } }
87        ]
88      }
89    }
90  ]
91}
92```
93