xref: /openbmc/phosphor-power/README.md (revision a6c695340dfe18136add37c9c00031359093a5e5)
1cde5b16cSGeorge Liu# phosphor-power
2cde5b16cSGeorge Liu
3928d1d9eSShawn McCarney## Overview
4d7b7c6aeSMatt Spinler
5928d1d9eSShawn McCarneyThis repository contains applications for configuring and monitoring devices
6928d1d9eSShawn McCarneythat deliver power to the system.
7928d1d9eSShawn McCarney
8dd6c3661SShawn McCarneyActively-maintained applications:
9dd6c3661SShawn McCarney
100dbce568SPatrick Williams- cold-redundancy: Application that makes power supplies work in Cold Redundancy
110dbce568SPatrick Williams  mode and rotates them at intervals.
12dd6c3661SShawn McCarney- [phosphor-power-sequencer](phosphor-power-sequencer/README.md): JSON-driven
13dd6c3661SShawn McCarney  application that powers the chassis on/off and monitors the power sequencer
14dd6c3661SShawn McCarney  device.
150dbce568SPatrick Williams- [phosphor-power-supply](phosphor-power-supply/README.md): Next generation
16928d1d9eSShawn McCarney  power supply monitoring application.
170dbce568SPatrick Williams- [phosphor-regulators](phosphor-regulators/README.md): JSON-driven application
18928d1d9eSShawn McCarney  that configures and monitors voltage regulators.
190dbce568SPatrick Williams- tools/power-utils: Power supply utilities.
20928d1d9eSShawn McCarney
21dd6c3661SShawn McCarneyLegacy applications:
22dd6c3661SShawn McCarney
23dd6c3661SShawn McCarney- power-sequencer: Original power sequencer monitoring application.
24dd6c3661SShawn McCarney- power-supply: Original power supply monitoring application.
25dd6c3661SShawn McCarney
26928d1d9eSShawn McCarney## Build
27928d1d9eSShawn McCarney
28928d1d9eSShawn McCarneyTo build all applications in this repository:
290dbce568SPatrick Williams
306151c286SGeorge Liu```sh
316b8aadb2SShawn McCarney  meson setup build
32928d1d9eSShawn McCarney  ninja -C build
33d7b7c6aeSMatt Spinler```
34aff6548eSLei YU
35928d1d9eSShawn McCarneyTo clean the repository and remove all build output:
360dbce568SPatrick Williams
376151c286SGeorge Liu```sh
38928d1d9eSShawn McCarney  rm -rf build
39928d1d9eSShawn McCarney```
40928d1d9eSShawn McCarney
413b3ae8d0SGeorge LiuYou can specify [meson options](meson.options) to customize the build process.
423b3ae8d0SGeorge LiuFor example, you can specify:
43928d1d9eSShawn McCarney
440dbce568SPatrick Williams- Which applications to build and install.
450dbce568SPatrick Williams- Application-specific configuration data, such as power sequencer type.
460dbce568SPatrick Williams- Whether to build tests.
47928d1d9eSShawn McCarney
48aff6548eSLei YU## Power Supply Monitor and Util JSON config
49aff6548eSLei YU
500dbce568SPatrick WilliamsSeveral applications in this repository require a PSU JSON config to run. The
510dbce568SPatrick WilliamsJSON config file provides information for:
520dbce568SPatrick Williams
530dbce568SPatrick Williams- Where to access the pmbus attributes
540dbce568SPatrick Williams- Which attribute file in pmbus maps to which property and interface in D-Bus
550dbce568SPatrick Williams- Which kernel device directory is used on which PSU
56aff6548eSLei YU
57aff6548eSLei YUThere is an example [psu.json](example/psu.json) to describe the necessary
58aff6548eSLei YUconfigurations.
59aff6548eSLei YU
600dbce568SPatrick Williams- `inventoryPMBusAccessType` defines the pmbus access type, which tells the
610dbce568SPatrick Williams  service which sysfs type to use to read the attributes. The possible values
620dbce568SPatrick Williams  are:
630dbce568SPatrick Williams  - Base: The base dir, e.g. `/sys/bus/i2c/devices/3-0069/`
640dbce568SPatrick Williams  - Hwmon: The hwmon dir, e.g. `/sys/bus/i2c/devices/3-0069/hwmon/hwmonX/`
650dbce568SPatrick Williams  - Debug: The pmbus debug dir, e.g. `/sys/kernel/debug/pmbus/hwmonX/`
660dbce568SPatrick Williams  - DeviceDebug: The device debug dir, e.g.
67*a6c69534SGeorge Liu    `/sys/kernel/debug/<driver>.<instance>/`
680dbce568SPatrick Williams  - HwmonDeviceDebug: The hwmon device debug dir, e.g.
690dbce568SPatrick Williams    `/sys/kernel/debug/pmbus/hwmonX/cffps1/`
700dbce568SPatrick Williams- `fruConfigs` defines the mapping between the attribute file and the FRU
710dbce568SPatrick Williams  inventory interface and property. The configuration example below indicates
720dbce568SPatrick Williams  that the service will read `part_number` attribute file from a directory
730dbce568SPatrick Williams  specified by the above pmbus access type, and assign to `PartNumber` property
740dbce568SPatrick Williams  in `xyz.openbmc_project.Inventory.Decorator.Asset` interface.
756151c286SGeorge Liu
766151c286SGeorge Liu  ```json
77aff6548eSLei YU    "fruConfigs": [
78aff6548eSLei YU      {
79aff6548eSLei YU        "propertyName": "PartNumber",
80aff6548eSLei YU        "fileName": "part_number",
81aff6548eSLei YU        "interface": "xyz.openbmc_project.Inventory.Decorator.Asset"
82aff6548eSLei YU      }
83aff6548eSLei YU    ]
84aff6548eSLei YU  ```
856151c286SGeorge Liu
860dbce568SPatrick Williams- `psuDevices` defines the kernel device dir for each PSU in inventory. The
870dbce568SPatrick Williams  configuration example below indicates that `powersupply0`'s device is located
880dbce568SPatrick Williams  in `/sys/bus/i2c/devices/3-0069`.
896151c286SGeorge Liu
906151c286SGeorge Liu  ```json
91aff6548eSLei YU    "psuDevices": {
92aff6548eSLei YU      "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0" : "/sys/bus/i2c/devices/3-0069",
93aff6548eSLei YU    }
94aff6548eSLei YU  ```
95