From 069e4405a6926cdacc33c0826075356da2cd9dbd Mon Sep 17 00:00:00 2001 From: Lei YU Date: Wed, 31 Jan 2018 16:47:37 +0800 Subject: 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 --- control/fan.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'control/fan.cpp') 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(def)) + _name(std::get(def)), + _interface(std::get(def)) { std::string path; auto sensors = std::get(def); @@ -58,7 +58,7 @@ Fan::Fan(sdbusplus::bus::bus& bus, const FanDefinition& def): _targetSpeed = util::SDBusPlus::getProperty( 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()) -- cgit v1.2.1