diff mbox series

[PATCH-for-10.0,11/12] hw/sensor/temp: Categorize and add description

Message ID 20250325224310.8785-12-philmd@linaro.org
State New
Headers show
Series hw: Categorize few devices and add their descriptions | expand

Commit Message

Philippe Mathieu-Daudé March 25, 2025, 10:43 p.m. UTC
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sensor/dps310.c  | 2 ++
 hw/sensor/emc141x.c | 6 ++++++
 hw/sensor/tmp105.c  | 2 ++
 hw/sensor/tmp421.c  | 4 ++++
 4 files changed, 14 insertions(+)

Comments

Thomas Huth March 26, 2025, 7:11 a.m. UTC | #1
On 25/03/2025 23.43, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/sensor/dps310.c  | 2 ++
>   hw/sensor/emc141x.c | 6 ++++++
>   hw/sensor/tmp105.c  | 2 ++
>   hw/sensor/tmp421.c  | 4 ++++
>   4 files changed, 14 insertions(+)
> 
> diff --git a/hw/sensor/dps310.c b/hw/sensor/dps310.c
> index 6966a53248b..e1e6df6b60a 100644
> --- a/hw/sensor/dps310.c
> +++ b/hw/sensor/dps310.c
> @@ -207,6 +207,8 @@ static void dps310_class_init(ObjectClass *klass, void *data)
>       k->send = dps310_tx;
>       device_class_set_legacy_reset(dc, dps310_reset);
>       dc->vmsd = &vmstate_dps310;
> +    dc->desc = "Infineon DPS310 temperature and humidity sensor";
> +    set_bit(DEVICE_CATEGORY_MISC, dc->categories);

Not necessary - I2C device again.

  Thomas
diff mbox series

Patch

diff --git a/hw/sensor/dps310.c b/hw/sensor/dps310.c
index 6966a53248b..e1e6df6b60a 100644
--- a/hw/sensor/dps310.c
+++ b/hw/sensor/dps310.c
@@ -207,6 +207,8 @@  static void dps310_class_init(ObjectClass *klass, void *data)
     k->send = dps310_tx;
     device_class_set_legacy_reset(dc, dps310_reset);
     dc->vmsd = &vmstate_dps310;
+    dc->desc = "Infineon DPS310 temperature and humidity sensor";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static const TypeInfo dps310_info = {
diff --git a/hw/sensor/emc141x.c b/hw/sensor/emc141x.c
index 33c1bd330fd..6adb94e7ff5 100644
--- a/hw/sensor/emc141x.c
+++ b/hw/sensor/emc141x.c
@@ -280,19 +280,25 @@  static void emc141x_class_init(ObjectClass *klass, const void *data)
 static void emc1413_class_init(ObjectClass *klass, void *data)
 {
     EMC141XClass *ec = EMC141X_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
     emc141x_class_init(klass, data);
     ec->model = EMC1413_DEVICE_ID;
     ec->sensors_count = 3;
+    dc->desc = "SMSC EMC1413 temperature sensor";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static void emc1414_class_init(ObjectClass *klass, void *data)
 {
     EMC141XClass *ec = EMC141X_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
 
     emc141x_class_init(klass, data);
     ec->model = EMC1414_DEVICE_ID;
     ec->sensors_count = 4;
+    dc->desc = "SMSC EMC1414 temperature sensor";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static const TypeInfo emc141x_info = {
diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
index ef2824f3e1b..6a38f2c6670 100644
--- a/hw/sensor/tmp105.c
+++ b/hw/sensor/tmp105.c
@@ -323,6 +323,8 @@  static void tmp105_class_init(ObjectClass *klass, void *data)
     k->recv = tmp105_rx;
     k->send = tmp105_tx;
     dc->vmsd = &vmstate_tmp105;
+    dc->desc = "TI TMP105 temperature sensor";
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
 static const TypeInfo tmp105_info = {
diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c
index 007f7cd018b..ba42ab328e0 100644
--- a/hw/sensor/tmp421.c
+++ b/hw/sensor/tmp421.c
@@ -342,6 +342,7 @@  static void tmp421_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
     TMP421Class *sc = TMP421_CLASS(klass);
+    g_autofree char *name_up = NULL;
 
     dc->realize = tmp421_realize;
     k->event = tmp421_event;
@@ -349,6 +350,9 @@  static void tmp421_class_init(ObjectClass *klass, void *data)
     k->send = tmp421_tx;
     dc->vmsd = &vmstate_tmp421;
     sc->dev = (DeviceInfo *) data;
+    name_up = g_ascii_strup(sc->dev->name, -1);
+    dc->desc = g_strconcat("TI ", name_up, " temperature sensor", NULL);
+    set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 
     object_class_property_add(klass, "temperature0", "int",
                               tmp421_get_temperature,