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