psusensor: Add support for the 'PowerState' parameter

When CPU is powered off, some sensor reading values are expected
to go below low thresholds. To prevent unnecessary sensor readings
and redundant threshold event trigger in cases like that add support
for the 'PowerState' JSON configuration parameter similar to other
'dbus-sensors' apps.
Use 'checkThresholdsPowerDelay' function in a threshold check like
it is done in ADCSensor app. This is necessary as PSU data can drop
faster than a change in a power state is noticed.

Tested on the AMD EthanolX CRB with ISL68137:

When the PowerState is set to "On" and the platform is powered off,
no transactions are observed on the corresponding I2C bus.

When the PowerState is set to "Always" monitoring is always enabled
and I2C transactions are always observed regardless the platform
power state.

These commands were used to monitor transactions
on the I2C bus:
$ echo 1 > /sys/kernel/debug/tracing/tracing_on
$ echo 1 > /sys/kernel/debug/tracing/events/i2c/i2c_read/enable
$ cat /sys/kernel/debug/tracing/trace_pipe

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: Ic7b36e48828adf4eb2f7714965a4a1df4eb5ac3e
7 files changed
tree: 24e7ca2797fc3e459ecee95b94ea7cc478c567e7
  1. include/
  2. service_files/
  3. src/
  4. subprojects/
  5. tests/
  6. .clang-format
  7. .clang-ignore
  8. .clang-tidy
  9. .gitignore
  10. Jenkinsfile
  11. LICENSE
  12. MAINTAINERS
  13. meson.build
  14. meson_options.txt
  15. OWNERS
  16. README.md
README.md

dbus-sensors

dbus-sensors is a collection of sensor applications that provide the xyz.openbmc_project.Sensor collection of interfaces. They read sensor values from hwmon, d-bus, or direct driver access to provide readings. Some advance non-sensor features such as fan presence, pwm control, and automatic cpu detection (x86) are also supported.

key features

  • runtime re-configurable from d-bus (entity-manager or the like)

  • isolated: each sensor type is isolated into its own daemon, so a bug in one sensor is unlikely to affect another, and single sensor modifications are possible

  • async single-threaded: uses sdbusplus/asio bindings

  • multiple data inputs: hwmon, d-bus, direct driver access

sensor documentation