f3b04fd3 | 24-Jul-2020 |
Jason Ling <jasonling@google.com> |
dbusconfiguration: add support for one-to-one fan/pwm mapping
Problem: in a fan pid only the last pwm from "Outputs" in the fan pid configuration would be applied to all the fans listed in "Inputs".
dbusconfiguration: add support for one-to-one fan/pwm mapping
Problem: in a fan pid only the last pwm from "Outputs" in the fan pid configuration would be applied to all the fans listed in "Inputs". This is an error since "Outputs" is a list of strings, not a single string.
Solution: If Class=="fan" && InputInterfaces.size() == OutputInterfaces.size() then elaborate the sensors on a one Input to one Output basis. Else if Class=="fan" && OutputInterfaces.size() == 1 then: do the old behavior where all the fans in Inputs have their writepaths set to the one pwm interface. Else: This is an error condition so throw an exception
Additional changes:
Improve readability: for clarity "Inputs" and "Outputs" have been split into separate datastructures. The same was done for "SensorInterfaces". This makes it easier to understand what is going on during sensor elaboration.
Improve error handling: For fans there should be one output or the number of outputs should match inputs. If this isn't the case then the configuration isn't valid and the system should fail.
Tested: fragment of dbus configuration used: { "Class": "fan", "Name": "fan0_pid", ... "Inputs": [ "fan0_tach", "fan1_tach", "fan2_tach" ], ... "Outputs": [ "fan0_pwm","fan1_pwm", "fan2_pwm" ], }, Without Change: see in the sensor config the last element of Outputs is used to drive all the fans. Additionally fan pwms are added to the sensor configuration which looks to be incorrect. Only a single sensor node is needed for fans and fan tachs are chosen for this purpose. {fan0_pwm, {, , /xyz/openbmc_project/control/fanpwm/fan2_pwm, 0, 255, 0}, }, {fan0_tach, {fan, /xyz/openbmc_project/sensors/fan_tach/fan0_tach, /xyz/openbmc_project/control/fanpwm/fan2_pwm, 0, 255, 0}, }, {fan1_pwm, {, , /xyz/openbmc_project/control/fanpwm/fan2_pwm, 0, 255, 0}, }, {fan1_tach, {fan, /xyz/openbmc_project/sensors/fan_tach/fan1_tach, /xyz/openbmc_project/control/fanpwm/fan2_pwm, 0, 255, 0}, }, {fan2_pwm, {, , /xyz/openbmc_project/control/fanpwm/fan1_pwm, 0, 255, 0}, }, {fan2_tach, {fan, /xyz/openbmc_project/sensors/fan_tach/fan2_tach, /xyz/openbmc_project/control/fanpwm/fan2_pwm, 0, 255, 0}, },
With Change: see in the sensor config the correct association for a fan_tach sensor. Also the fan_pwms are trimmed. sensor config: { {fan0_tach, {fan, /xyz/openbmc_project/sensors/fan_tach/fan0_tach, /xyz/openbmc_project/control/fanpwm/fan0_pwm, 0, 255, 0} }, {fan1_tach, {fan, /xyz/openbmc_project/sensors/fan_tach/fan1_tach, /xyz/openbmc_project/control/fanpwm/fan1_pwm, 0, 255, 0} }, {fan2_tach, {fan, /xyz/openbmc_project/sensors/fan_tach/fan2_tach, /xyz/openbmc_project/control/fanpwm/fan2_pwm, 0, 255, 0} }, }
Signed-off-by: Jason Ling <jasonling@google.com> Change-Id: Id4494028752026a5ba8f0c1d8081276e0bf4be90
show more ...
|