xref: /openbmc/phosphor-power/README.md (revision 6151c286)
1## Overview
2
3This repository contains applications for configuring and monitoring devices
4that deliver power to the system.
5
6Actively-maintained applications:
7
8- cold-redundancy: Application that makes power supplies work in Cold Redundancy
9  mode and rotates them at intervals.
10- [phosphor-power-sequencer](phosphor-power-sequencer/README.md): JSON-driven
11  application that powers the chassis on/off and monitors the power sequencer
12  device.
13- [phosphor-power-supply](phosphor-power-supply/README.md): Next generation
14  power supply monitoring application.
15- [phosphor-regulators](phosphor-regulators/README.md): JSON-driven application
16  that configures and monitors voltage regulators.
17- tools/power-utils: Power supply utilities.
18
19Legacy applications:
20
21- power-sequencer: Original power sequencer monitoring application.
22- power-supply: Original power supply monitoring application.
23
24## Build
25
26To build all applications in this repository:
27
28```sh
29  meson setup build
30  ninja -C build
31```
32
33To clean the repository and remove all build output:
34
35```sh
36  rm -rf build
37```
38
39You can specify [meson options](meson.options) to customize the build process.
40For example, you can specify:
41
42- Which applications to build and install.
43- Application-specific configuration data, such as power sequencer type.
44- Whether to build tests.
45
46## Power Supply Monitor and Util JSON config
47
48Several applications in this repository require a PSU JSON config to run. The
49JSON config file provides information for:
50
51- Where to access the pmbus attributes
52- Which attribute file in pmbus maps to which property and interface in D-Bus
53- Which kernel device directory is used on which PSU
54
55There is an example [psu.json](example/psu.json) to describe the necessary
56configurations.
57
58- `inventoryPMBusAccessType` defines the pmbus access type, which tells the
59  service which sysfs type to use to read the attributes. The possible values
60  are:
61  - Base: The base dir, e.g. `/sys/bus/i2c/devices/3-0069/`
62  - Hwmon: The hwmon dir, e.g. `/sys/bus/i2c/devices/3-0069/hwmon/hwmonX/`
63  - Debug: The pmbus debug dir, e.g. `/sys/kernel/debug/pmbus/hwmonX/`
64  - DeviceDebug: The device debug dir, e.g.
65    '/sys/kernel/debug/<driver>.<instance>/`
66  - HwmonDeviceDebug: The hwmon device debug dir, e.g.
67    `/sys/kernel/debug/pmbus/hwmonX/cffps1/`
68- `fruConfigs` defines the mapping between the attribute file and the FRU
69  inventory interface and property. The configuration example below indicates
70  that the service will read `part_number` attribute file from a directory
71  specified by the above pmbus access type, and assign to `PartNumber` property
72  in `xyz.openbmc_project.Inventory.Decorator.Asset` interface.
73
74  ```json
75    "fruConfigs": [
76      {
77        "propertyName": "PartNumber",
78        "fileName": "part_number",
79        "interface": "xyz.openbmc_project.Inventory.Decorator.Asset"
80      }
81    ]
82  ```
83
84- `psuDevices` defines the kernel device dir for each PSU in inventory. The
85  configuration example below indicates that `powersupply0`'s device is located
86  in `/sys/bus/i2c/devices/3-0069`.
87
88  ```json
89    "psuDevices": {
90      "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0069",
91    }
92  ```
93