diff options
author | Lei YU <mine260309@gmail.com> | 2018-01-31 16:47:37 +0800 |
---|---|---|
committer | Lei YU <mine260309@gmail.com> | 2018-02-26 10:34:36 +0800 |
commit | 069e4405a6926cdacc33c0826075356da2cd9dbd (patch) | |
tree | 2d0083ed580d8bd3218a25cb75095cad4a9ed906 /control/fan.cpp | |
parent | 80f271b296488e12d4edd29b5bb908a407fbda1f (diff) | |
download | phosphor-fan-presence-069e4405a6926cdacc33c0826075356da2cd9dbd.tar.gz phosphor-fan-presence-069e4405a6926cdacc33c0826075356da2cd9dbd.zip |
Add target interface for fan control
Current fan control assumes the use of the FanSpeed interface for fan
targets.
For fans controlled by pwm, FanPwm interface is added.
This commit adds "target_interface" config parameter, so that user can
specify the interface for the fan targets.
E.g.
- inventory: /system/chassis/motherboard/fan0
cooling_zone: 0
cooling_profile: air
sensors:
- fan0
target_interface: xyz.openbmc_project.Control.FanPwm
The config is optional and defaults to FanSpeed, so the current code
will not be affected.
Tested: Use this config on Romulus, ensures the fan control sets
target on FanPwm interface and works fine.
Change-Id: I73adccaa770d657b5d7aaeb307917f89588524de
Signed-off-by: Lei YU <mine260309@gmail.com>
Diffstat (limited to 'control/fan.cpp')
-rw-r--r-- | control/fan.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/control/fan.cpp b/control/fan.cpp index f11bf6f..b0881da 100644 --- a/control/fan.cpp +++ b/control/fan.cpp @@ -36,13 +36,13 @@ using InternalFailure = sdbusplus::xyz::openbmc_project::Common:: constexpr auto PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties"; constexpr auto FAN_SENSOR_PATH = "/xyz/openbmc_project/sensors/fan_tach/"; -constexpr auto FAN_SENSOR_CONTROL_INTF = "xyz.openbmc_project.Control.FanSpeed"; constexpr auto FAN_TARGET_PROPERTY = "Target"; Fan::Fan(sdbusplus::bus::bus& bus, const FanDefinition& def): _bus(bus), - _name(std::get<fanNamePos>(def)) + _name(std::get<fanNamePos>(def)), + _interface(std::get<targetInterfacePos>(def)) { std::string path; auto sensors = std::get<sensorListPos>(def); @@ -58,7 +58,7 @@ Fan::Fan(sdbusplus::bus::bus& bus, const FanDefinition& def): _targetSpeed = util::SDBusPlus::getProperty<uint64_t>( bus, path, - FAN_SENSOR_CONTROL_INTF, + _interface, FAN_TARGET_PROPERTY); } } @@ -69,7 +69,7 @@ Fan::Fan(sdbusplus::bus::bus& bus, const FanDefinition& def): std::string Fan::getService(const std::string& sensor) { return phosphor::fan::util::getService(sensor, - FAN_SENSOR_CONTROL_INTF, + _interface, _bus); } @@ -87,7 +87,7 @@ void Fan::setSpeed(uint64_t speed) sensor.c_str(), PROPERTY_INTERFACE, "Set"); - method.append(FAN_SENSOR_CONTROL_INTF, property, value); + method.append(_interface, property, value); auto response = _bus.call(method); if (response.is_method_error()) |