commit | e8a14e91eefb21dc4bfa754c57212504f7fddb09 | [log] [tgz] |
---|---|---|
author | cchoux <cosmo.chou@quantatw.com> | Wed Oct 25 23:26:27 2023 +0800 |
committer | Ed Tanous <ed@tanous.net> | Tue Jun 25 17:35:23 2024 -0700 |
tree | 2a96f257c996ff426e03186818eb031eea99c0b9 | |
parent | 503c14687ff1a02f6a68197ddfd99862a54ee09d [diff] |
psusensor: simplify the labelMatch table It might be more efficient to simplify the labelMatch table by not listing all labels. PSUProperty of the same type are mostly the same, except for fan properties. Listing all labels can limit flexibility and necessitate table modifications when adding new properties. Simplifying the table could help alleviate these constraints. Tested: (1) Sensors defined in "Labels" (e.g. tempN, powerN, fanN, ...) can be created successfully. (2) PWM sensors (/sys/class/hwmon/hwmonX/fanN_target) can be created with the names, "Pwm_PSUNAME_Fan_1", "Pwm_PSUNAME_Fan_2" ... (3) FanFault PSUSubEvents can be asserted. Change-Id: I789cdd5c5d0c5c92cca45700bd2095c166bdc564 Signed-off-by: Cosmo Chou <cosmo.chou@quantatw.com>
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.
ADC sensors are sensors based on an Analog to Digital Converter. They are read via the Linux kernel Industrial I/O subsystem (IIO).
One of the more common use cases within OpenBMC is for reading these sensors from the ADC on the Aspeed ASTXX cards.
To utilize ADC sensors feature within OpenBMC you must first define and enable it within the kernel device tree.
When using a common OpenBMC device like the AST2600 you will find a "adc0" and "adc1" section in the aspeed-g6.dtsi file. These are disabled by default so in your system-specific dts you would enable and configure what you want with something like this:
iio-hwmon { compatible = "iio-hwmon"; io-channels = <&adc0 0>; ... } &adc0 { status = "okay"; ... }; &adc1 { status = "okay"; ... };
Note that this is not meant to be an exhaustive list on the nuances of configuring a device tree but really to point users in the general direction.
You will then create an entity-manager configuration file that is of type "ADC" A very simple example would like look this:
"Index": 0, "Name": "P12V", "PowerState": "Always", "ScaleFactor": 1.0, "Type": "ADC"
When your system is booted, a "in0_input" file will be created within the hwmon subsystem (/sys/class/hwmon/hwmonX). The adcsensor application will scan d-bus for any ADC entity-manager objects, look up their "Index" value, and try to match that with the hwmon inY_input files. When it finds a match it will create a d-bus sensor under the xyz.openbmc_project.ADCSensor service. The sensor will be periodically updated based on readings from the hwmon file.