xref: /openbmc/phosphor-power/README.md (revision 0dbce568)
1928d1d9eSShawn McCarney## Overview
2d7b7c6aeSMatt Spinler
3928d1d9eSShawn McCarneyThis repository contains applications for configuring and monitoring devices
4928d1d9eSShawn McCarneythat deliver power to the system.
5928d1d9eSShawn McCarney
6*0dbce568SPatrick Williams- cold-redundancy: Application that makes power supplies work in Cold Redundancy
7*0dbce568SPatrick Williams  mode and rotates them at intervals.
8*0dbce568SPatrick Williams- [phosphor-power-sequencer](phosphor-power-sequencer/README.md): Applications
91553cd9aSJim Wright  for configuring and monitoring power sequencer and related devices that
101553cd9aSJim Wright  support JSON-driven configuration.
11*0dbce568SPatrick Williams- [phosphor-power-supply](phosphor-power-supply/README.md): Next generation
12928d1d9eSShawn McCarney  power supply monitoring application.
13*0dbce568SPatrick Williams- [phosphor-regulators](phosphor-regulators/README.md): JSON-driven application
14928d1d9eSShawn McCarney  that configures and monitors voltage regulators.
15*0dbce568SPatrick Williams- power-sequencer: A power sequencer monitoring application.
16*0dbce568SPatrick Williams- power-supply: Original power supply monitoring application.
17*0dbce568SPatrick Williams- tools/power-utils: Power supply utilities.
18928d1d9eSShawn McCarney
19928d1d9eSShawn McCarney## Build
20928d1d9eSShawn McCarney
21928d1d9eSShawn McCarneyTo build all applications in this repository:
22*0dbce568SPatrick Williams
23d7b7c6aeSMatt Spinler```
24928d1d9eSShawn McCarney  meson build
25928d1d9eSShawn McCarney  ninja -C build
26d7b7c6aeSMatt Spinler```
27aff6548eSLei YU
28928d1d9eSShawn McCarneyTo clean the repository and remove all build output:
29*0dbce568SPatrick Williams
30928d1d9eSShawn McCarney```
31928d1d9eSShawn McCarney  rm -rf build
32928d1d9eSShawn McCarney```
33928d1d9eSShawn McCarney
34928d1d9eSShawn McCarneyYou can specify [meson options](meson_options.txt) to customize the build
35928d1d9eSShawn McCarneyprocess. For example, you can specify:
36928d1d9eSShawn McCarney
37*0dbce568SPatrick Williams- Which applications to build and install.
38*0dbce568SPatrick Williams- Application-specific configuration data, such as power sequencer type.
39*0dbce568SPatrick Williams- Whether to build tests.
40928d1d9eSShawn McCarney
41aff6548eSLei YU## Power Supply Monitor and Util JSON config
42aff6548eSLei YU
43*0dbce568SPatrick WilliamsSeveral applications in this repository require a PSU JSON config to run. The
44*0dbce568SPatrick WilliamsJSON config file provides information for:
45*0dbce568SPatrick Williams
46*0dbce568SPatrick Williams- Where to access the pmbus attributes
47*0dbce568SPatrick Williams- Which attribute file in pmbus maps to which property and interface in D-Bus
48*0dbce568SPatrick Williams- Which kernel device directory is used on which PSU
49aff6548eSLei YU
50aff6548eSLei YUThere is an example [psu.json](example/psu.json) to describe the necessary
51aff6548eSLei YUconfigurations.
52aff6548eSLei YU
53*0dbce568SPatrick Williams- `inventoryPMBusAccessType` defines the pmbus access type, which tells the
54*0dbce568SPatrick Williams  service which sysfs type to use to read the attributes. The possible values
55*0dbce568SPatrick Williams  are:
56*0dbce568SPatrick Williams  - Base: The base dir, e.g. `/sys/bus/i2c/devices/3-0069/`
57*0dbce568SPatrick Williams  - Hwmon: The hwmon dir, e.g. `/sys/bus/i2c/devices/3-0069/hwmon/hwmonX/`
58*0dbce568SPatrick Williams  - Debug: The pmbus debug dir, e.g. `/sys/kernel/debug/pmbus/hwmonX/`
59*0dbce568SPatrick Williams  - DeviceDebug: The device debug dir, e.g.
60*0dbce568SPatrick Williams    '/sys/kernel/debug/<driver>.<instance>/`
61*0dbce568SPatrick Williams  - HwmonDeviceDebug: The hwmon device debug dir, e.g.
62*0dbce568SPatrick Williams    `/sys/kernel/debug/pmbus/hwmonX/cffps1/`
63*0dbce568SPatrick Williams- `fruConfigs` defines the mapping between the attribute file and the FRU
64*0dbce568SPatrick Williams  inventory interface and property. The configuration example below indicates
65*0dbce568SPatrick Williams  that the service will read `part_number` attribute file from a directory
66*0dbce568SPatrick Williams  specified by the above pmbus access type, and assign to `PartNumber` property
67*0dbce568SPatrick Williams  in `xyz.openbmc_project.Inventory.Decorator.Asset` interface.
68aff6548eSLei YU  ```
69aff6548eSLei YU    "fruConfigs": [
70aff6548eSLei YU      {
71aff6548eSLei YU        "propertyName": "PartNumber",
72aff6548eSLei YU        "fileName": "part_number",
73aff6548eSLei YU        "interface": "xyz.openbmc_project.Inventory.Decorator.Asset"
74aff6548eSLei YU      }
75aff6548eSLei YU    ]
76aff6548eSLei YU  ```
77*0dbce568SPatrick Williams- `psuDevices` defines the kernel device dir for each PSU in inventory. The
78*0dbce568SPatrick Williams  configuration example below indicates that `powersupply0`'s device is located
79*0dbce568SPatrick Williams  in `/sys/bus/i2c/devices/3-0069`.
80aff6548eSLei YU  ```
81aff6548eSLei YU    "psuDevices": {
82aff6548eSLei YU      "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0069",
83aff6548eSLei YU    }
84aff6548eSLei YU  ```
85