The phosphor-regulators
application is controlled by a configuration file (config file). The config file defines how to perform the following operations on voltage regulators in the system:
The config file does not control how voltage regulators are enabled or how to monitor their Power Good (pgood) status. Those operations are typically performed by power sequencer hardware and related firmware.
The config file is written using the JSON (JavaScript Object Notation) data format.
The config file can be created using any text editor, such as Atom, Notepad++, gedit, Vim, or Emacs. You can select any file name, but it must end with the ".json" suffix, such as regulators.json
.
See config_file.json.
The config file typically contains the following structure:
Rules provide common, reusable sequences of actions that can be shared by one or more regulators. They are optional and can be omitted if each regulator requires a unique sequence of actions.
The config file contains a single JSON config_file object at the root level. That object contains arrays of other JSON objects.
The following JSON object types are supported:
The JSON data format does not support comments. However, many of the JSON objects in the config file provide an optional "comments" property. The value of this property is an array of strings. Use this property to annotate the config file. The "comments" properties are ignored when the config file is read by the phosphor-regulators
application.
Examples:
"comments": [ "IR35221 regulator producing the Vdd rail" ] "comments": [ "Check if register 0x82 contains 0x7302", "Device returns bytes in little-endian order", "Ignore most significant bit in each byte" ]
The JSON number data type does not support the hexadecimal format. For this reason, properties with hexadecimal values use the string data type.
Example:
"address": "0x70"
After creating or modifying a config file, you need to validate it using the tool validate-regulators-config.py.
The validation tool checks the config file for errors, such as:
The tool requires two input files:
The tool has the following command line syntax:
validate-regulators-config.py -c <config file> -s config_schema.json
where <config file>
is the name of the config file to validate.
/usr/share/phosphor-regulators
The standard version of the config file is installed in this read-only directory as part of the firmware image install. This is the config file that will normally be used.
/etc/phosphor-regulators
A new version of the config file can be tested by copying it into this writable directory. This avoids the need to build and install a new firmware image on the BMC.
The phosphor-regulators
application will search the installation directories in the following order to find a config file:
The config file is loaded when the phosphor-regulators
application starts.
To force the application to reload the config file, use the following command on the BMC:
systemctl kill -s HUP phosphor-regulators.service
To confirm which config file was loaded, use the following command on the BMC:
journalctl -u phosphor-regulators.service | grep Loading
After creating or modifying a config file, you should test it to ensure it provides the desired behavior.
Perform the following steps to test the config file:
phosphor-regulators
application to reload its config file, causing it to find and load the file in the test directory.When finished testing, perform the following steps to revert to the standard config file:
phosphor-regulators
application to reload its config file, causing it to find and load the file in the standard directory.