commit | b844e97a01748eededac22e920df6e60fad9bb8d | [log] [tgz] |
---|---|---|
author | Joseph Fu <joseph.fu@quantatw.com> | Sat Mar 25 10:24:30 2023 +0800 |
committer | Zhikui Ren <zhikui.ren@intel.com> | Thu Aug 17 23:17:47 2023 +0000 |
tree | f634c309e151a38ad59e73d8a362d08ee77ae34a | |
parent | b6f89a0b0d1d94497d2735dfd753ca72c05187b2 [diff] |
PSUSensor: add IIO device sensor Support IIO device on D-bus via dbus-sensors, expose path to support multi-channel labels. Reference: https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/47822 This patch is able to support the IIO device ADS1015 Use with this patch. https://gerrit.openbmc.org/c/openbmc/entity-manager/+/58505 Json config { "Address": "0x49", "Bus": 11, "Labels": [ "in_voltage1", "in_voltage2" ], "Name": "vr_prnt_cem", "EntityId": "0x07", "EntityInstance": "0x17", "in_voltage1_Name": "vr_prnt_msas1", "in_voltage1_Scale": 1000, "in_voltage2_Name": "vr_prnt_msas2", "in_voltage2_Scale": 1000, "PowerState": "On", "Thresholds": [ { "Direction": "greater than", "Label": "in_voltage1", "Name": "upper critical", "Severity": 1, "Value": 2.0 }, { "Direction": "less than", "Label": "in_voltage1", "Name": "lower critical", "Severity": 1, "Value": 0.0 }, { "Direction": "greater than", "Label": "in_voltage2", "Name": "upper critical", "Severity": 1, "Value": 2.0 }, { "Direction": "less than", "Label": "in_voltage2", "Name": "lower critical", "Severity": 1, "Value": 0.0 } ], "in_voltage1_Max": 2.0, "in_voltage1_Min": 0.0, "in_voltage2_Max": 2.0, "in_voltage2_Min": 0.0, "PollRate": 1.0, "Type": "ADS1015" } Tested: root@qbmc:~# busctl tree xyz.openbmc_project.EntityManager |grep msas |-/xyz/openbmc_project/inventory/system/board/Yertle/vr_prnt_msas1 `-/xyz/openbmc_project/inventory/system/board/Yertle/vr_prnt_msas2 root@qbmc:~# busctl tree xyz.openbmc_project.PSUSensor `-/xyz `-/xyz/openbmc_project |-/xyz/openbmc_project/control `-/xyz/openbmc_project/sensors `-/xyz/openbmc_project/sensors/voltage |-/xyz/openbmc_project/sensors/voltage/vr_prnt_msas1 `-/xyz/openbmc_project/sensors/voltage/vr_prnt_msas2 root@qbmc:~# busctl get-property xyz.openbmc_project.PSUSensor \ /xyz/openbmc_project/sensors/voltage/vr_prnt_msas1 \ xyz.openbmc_project.Sensor.Value Value d 1.72 Signed-off-by: Joseph Fu <joseph.fu@quantatw.com> Change-Id: I584f5d79850921e702b8572fb6b38e9dcfc44d25
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.
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
A typical dbus-sensors object support the following dbus interfaces:
Path /xyz/openbmc_project/sensors/<type>/<sensor_name> Interfaces xyz.openbmc_project.Sensor.Value xyz.openbmc_project.Sensor.Threshold.Critical xyz.openbmc_project.Sensor.Threshold.Warning xyz.openbmc_project.State.Decorator.Availability xyz.openbmc_project.State.Decorator.OperationalStatus xyz.openbmc_project.Association.Definitions
Sensor interfaces collection are described here.
Consumer examples of these interfaces are Redfish, Phosphor-Pid-Control, IPMI SDR.
dbus-sensor daemons are reactors that dynamically create and update sensors configuration when system configuration gets updated.
Using asio timers and async calls, dbus-sensor daemons read sensor values and check thresholds periodically. PropertiesChanged signals will be broadcasted for other services to consume when value or threshold status change. OperationStatus is set to false if the sensor is determined to be faulty.
A simple sensor example can be found here.
Sensor devices are described using Exposes records in configuration file. Name and Type fields are required. Different sensor types have different fields. Refer to entity manager schema for complete list.