mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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>
This commit is contained in:
parent
1c0c52f762
commit
5f14cd7032
3 changed files with 123 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue