Correct ADC sensors max reading

Set ADC max reading to be reference voltage 1.8Volt.
Calculate maxReading from it. This fixes threshold hysteresis.

Tested:
Use sensor override to trigger alarm and verify that
de-assert happens when sensor reading back to normal.
Without the change, the de-assert never happens.
Example:
    busctl set-property xyz.openbmc_project.ADCSensor /xyz/openbmc_project/sensors/voltage/ABC_CPU1 xyz.openbmc_project.Sensor.Value Value d 1.348
    intel-obmc adcsensor[412]: Sensor ABC_CPU1 high threshold 1.301 assert: value 1.348 raw data 1244
    intel-obmc adcsensor[412]: Sensor ABC_CPU1 high threshold 1.263 assert: value 1.348 raw data 1244
    intel-obmc ipmid[242]: thresholdChanged: Assert
    intel-obmc ipmid[242]: thresholdChanged: Assert
    intel-obmc sel-logger[288]: ABC_CPU1 sensor crossed a critical high threshold going high. Reading=1.348000 Threshold=1.301000.
    intel-obmc sel-logger[288]: ABC_CPU1 sensor crossed a warning high threshold going high. Reading=1.348000 Threshold=1.263000.
    intel-obmc ipmid[242]: thresholdChanged: deassert
    intel-obmc ipmid[242]: thresholdChanged: deassert
    intel-obmc sel-logger[288]: ABC_CPU1 sensor crossed a critical high threshold going low. Reading=1.244000 Threshold=1.301000.
    intel-obmc sel-logger[288]: ABC_CPU1 sensor crossed a warning high threshold going low. Reading=1.244000 Threshold=1.263000.

Also ran "ipmitool sensor list" and varified ADCSensor values are correct
    A P12V PSU SCALE | 12.096     | Volts      | ok    | na        | 10.647    | 10.962    | 13.104    | 13.482    | na
    P1V8 PCH         | 1.805      | Volts      | ok    | na        | 1.645     | 1.701     | 1.908     | 1.965     | na
    P3V3             | 3.320      | Volts      | ok    | na        | 2.976     | 3.062     | 3.543     | 3.646     | na
    P3VBAT           | 3.074      | Volts      | ok    | na        | 2.141     | 2.459     | 3.265     | 3.286     | na
    P12V AUX         | 12.096     | Volts      | ok    | na        | 10.647    | 10.962    | 13.104    | 13.482    | na
    P105 PCH AUX     | 1.058      | Volts      | ok    | na        | 0.966     | 0.994     | 1.108     | 1.136     | na
    PVCCIN CPU1      | 1.824      | Volts      | ok    | na        | 1.372     | 1.419     | 2.087     | 2.153     | na
    PVCCIO CPU1      | 1.030      | Volts      | ok    | na        | 0.731     | 0.753     | 1.157     | 1.193     | na
    PVDQ ABC CPU1    | 1.243      | Volts      | ok    | na        | 1.101     | 1.136     | 1.264     | 1.299     | na
    PVDQ DEF CPU1    | 1.243      | Volts      | ok    | na        | 1.101     | 1.136     | 1.264     | 1.299     | na
    PVNN PCH AUX     | 0.902      | Volts      | ok    | na        | 0.781     | 0.809     | 1.051     | 1.079     | na

Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>
Change-Id: If0dd132f963253172862d1b5e2b96c3bbedcdfd4
2 files changed
tree: c78aba2863d32ec2534b9b9b2487fd5d22c8f5bc
  1. cmake/
  2. include/
  3. service_files/
  4. src/
  5. tests/
  6. .clang-format
  7. .clang-ignore
  8. .gitignore
  9. cmake-format.json
  10. CMakeLists.txt
  11. Jenkinsfile
  12. LICENSE
  13. MAINTAINERS
  14. 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