diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2021-07-11 14:32:49 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-07-11 14:32:49 +0100 |
commit | 9516034d05a8c71ef157a59f525e4c4f7ed79827 (patch) | |
tree | 7bffa57da71fec0e63a49691182852633e988145 /include/hw/sensor | |
parent | 3cfcc329afd99138e654b65f6f49156fca2e8cdd (diff) | |
parent | 7649086f455fe44bd076828749a93ab2a5bb0806 (diff) |
Merge remote-tracking branch 'remotes/cminyard/tags/for-qemu-6.1-2' into staging
Some qemu updates for IPMI and I2C
Move some ADC file to where they belong and move some sensors to a
sensor directory, since with new BMCs coming in lots of different
sensors should be coming in. Keep from cluttering things up.
Add support for I2C PMBus devices.
Replace the confusing and error-prone i2c_send_recv and i2c_transfer with
specific send and receive functions. Several errors have already been
made with these, avoid any new errors.
Fix the watchdog_expired field in the IPMI watchdog, it's not a bool,
it's a u8. After a vmstate transfer, the new value could be wrong.
# gpg: Signature made Fri 09 Jul 2021 17:25:04 BST
# gpg: using RSA key FD0D5CE67CE0F59A6688268661F38C90919BFF81
# gpg: Good signature from "Corey Minyard <cminyard@mvista.com>" [unknown]
# gpg: aka "Corey Minyard <minyard@acm.org>" [unknown]
# gpg: aka "Corey Minyard <corey@minyard.net>" [unknown]
# gpg: aka "Corey Minyard <minyard@mvista.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: FD0D 5CE6 7CE0 F59A 6688 2686 61F3 8C90 919B FF81
* remotes/cminyard/tags/for-qemu-6.1-2: (24 commits)
tests/qtest: add tests for MAX34451 device model
hw/misc: add MAX34451 device
tests/qtest: add tests for ADM1272 device model
hw/misc: add ADM1272 device
hw/i2c: add support for PMBus
ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct
hw/i2c: Introduce i2c_start_recv() and i2c_start_send()
hw/i2c: Extract i2c_do_start_transfer() from i2c_start_transfer()
hw/i2c: Make i2c_start_transfer() direction argument a boolean
hw/i2c: Rename i2c_set_slave_address() -> i2c_slave_set_address()
hw/i2c: Remove confusing i2c_send_recv()
hw/misc/auxbus: Replace i2c_send_recv() by i2c_recv() & i2c_send()
hw/misc/auxbus: Replace 'is_write' boolean by its value
hw/misc/auxbus: Explode READ_I2C / WRITE_I2C_MOT cases
hw/misc/auxbus: Fix MOT/classic I2C mode
hw/i2c/ppc4xx_i2c: Replace i2c_send_recv() by i2c_recv() & i2c_send()
hw/i2c/ppc4xx_i2c: Add reference to datasheet
hw/display/sm501: Replace i2c_send_recv() by i2c_recv() & i2c_send()
hw/display/sm501: Simplify sm501_i2c_write() logic
hw/input/lm832x: Define TYPE_LM8323 in public header
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'include/hw/sensor')
-rw-r--r-- | include/hw/sensor/emc141x_regs.h | 37 | ||||
-rw-r--r-- | include/hw/sensor/tmp105.h | 55 | ||||
-rw-r--r-- | include/hw/sensor/tmp105_regs.h | 51 |
3 files changed, 143 insertions, 0 deletions
diff --git a/include/hw/sensor/emc141x_regs.h b/include/hw/sensor/emc141x_regs.h new file mode 100644 index 0000000000..0560fb7c5c --- /dev/null +++ b/include/hw/sensor/emc141x_regs.h @@ -0,0 +1,37 @@ +/* + * SMSC EMC141X temperature sensor. + * + * Browse the data sheet: + * + * http://ww1.microchip.com/downloads/en/DeviceDoc/20005274A.pdf + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#ifndef TMP105_REGS_H +#define TMP105_REGS_H + +#define EMC1413_DEVICE_ID 0x21 +#define EMC1414_DEVICE_ID 0x25 +#define MANUFACTURER_ID 0x5d +#define REVISION 0x04 + +/* the EMC141X registers */ +#define EMC141X_TEMP_HIGH0 0x00 +#define EMC141X_TEMP_HIGH1 0x01 +#define EMC141X_TEMP_HIGH2 0x23 +#define EMC141X_TEMP_HIGH3 0x2a +#define EMC141X_TEMP_MAX_HIGH0 0x05 +#define EMC141X_TEMP_MIN_HIGH0 0x06 +#define EMC141X_TEMP_MAX_HIGH1 0x07 +#define EMC141X_TEMP_MIN_HIGH1 0x08 +#define EMC141X_TEMP_MAX_HIGH2 0x15 +#define EMC141X_TEMP_MIN_HIGH2 0x16 +#define EMC141X_TEMP_MAX_HIGH3 0x2c +#define EMC141X_TEMP_MIN_HIGH3 0x2d +#define EMC141X_DEVICE_ID 0xfd +#define EMC141X_MANUFACTURER_ID 0xfe +#define EMC141X_REVISION 0xff + +#endif diff --git a/include/hw/sensor/tmp105.h b/include/hw/sensor/tmp105.h new file mode 100644 index 0000000000..244e2989fe --- /dev/null +++ b/include/hw/sensor/tmp105.h @@ -0,0 +1,55 @@ +/* + * Texas Instruments TMP105 Temperature Sensor + * + * Browse the data sheet: + * + * http://www.ti.com/lit/gpn/tmp105 + * + * Copyright (C) 2012 Alex Horn <alex.horn@cs.ox.ac.uk> + * Copyright (C) 2008-2012 Andrzej Zaborowski <balrogg@gmail.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ +#ifndef QEMU_TMP105_H +#define QEMU_TMP105_H + +#include "hw/i2c/i2c.h" +#include "hw/sensor/tmp105_regs.h" +#include "qom/object.h" + +#define TYPE_TMP105 "tmp105" +OBJECT_DECLARE_SIMPLE_TYPE(TMP105State, TMP105) + +/** + * TMP105State: + * @config: Bits 5 and 6 (value 32 and 64) determine the precision of the + * temperature. See Table 8 in the data sheet. + * + * @see_also: http://www.ti.com/lit/gpn/tmp105 + */ +struct TMP105State { + /*< private >*/ + I2CSlave i2c; + /*< public >*/ + + uint8_t len; + uint8_t buf[2]; + qemu_irq pin; + + uint8_t pointer; + uint8_t config; + int16_t temperature; + int16_t limit[2]; + int faults; + uint8_t alarm; + /* + * The TMP105 initially looks for a temperature rising above T_high; + * once this is detected, the condition it looks for next is the + * temperature falling below T_low. This flag is false when initially + * looking for T_high, true when looking for T_low. + */ + bool detect_falling; +}; + +#endif diff --git a/include/hw/sensor/tmp105_regs.h b/include/hw/sensor/tmp105_regs.h new file mode 100644 index 0000000000..ef015ee5cf --- /dev/null +++ b/include/hw/sensor/tmp105_regs.h @@ -0,0 +1,51 @@ +/* + * Texas Instruments TMP105 Temperature Sensor I2C messages + * + * Browse the data sheet: + * + * http://www.ti.com/lit/gpn/tmp105 + * + * Copyright (C) 2012 Alex Horn <alex.horn@cs.ox.ac.uk> + * Copyright (C) 2008-2012 Andrzej Zaborowski <balrogg@gmail.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or + * later. See the COPYING file in the top-level directory. + */ + +#ifndef TMP105_REGS_H +#define TMP105_REGS_H + +/** + * TMP105Reg: + * @TMP105_REG_TEMPERATURE: Temperature register + * @TMP105_REG_CONFIG: Configuration register + * @TMP105_REG_T_LOW: Low temperature register (also known as T_hyst) + * @TMP105_REG_T_HIGH: High temperature register (also known as T_OS) + * + * The following temperature sensors are + * compatible with the TMP105 registers: + * - adt75 + * - ds1775 + * - ds75 + * - lm75 + * - lm75a + * - max6625 + * - max6626 + * - mcp980x + * - stds75 + * - tcn75 + * - tmp100 + * - tmp101 + * - tmp105 + * - tmp175 + * - tmp275 + * - tmp75 + **/ +typedef enum TMP105Reg { + TMP105_REG_TEMPERATURE = 0, + TMP105_REG_CONFIG, + TMP105_REG_T_LOW, + TMP105_REG_T_HIGH, +} TMP105Reg; + +#endif |