commit | 6678388793fd7c11adc540b69320ce906357bada | [log] [tgz] |
---|---|---|
author | Andrew Geissler <geissonator@yahoo.com> | Wed Apr 02 11:50:33 2025 -0500 |
committer | Andrew Jeffery <andrew@codeconstruct.com.au> | Wed May 14 02:52:34 2025 +0000 |
tree | ec024e069f148636242dc758ebd2cc265c86fdd4 | |
parent | b5922b11e3d4e2ef6dc0a2eac1530a8b3e6433f8 [diff] |
psusensor: don't add fan sensor if not in labels The checkPWMSensor() function will add a fan sensor to the global array even if the user has not requested it be added. In this situation, where the user has not requested this sensor be added for their system, it will be partially added and appear as a sensor on d-bus. It's only partially added because code soon after the checkPWMSensor() will check for the label and notice it's not to be monitored and move on to the next sensor. But the damage has been done, the fan sensor has been added to the official dbus sensor list. This commit duplicates the label check logic a little bit further down in the code so it's not optimal. But without completely refactoring this huge function, this seems like the best option. The current bug is that checkPWMSensor() is called and the sensor is added to pwmSensors[]. Then once we return from the call, the label check is done and a continue is issued because the fan sensor is not in the label list. Because of this, none of the additional code is run required to initialize the sensor properly. Tested - Confirmed the fan sensors are no longer created on IBM System1 Change-Id: If801981295f36cc845e559a76573b488e9c420ac Signed-off-by: Andrew Geissler <geissonator@yahoo.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.