aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTitus Rwantare <titusr@google.com>2022-03-07 12:06:05 -0800
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2022-03-08 18:46:48 +0100
commit5f14cd7032beab6cac8d7ed1b09efc58baddb48c (patch)
treedf6ac9d4eb62125f8fa88bf6000eb793d0e528fa /tests
parent1c0c52f76208c648a70b115fc99ab558008466da (diff)
downloadqemu-5f14cd7032beab6cac8d7ed1b09efc58baddb48c.zip
qemu-5f14cd7032beab6cac8d7ed1b09efc58baddb48c.tar.gz
qemu-5f14cd7032beab6cac8d7ed1b09efc58baddb48c.tar.bz2
hw/sensor: add Renesas raa228000 device
Signed-off-by: Titus Rwantare <titusr@google.com> Reviewed-by: Hao Wu <wuhaotsh@google.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Corey Minyard <cminyard@mvista.com> Message-Id: <20220307200605.4001451-10-titusr@google.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/qtest/isl_pmbus_vr-test.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/qtest/isl_pmbus_vr-test.c b/tests/qtest/isl_pmbus_vr-test.c
index dc0ccae..5553ea4 100644
--- a/tests/qtest/isl_pmbus_vr-test.c
+++ b/tests/qtest/isl_pmbus_vr-test.c
@@ -150,6 +150,70 @@ static void test_defaults(void *obj, void *data, QGuestAllocator *alloc)
g_assert_cmphex(i2c_value, ==, ISL_REVISION_DEFAULT);
}
+static void raa228000_test_defaults(void *obj, void *data,
+ QGuestAllocator *alloc)
+{
+ uint16_t value, i2c_value;
+ QI2CDevice *i2cdev = (QI2CDevice *)obj;
+
+ value = qmp_isl_pmbus_vr_get(TEST_ID, "vout[0]");
+ g_assert_cmpuint(value, ==, 0);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_READ_IOUT);
+ g_assert_cmpuint(i2c_value, ==, 0);
+
+ value = qmp_isl_pmbus_vr_get(TEST_ID, "pout[0]");
+ g_assert_cmpuint(value, ==, 0);
+
+ i2c_value = i2c_get8(i2cdev, PMBUS_CAPABILITY);
+ g_assert_cmphex(i2c_value, ==, ISL_CAPABILITY_DEFAULT);
+
+ i2c_value = i2c_get8(i2cdev, PMBUS_OPERATION);
+ g_assert_cmphex(i2c_value, ==, ISL_OPERATION_DEFAULT);
+
+ i2c_value = i2c_get8(i2cdev, PMBUS_ON_OFF_CONFIG);
+ g_assert_cmphex(i2c_value, ==, ISL_ON_OFF_CONFIG_DEFAULT);
+
+ i2c_value = i2c_get8(i2cdev, PMBUS_VOUT_MODE);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_MODE_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VOUT_COMMAND);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_COMMAND_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VOUT_MAX);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_MAX_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VOUT_MARGIN_HIGH);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_MARGIN_HIGH_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VOUT_MARGIN_LOW);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_MARGIN_LOW_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VOUT_TRANSITION_RATE);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_TRANSITION_RATE_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VOUT_OV_FAULT_LIMIT);
+ g_assert_cmphex(i2c_value, ==, ISL_VOUT_OV_FAULT_LIMIT_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_OT_FAULT_LIMIT);
+ g_assert_cmphex(i2c_value, ==, ISL_OT_FAULT_LIMIT_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_OT_WARN_LIMIT);
+ g_assert_cmphex(i2c_value, ==, ISL_OT_WARN_LIMIT_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VIN_OV_WARN_LIMIT);
+ g_assert_cmphex(i2c_value, ==, ISL_VIN_OV_WARN_LIMIT_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_VIN_UV_WARN_LIMIT);
+ g_assert_cmphex(i2c_value, ==, ISL_VIN_UV_WARN_LIMIT_DEFAULT);
+
+ i2c_value = isl_pmbus_vr_i2c_get16(i2cdev, PMBUS_IIN_OC_FAULT_LIMIT);
+ g_assert_cmphex(i2c_value, ==, ISL_IIN_OC_FAULT_LIMIT_DEFAULT);
+
+ i2c_value = i2c_get8(i2cdev, PMBUS_REVISION);
+ g_assert_cmphex(i2c_value, ==, ISL_REVISION_DEFAULT);
+}
+
/* test qmp access */
static void test_tx_rx(void *obj, void *data, QGuestAllocator *alloc)
{
@@ -398,5 +462,13 @@ static void isl_pmbus_vr_register_nodes(void)
qos_add_test("test_rw_regs", "raa229004", test_rw_regs, NULL);
qos_add_test("test_pages_rw", "raa229004", test_pages_rw, NULL);
qos_add_test("test_ov_faults", "raa229004", test_voltage_faults, NULL);
+
+ qos_node_create_driver("raa228000", i2c_device_create);
+ qos_node_consumes("raa228000", "i2c-bus", &opts);
+
+ qos_add_test("test_defaults", "raa228000", raa228000_test_defaults, NULL);
+ qos_add_test("test_tx_rx", "raa228000", test_tx_rx, NULL);
+ qos_add_test("test_rw_regs", "raa228000", test_rw_regs, NULL);
+ qos_add_test("test_ov_faults", "raa228000", test_voltage_faults, NULL);
}
libqos_init(isl_pmbus_vr_register_nodes);