Skip to contentSkip to conversation

misc/pca9552: Fix for pca9552 not getting reset

PATCH Superseded Glenn Miles 1 participant 1 message Oct 5, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc/pca9552: Fix for pca9552 not getting reset

Testing of the pca9552 device on the powernv platform showed that the reset method was not being called when an instance of the device was realized. This was causing the INPUT0/INPUT1 POR values to be incorrect.

Fixed by calling pca9552_reset from within the pca9552_realize method.

---
 hw/misc/pca9552.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
hw/misc/pca9552.c +7 -1
index f28b5ecd7e..4e198af137 100644
@@ -418,6 +418,12 @@ static void pca955x_realize(DeviceState *dev, Error **errp)
     qdev_init_gpio_in(dev, pca955x_gpio_in_handler, k->pin_count);
 }
 
+static void pca9552_realize(DeviceState *dev, Error **errp)
+{
+    pca955x_realize(dev, errp);
+    pca9552_reset(dev);
+}
+
 static Property pca955x_properties[] = {
     DEFINE_PROP_STRING("description", PCA955xState, description),
     DEFINE_PROP_END_OF_LIST(),
@@ -450,7 +456,7 @@ static void pca9552_class_init(ObjectClass *oc, void *data)
     DeviceClass *dc = DEVICE_CLASS(oc);
     PCA955xClass *pc = PCA955X_CLASS(oc);
 
-    dc->reset = pca9552_reset;
+    dc->realize = pca9552_realize;
     dc->vmsd = &pca9552_vmstate;
     pc->max_reg = PCA9552_LS3;
     pc->pin_count = 16;
Signature · 1 line
2.31.1