Thanks to Cedric for reviewing
Summary of changes from v5:
machine:
- add documentation to docs/system/arm/aspeed.rst
- inline fby4_i2c_init_multiple_blade_chassis
machine functional test:
- no changes
max31790:
- max31790_set_rpm: clamp to maximum value instead of overflowing
when writing the uint16_t value
- max31790_reset: fix out of bounds write through max31790_pwm_write.
The loop was going over MAX31790_NUM_TACHS when it should be
MAX31790_NUM_FANS
> How does the 0x4444 value relates to the one used in the tests ?
There is something in the image which is writing the pwm, if you look at the traces
it should be more obvious in the latest patchset
max31790_pwm_write i2c_addr: 0x2f, index: 5, value: 0xb200
max31790_rpm_write i2c_addr: 0x2f, index: 5, value: 0x1c34
max31790_tach_count_reg i2c_addr: 0x2f, index: 5, value: 0x0440
max31790_send i2c_addr: 0x2f, data: 0x80
max31790_pwm_write i2c_addr: 0x2f, index: 5, value: 0xb280
max31790_rpm_write i2c_addr: 0x2f, index: 5, value: 0x1c48
max31790_tach_count_reg i2c_addr: 0x2f, index: 5, value: 0x0420
Looking then at the latest fan dynamics read from the driver
max31790_fan_dynamics_read i2c_addr: 0x20, channel: 0, value: 0x0000
max31790_recv_return i2c_addr: 0x20, reg_addr: 0x08, returns: 0x00
and plugging that into the equation
>>> (60 * 1 * 8192) / (0x0420 >> 4)
7447.272727272727
we get the value found in the test.
However the fan dynamics did not match the POR value so i noticed the reset function needs to be called from realize function to set the initial values.
Then the values read by the driver are as expected.
Also added some example calculation to the functional test to showcase
how the rpm read by the driver is created from the initial pwm write.
- fix redundant import and extra newline in functional test
- consolidate 2 trace logs in recv function and add more useful traces
max11615:
- remove "qemu/osdep.h" include from include/hw/sensor/max11615.h as requested
- fix missing '\n' in log message
- call reset function on realize to set initial POR register values.
Wrong reset flow caused the configured value to be overwritten before.
- review test values and linux driver, adjust the test to the correct value
adc128d818:
- no changes for now, focusing on getting the machine
and the first 2 sensors done.
Alexander Hansen (5):
ast2600: yosemite4 initial support
ast2600: yosemite4 functional test
hw/sensor: MAX31790 support
hw/sensor: support MAX11615
hw/sensor: support Texas Instruments ADC128D818
MAINTAINERS | 3 +
docs/system/arm/aspeed.rst | 3 +-
include/hw/sensor/adc128d818.h | 23 +
include/hw/sensor/max11615.h | 19 +
hw/arm/aspeed_ast2600_fby4.c | 273 +++++++++++
hw/sensor/adc128d818.c | 433 ++++++++++++++++++
hw/sensor/max11615.c | 322 +++++++++++++
hw/sensor/max31790.c | 556 +++++++++++++++++++++++
hw/arm/Kconfig | 3 +
hw/arm/meson.build | 1 +
hw/sensor/Kconfig | 12 +
hw/sensor/meson.build | 3 +
hw/sensor/trace-events | 30 ++
tests/functional/arm/meson.build | 2 +
tests/functional/arm/test_aspeed_fby4.py | 110 +++++
15 files changed, 1792 insertions(+), 1 deletion(-)
create mode 100644 include/hw/sensor/adc128d818.h
create mode 100644 include/hw/sensor/max11615.h
create mode 100644 hw/arm/aspeed_ast2600_fby4.c
create mode 100644 hw/sensor/adc128d818.c
create mode 100644 hw/sensor/max11615.c
create mode 100644 hw/sensor/max31790.c
create mode 100755 tests/functional/arm/test_aspeed_fby4.py
Cc: Titus Rwantare <titusr@google.com>
Cc: "Cédric Le Goater" <clg@kaod.org> (maintainer:ASPEED BMCs)
Cc: Jonathan Cameron <jonathan.cameron@huawei.com>
--
2.54.0