xref: /openbmc/phosphor-power/README.md (revision dc8e9312)
1Code for detecting and analyzing power faults on Witherspoon.
2
3## To Build
4```
5To build this package, do the following steps:
6
7    1. meson build
8    2. ninja -C build
9
10To clean the repository again run `rm -rf build`.
11```
12
13## Power Supply Monitor and Util JSON config
14
15Several applications in this repository require a PSU JSON config to run.
16The JSON config file provides information for:
17* Where to access the pmbus attributes
18* Which attribute file in pmbus maps to which property and interface in D-Bus
19* Which kernel device directory is used on which PSU
20
21There is an example [psu.json](example/psu.json) to describe the necessary
22configurations.
23
24* `inventoryPMBusAccessType` defines the pmbus access type, which tells the
25   service which sysfs type to use to read the attributes.
26   The possible values are:
27   * Base: The base dir, e.g. `/sys/bus/i2c/devices/3-0069/`
28   * Hwmon: The hwmon dir, e.g. `/sys/bus/i2c/devices/3-0069/hwmon/hwmonX/`
29   * Debug: The pmbus debug dir, e.g. `/sys/kernel/debug/pmbus/hwmonX/`
30   * DeviceDebug: The device debug dir, e.g. '/sys/kernel/debug/<driver>.<instance>/`
31   * HwmonDeviceDebug: The hwmon device debug dir, e.g. `/sys/kernel/debug/pmbus/hwmonX/cffps1/`
32* `fruConfigs` defines the mapping between the attribute file and the FRU
33   inventory interface and property.
34   The configuration example below indicates that the service will read
35   `part_number` attribute file from a directory specified by the above pmbus
36   access type, and assign to `PartNumber` property in
37   `xyz.openbmc_project.Inventory.Decorator.Asset` interface.
38   ```
39     "fruConfigs": [
40       {
41         "propertyName": "PartNumber",
42         "fileName": "part_number",
43         "interface": "xyz.openbmc_project.Inventory.Decorator.Asset"
44       }
45     ]
46   ```
47* `psuDevices` defines the kernel device dir for each PSU in inventory.
48   The configuration example below indicates that `powersupply0`'s device is
49   located in `/sys/bus/i2c/devices/3-0069`.
50   ```
51     "psuDevices": {
52       "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0069",
53     }
54   ```
55