pseq: Add named GPIO properties
Add the new named GPIO properties from the JSON config file to the
power sequencer device class hierarchy.
New JSON GPIO properties:
* power_control_gpio_name
* power_good_gpio_name
Power sequencer device class hierarchy:
* PowerSequencerDevice (power_sequencer_device.*)
* StandardDevice (standard_device.*)
* PMBusDriverDevice (pmbus_driver_device.*)
* UCD90xDevice (ucd90x_device.*)
* UCD90160Device (ucd90160_device.*)
* UCD90320Device (ucd90320_device.*)
Tested:
* Ran automated tests. All ran successfully.
Change-Id: Idcccee89eb09cb7d135f45aeb4f6dfe8299adf43
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/phosphor-power-sequencer/src/pmbus_driver_device.hpp b/phosphor-power-sequencer/src/pmbus_driver_device.hpp
index 9e77626..c6b6369 100644
--- a/phosphor-power-sequencer/src/pmbus_driver_device.hpp
+++ b/phosphor-power-sequencer/src/pmbus_driver_device.hpp
@@ -56,6 +56,10 @@
* @param name Device name
* @param bus I2C bus for the device
* @param address I2C address for the device
+ * @param powerControlGPIOName Name of the GPIO that turns this device on
+ * and off
+ * @param powerGoodGPIOName Name of the GPIO that reads the power good
+ * signal from this device
* @param rails Voltage rails that are enabled and monitored by this device
* @param services System services like hardware presence and the journal
* @param driverName Device driver name
@@ -63,9 +67,12 @@
*/
explicit PMBusDriverDevice(
const std::string& name, uint8_t bus, uint16_t address,
+ const std::string& powerControlGPIOName,
+ const std::string& powerGoodGPIOName,
std::vector<std::unique_ptr<Rail>> rails, Services& services,
const std::string& driverName = "", size_t instance = 0) :
- StandardDevice(name, bus, address, std::move(rails)),
+ StandardDevice(name, bus, address, powerControlGPIOName,
+ powerGoodGPIOName, std::move(rails)),
driverName{driverName}, instance{instance}
{
pmbusInterface =
diff --git a/phosphor-power-sequencer/src/power_control.cpp b/phosphor-power-sequencer/src/power_control.cpp
index fbf2d5f..fa43ff9 100644
--- a/phosphor-power-sequencer/src/power_control.cpp
+++ b/phosphor-power-sequencer/src/power_control.cpp
@@ -399,12 +399,14 @@
{
device = std::make_unique<UCD90160Device>(
deviceProperties->bus, deviceProperties->address,
+ "power-chassis-control", "power-chassis-good",
std::move(rails), services);
}
else if (deviceProperties->type == UCD90320Device::deviceName)
{
device = std::make_unique<UCD90320Device>(
deviceProperties->bus, deviceProperties->address,
+ "power-chassis-control", "power-chassis-good",
std::move(rails), services);
}
else
diff --git a/phosphor-power-sequencer/src/power_sequencer_device.hpp b/phosphor-power-sequencer/src/power_sequencer_device.hpp
index b7907c0..7597595 100644
--- a/phosphor-power-sequencer/src/power_sequencer_device.hpp
+++ b/phosphor-power-sequencer/src/power_sequencer_device.hpp
@@ -66,6 +66,21 @@
virtual uint16_t getAddress() const = 0;
/**
+ * Returns the name of the GPIO that turns this device on and off.
+ *
+ * @return GPIO name
+ */
+ virtual const std::string& getPowerControlGPIOName() const = 0;
+
+ /**
+ * Returns the name of the GPIO that reads the power good signal from this
+ * device.
+ *
+ * @return GPIO name
+ */
+ virtual const std::string& getPowerGoodGPIOName() const = 0;
+
+ /**
* Returns the voltage rails that are enabled and monitored by this device.
*
* @return voltage rails
diff --git a/phosphor-power-sequencer/src/standard_device.hpp b/phosphor-power-sequencer/src/standard_device.hpp
index 03a6bf0..54c3a01 100644
--- a/phosphor-power-sequencer/src/standard_device.hpp
+++ b/phosphor-power-sequencer/src/standard_device.hpp
@@ -56,12 +56,20 @@
* @param name device name
* @param bus I2C bus for the device
* @param address I2C address for the device
+ * @param powerControlGPIOName name of the GPIO that turns this device on
+ * and off
+ * @param powerGoodGPIOName name of the GPIO that reads the power good
+ * signal from this device
* @param rails voltage rails that are enabled and monitored by this device
*/
explicit StandardDevice(const std::string& name, uint8_t bus,
uint16_t address,
+ const std::string& powerControlGPIOName,
+ const std::string& powerGoodGPIOName,
std::vector<std::unique_ptr<Rail>> rails) :
- name{name}, bus{bus}, address{address}, rails{std::move(rails)}
+ name{name}, bus{bus}, address{address},
+ powerControlGPIOName{powerControlGPIOName},
+ powerGoodGPIOName{powerGoodGPIOName}, rails{std::move(rails)}
{}
/** @copydoc PowerSequencerDevice::getName() */
@@ -82,6 +90,18 @@
return address;
}
+ /** @copydoc PowerSequencerDevice::getPowerControlGPIOName() */
+ virtual const std::string& getPowerControlGPIOName() const override
+ {
+ return powerControlGPIOName;
+ }
+
+ /** @copydoc PowerSequencerDevice::getPowerGoodGPIOName() */
+ virtual const std::string& getPowerGoodGPIOName() const override
+ {
+ return powerGoodGPIOName;
+ }
+
/** @copydoc PowerSequencerDevice::getRails() */
virtual const std::vector<std::unique_ptr<Rail>>& getRails() const override
{
@@ -199,6 +219,16 @@
uint16_t address;
/**
+ * Name of the GPIO that turns this device on and off.
+ */
+ std::string powerControlGPIOName{};
+
+ /**
+ * Name of the GPIO that reads the power good signal from this device.
+ */
+ std::string powerGoodGPIOName{};
+
+ /**
* Voltage rails that are enabled and monitored by this device.
*/
std::vector<std::unique_ptr<Rail>> rails{};
diff --git a/phosphor-power-sequencer/src/ucd90160_device.hpp b/phosphor-power-sequencer/src/ucd90160_device.hpp
index fa7c5e9..73f9df2 100644
--- a/phosphor-power-sequencer/src/ucd90160_device.hpp
+++ b/phosphor-power-sequencer/src/ucd90160_device.hpp
@@ -50,13 +50,19 @@
*
* @param bus I2C bus for the device
* @param address I2C address for the device
+ * @param powerControlGPIOName Name of the GPIO that turns this device on
+ * and off
+ * @param powerGoodGPIOName Name of the GPIO that reads the power good
+ * signal from this device
* @param rails Voltage rails that are enabled and monitored by this device
* @param services System services like hardware presence and the journal
*/
- explicit UCD90160Device(uint8_t bus, uint16_t address,
- std::vector<std::unique_ptr<Rail>> rails,
- Services& services) :
- UCD90xDevice(deviceName, bus, address, std::move(rails), services)
+ explicit UCD90160Device(
+ uint8_t bus, uint16_t address, const std::string& powerControlGPIOName,
+ const std::string& powerGoodGPIOName,
+ std::vector<std::unique_ptr<Rail>> rails, Services& services) :
+ UCD90xDevice(deviceName, bus, address, powerControlGPIOName,
+ powerGoodGPIOName, std::move(rails), services)
{}
constexpr static std::string deviceName{"UCD90160"};
diff --git a/phosphor-power-sequencer/src/ucd90320_device.hpp b/phosphor-power-sequencer/src/ucd90320_device.hpp
index cadcbf6..87a5cc7 100644
--- a/phosphor-power-sequencer/src/ucd90320_device.hpp
+++ b/phosphor-power-sequencer/src/ucd90320_device.hpp
@@ -50,13 +50,19 @@
*
* @param bus I2C bus for the device
* @param address I2C address for the device
+ * @param powerControlGPIOName Name of the GPIO that turns this device on
+ * and off
+ * @param powerGoodGPIOName Name of the GPIO that reads the power good
+ * signal from this device
* @param rails Voltage rails that are enabled and monitored by this device
* @param services System services like hardware presence and the journal
*/
- explicit UCD90320Device(uint8_t bus, uint16_t address,
- std::vector<std::unique_ptr<Rail>> rails,
- Services& services) :
- UCD90xDevice(deviceName, bus, address, std::move(rails), services)
+ explicit UCD90320Device(
+ uint8_t bus, uint16_t address, const std::string& powerControlGPIOName,
+ const std::string& powerGoodGPIOName,
+ std::vector<std::unique_ptr<Rail>> rails, Services& services) :
+ UCD90xDevice(deviceName, bus, address, powerControlGPIOName,
+ powerGoodGPIOName, std::move(rails), services)
{}
constexpr static std::string deviceName{"UCD90320"};
diff --git a/phosphor-power-sequencer/src/ucd90x_device.hpp b/phosphor-power-sequencer/src/ucd90x_device.hpp
index 45dd774..e19c1b6 100644
--- a/phosphor-power-sequencer/src/ucd90x_device.hpp
+++ b/phosphor-power-sequencer/src/ucd90x_device.hpp
@@ -53,14 +53,20 @@
* @param name Device name
* @param bus I2C bus for the device
* @param address I2C address for the device
+ * @param powerControlGPIOName Name of the GPIO that turns this device on
+ * and off
+ * @param powerGoodGPIOName Name of the GPIO that reads the power good
+ * signal from this device
* @param rails Voltage rails that are enabled and monitored by this device
* @param services System services like hardware presence and the journal
*/
- explicit UCD90xDevice(const std::string& name, uint8_t bus,
- uint16_t address,
- std::vector<std::unique_ptr<Rail>> rails,
- Services& services) :
- PMBusDriverDevice(name, bus, address, std::move(rails), services,
+ explicit UCD90xDevice(
+ const std::string& name, uint8_t bus, uint16_t address,
+ const std::string& powerControlGPIOName,
+ const std::string& powerGoodGPIOName,
+ std::vector<std::unique_ptr<Rail>> rails, Services& services) :
+ PMBusDriverDevice(name, bus, address, powerControlGPIOName,
+ powerGoodGPIOName, std::move(rails), services,
driverName)
{}
diff --git a/phosphor-power-sequencer/test/mock_device.hpp b/phosphor-power-sequencer/test/mock_device.hpp
index 7edd3ae..3b218cd 100644
--- a/phosphor-power-sequencer/test/mock_device.hpp
+++ b/phosphor-power-sequencer/test/mock_device.hpp
@@ -43,6 +43,10 @@
MOCK_METHOD(const std::string&, getName, (), (const, override));
MOCK_METHOD(uint8_t, getBus, (), (const, override));
MOCK_METHOD(uint16_t, getAddress, (), (const, override));
+ MOCK_METHOD(const std::string&, getPowerControlGPIOName, (),
+ (const, override));
+ MOCK_METHOD(const std::string&, getPowerGoodGPIOName, (),
+ (const, override));
MOCK_METHOD(const std::vector<std::unique_ptr<Rail>>&, getRails, (),
(const, override));
MOCK_METHOD(std::vector<int>, getGPIOValues, (Services & services),
diff --git a/phosphor-power-sequencer/test/pmbus_driver_device_tests.cpp b/phosphor-power-sequencer/test/pmbus_driver_device_tests.cpp
index b8598ca..979a459 100644
--- a/phosphor-power-sequencer/test/pmbus_driver_device_tests.cpp
+++ b/phosphor-power-sequencer/test/pmbus_driver_device_tests.cpp
@@ -114,15 +114,25 @@
std::string name{"XYZ_PSEQ"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 5));
rails.emplace_back(createRail("VIO", 7));
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
EXPECT_EQ(device.getName(), name);
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_EQ(device.getRails().size(), 2);
EXPECT_EQ(device.getRails()[0]->getName(), "VDD");
EXPECT_EQ(device.getRails()[1]->getName(), "VIO");
@@ -138,18 +148,29 @@
std::string name{"XYZ_PSEQ"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-on"};
+ std::string powerGoodGPIOName{"pgood"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 5));
rails.emplace_back(createRail("VIO", 7));
std::string driverName{"xyzdev"};
size_t instance{3};
PMBusDriverDevice device{
- name, bus, address, std::move(rails),
- services, driverName, instance};
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services,
+ driverName,
+ instance};
EXPECT_EQ(device.getName(), name);
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_EQ(device.getRails().size(), 2);
EXPECT_EQ(device.getRails()[0]->getName(), "VDD");
EXPECT_EQ(device.getRails()[1]->getName(), "VIO");
@@ -166,10 +187,19 @@
std::string name{"XYZ_PSEQ"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
std::string driverName{"xyzdev"};
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services, driverName};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services,
+ driverName};
EXPECT_EQ(device.getDriverName(), driverName);
}
@@ -181,11 +211,21 @@
std::string name{"XYZ_PSEQ"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
std::string driverName{"xyzdev"};
size_t instance{3};
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services, driverName, instance};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services,
+ driverName,
+ instance};
EXPECT_EQ(device.getInstance(), instance);
}
@@ -197,8 +237,17 @@
std::string name{"XYZ_PSEQ"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails), services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
EXPECT_NE(&(device.getPMBusInterface()), nullptr);
}
@@ -216,9 +265,17 @@
std::string name{"ABC_382%#, ZY"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
EXPECT_TRUE(device.getGPIOValues(services) == gpioValues);
}
@@ -234,9 +291,17 @@
std::string name{"XYZ_PSEQ"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
try
{
@@ -262,9 +327,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, read("status13", Type::Debug, true))
@@ -282,9 +355,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, read("status0", Type::Debug, true))
@@ -316,9 +397,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, read("status13_vout", Type::Debug, true))
@@ -336,9 +425,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, read("status0_vout", Type::Debug, true))
@@ -373,9 +470,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -402,9 +507,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -442,9 +555,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -471,9 +592,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -516,9 +645,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -549,9 +686,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -591,9 +736,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -613,9 +766,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -643,9 +804,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -681,9 +850,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -716,9 +893,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails),
- services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -763,8 +948,17 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- PMBusDriverDevice device{name, bus, address, std::move(rails), services};
+ PMBusDriverDevice device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
// Methods that get hwmon file info should be called twice
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
diff --git a/phosphor-power-sequencer/test/standard_device_tests.cpp b/phosphor-power-sequencer/test/standard_device_tests.cpp
index cf4c90c..bbeb459 100644
--- a/phosphor-power-sequencer/test/standard_device_tests.cpp
+++ b/phosphor-power-sequencer/test/standard_device_tests.cpp
@@ -62,8 +62,11 @@
// Constructor just calls StandardDevice constructor
explicit StandardDeviceImpl(const std::string& name, uint8_t bus,
uint16_t address,
+ const std::string& powerControlGPIOName,
+ const std::string& powerGoodGPIOName,
std::vector<std::unique_ptr<Rail>> rails) :
- StandardDevice(name, bus, address, std::move(rails))
+ StandardDevice(name, bus, address, powerControlGPIOName,
+ powerGoodGPIOName, std::move(rails))
{}
// Mock pure virtual methods
@@ -150,12 +153,22 @@
std::string name{"xyz_pseq"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_EQ(device.getName(), name);
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_TRUE(device.getRails().empty());
}
@@ -164,15 +177,25 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 3));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_EQ(device.getName(), name);
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_EQ(device.getRails().size(), 3);
EXPECT_EQ(device.getRails()[0]->getName(), "PSU");
EXPECT_EQ(device.getRails()[1]->getName(), "VDD");
@@ -185,8 +208,16 @@
std::string name{"xyz_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_EQ(device.getName(), name);
}
@@ -196,8 +227,16 @@
std::string name{"abc_pseq"};
uint8_t bus{1};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_EQ(device.getBus(), bus);
}
@@ -207,12 +246,58 @@
std::string name{"abc_pseq"};
uint8_t bus{1};
uint16_t address{0x24};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_EQ(device.getAddress(), address);
}
+TEST(StandardDeviceTests, GetPowerControlGPIOName)
+{
+ std::string name{"xyz_pseq"};
+ uint8_t bus{0};
+ uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-on"};
+ std::string powerGoodGPIOName{"chassis-pgood"};
+ std::vector<std::unique_ptr<Rail>> rails{};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
+
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+}
+
+TEST(StandardDeviceTests, GetPowerGoodGPIOName)
+{
+ std::string name{"xyz_pseq"};
+ uint8_t bus{0};
+ uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-on"};
+ std::string powerGoodGPIOName{"chassis-pgood"};
+ std::vector<std::unique_ptr<Rail>> rails{};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
+
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
+}
+
TEST(StandardDeviceTests, GetRails)
{
// Empty vector of rails
@@ -220,8 +305,16 @@
std::string name{"xyz_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_TRUE(device.getRails().empty());
}
@@ -231,11 +324,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 3));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_EQ(device.getRails().size(), 3);
EXPECT_EQ(device.getRails()[0]->getName(), "PSU");
@@ -251,11 +352,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 2));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{1, 1, 1};
@@ -284,11 +393,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 2));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{1, 1, 0};
@@ -336,11 +453,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 2));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{1, 1, 0};
@@ -387,11 +512,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 2));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{1, 1, 1};
@@ -446,11 +579,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailStatusVout("PSU", true, 3));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{};
@@ -498,11 +639,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailStatusVout("PSU", true, 3));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
EXPECT_CALL(device, getGPIOValues)
@@ -549,11 +698,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 2));
rails.emplace_back(createRailGPIO("VDD", false, 1));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{0, 0, 0};
@@ -602,11 +759,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailStatusVout("VIO", false, 7));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailGPIO("PSU", true, 2));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{1, 1, 0};
@@ -659,11 +824,19 @@
std::string name{"abc_pseq"};
uint8_t bus{0};
uint16_t address{0x23};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(createRailGPIO("PSU", true, 2));
rails.emplace_back(createRailOutputVoltage("VDD", false, 5));
rails.emplace_back(createRailStatusVout("VIO", false, 7));
- StandardDeviceImpl device{name, bus, address, std::move(rails)};
+ StandardDeviceImpl device{
+ name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails)};
EXPECT_CALL(device, prepareForPgoodFaultDetection).Times(1);
std::vector<int> gpioValues{1, 1, 1};
diff --git a/phosphor-power-sequencer/test/ucd90160_device_tests.cpp b/phosphor-power-sequencer/test/ucd90160_device_tests.cpp
index 1975e25..e0bfa64 100644
--- a/phosphor-power-sequencer/test/ucd90160_device_tests.cpp
+++ b/phosphor-power-sequencer/test/ucd90160_device_tests.cpp
@@ -64,14 +64,23 @@
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 5));
rails.emplace_back(createRail("VIO", 7));
- UCD90160Device device{bus, address, std::move(rails), services};
+ UCD90160Device device{bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
EXPECT_EQ(device.getName(), "UCD90160");
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_EQ(device.getRails().size(), 2);
EXPECT_EQ(device.getRails()[0]->getName(), "VDD");
EXPECT_EQ(device.getRails()[1]->getName(), "VIO");
@@ -150,9 +159,16 @@
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 2));
- UCD90160Device device{bus, address, std::move(rails), services};
+ UCD90160Device device{bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -247,9 +263,16 @@
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 2));
- UCD90160Device device{bus, address, std::move(rails), services};
+ UCD90160Device device{bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
diff --git a/phosphor-power-sequencer/test/ucd90320_device_tests.cpp b/phosphor-power-sequencer/test/ucd90320_device_tests.cpp
index 182a410..b42dae5 100644
--- a/phosphor-power-sequencer/test/ucd90320_device_tests.cpp
+++ b/phosphor-power-sequencer/test/ucd90320_device_tests.cpp
@@ -64,14 +64,23 @@
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 5));
rails.emplace_back(createRail("VIO", 7));
- UCD90320Device device{bus, address, std::move(rails), services};
+ UCD90320Device device{bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
EXPECT_EQ(device.getName(), "UCD90320");
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_EQ(device.getRails().size(), 2);
EXPECT_EQ(device.getRails()[0]->getName(), "VDD");
EXPECT_EQ(device.getRails()[1]->getName(), "VIO");
@@ -142,9 +151,16 @@
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 2));
- UCD90320Device device{bus, address, std::move(rails), services};
+ UCD90320Device device{bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -230,9 +246,16 @@
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 2));
- UCD90320Device device{bus, address, std::move(rails), services};
+ UCD90320Device device{bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
diff --git a/phosphor-power-sequencer/test/ucd90x_device_tests.cpp b/phosphor-power-sequencer/test/ucd90x_device_tests.cpp
index 5212d65..9d9423e 100644
--- a/phosphor-power-sequencer/test/ucd90x_device_tests.cpp
+++ b/phosphor-power-sequencer/test/ucd90x_device_tests.cpp
@@ -67,14 +67,24 @@
std::string name{"ucd90320"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 5));
rails.emplace_back(createRail("VIO", 7));
- UCD90xDevice device{name, bus, address, std::move(rails), services};
+ UCD90xDevice device{name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
EXPECT_EQ(device.getName(), name);
EXPECT_EQ(device.getBus(), bus);
EXPECT_EQ(device.getAddress(), address);
+ EXPECT_EQ(device.getPowerControlGPIOName(), powerControlGPIOName);
+ EXPECT_EQ(device.getPowerGoodGPIOName(), powerGoodGPIOName);
EXPECT_EQ(device.getRails().size(), 2);
EXPECT_EQ(device.getRails()[0]->getName(), "VDD");
EXPECT_EQ(device.getRails()[1]->getName(), "VIO");
@@ -92,8 +102,16 @@
std::string name{"ucd90320"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- UCD90xDevice device{name, bus, address, std::move(rails), services};
+ UCD90xDevice device{name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
uint64_t mfrStatus{0x123456789abcull};
@@ -111,8 +129,16 @@
std::string name{"ucd90320"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
- UCD90xDevice device{name, bus, address, std::move(rails), services};
+ UCD90xDevice device{name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, read("mfr_status", Type::HwmonDeviceDebug, true))
@@ -167,9 +193,17 @@
std::string name{"ucd90320"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 2));
- UCD90xDevice device{name, bus, address, std::move(rails), services};
+ UCD90xDevice device{name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))
@@ -221,9 +255,17 @@
std::string name{"ucd90320"};
uint8_t bus{3};
uint16_t address{0x72};
+ std::string powerControlGPIOName{"power-chassis-control"};
+ std::string powerGoodGPIOName{"power-chassis-good"};
std::vector<std::unique_ptr<Rail>> rails;
rails.emplace_back(createRail("VDD", 2));
- UCD90xDevice device{name, bus, address, std::move(rails), services};
+ UCD90xDevice device{name,
+ bus,
+ address,
+ powerControlGPIOName,
+ powerGoodGPIOName,
+ std::move(rails),
+ services};
MockPMBus& pmbus = static_cast<MockPMBus&>(device.getPMBusInterface());
EXPECT_CALL(pmbus, getPath(Type::Hwmon))