Skip to contentSkip to conversation

hw/i2c: add pca9543 support to mux

PATCH In review Patrick Venture 1 participant 2 messages Nov 8, 2021 – Nov 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/i2c: add pca9543 support to mux

Adds support for the 2 channel pca9543 i2c switch.

---
 hw/i2c/i2c_mux_pca954x.c         | 12 ++++++++++++
 include/hw/i2c/i2c_mux_pca954x.h |  1 +
 2 files changed, 13 insertions(+)
hw/i2c/i2c_mux_pca954x.c +12 -0
index 847c59921c..36a5c8cb31 100644
@@ -29,6 +29,7 @@
 
 #define PCA9548_CHANNEL_COUNT 8
 #define PCA9546_CHANNEL_COUNT 4
+#define PCA9543_CHANNEL_COUNT 2
 
 /*
  * struct Pca954xChannel - The i2c mux device will have N of these states
@@ -203,6 +204,12 @@ static void pca954x_channel_class_init(ObjectClass *klass, void *data)
     dc->desc = "Pca954x Channel";
 }
 
+static void pca9543_class_init(ObjectClass *klass, void *data)
+{
+    Pca954xClass *s = PCA954X_CLASS(klass);
+    s->nchans = PCA9543_CHANNEL_COUNT;
+}
+
 static void pca9546_class_init(ObjectClass *klass, void *data)
 {
     Pca954xClass *s = PCA954X_CLASS(klass);
@@ -268,6 +275,11 @@ static const TypeInfo pca954x_info[] = {
         .class_init    = pca954x_class_init,
         .abstract      = true,
     },
+    {
+        .name          = TYPE_PCA9543,
+        .parent        = TYPE_PCA954X,
+        .class_init    = pca9543_class_init,
+    },
     {
         .name          = TYPE_PCA9546,
         .parent        = TYPE_PCA954X,
include/hw/i2c/i2c_mux_pca954x.h +1 -0
index 8aaf9bbc39..91e2ffd0a2 100644
@@ -3,6 +3,7 @@
 
 #include "hw/i2c/i2c.h"
 
+#define TYPE_PCA9543 "pca9543"
 #define TYPE_PCA9546 "pca9546"
 #define TYPE_PCA9548 "pca9548"
 
Signature · 1 line
2.34.0.rc0.344.g81b53c2807-goog
#1 lore raw
Quoted 62 lines · Patrick Venture

Adds support for the 2 channel pca9543 i2c switch.

---
 hw/i2c/i2c_mux_pca954x.c         | 12 ++++++++++++
 include/hw/i2c/i2c_mux_pca954x.h |  1 +
 2 files changed, 13 insertions(+)
hw/i2c/i2c_mux_pca954x.c +7 -0
index 847c59921c..36a5c8cb31 100644
@@ -29,6 +29,7 @@
 
 #define PCA9548_CHANNEL_COUNT 8
 #define PCA9546_CHANNEL_COUNT 4
+#define PCA9543_CHANNEL_COUNT 2
 
 /*
  * struct Pca954xChannel - The i2c mux device will have N of these states
@@ -203,6 +204,12 @@ static void pca954x_channel_class_init(ObjectClass
 *klass, void *data)
     dc->desc = "Pca954x Channel";
 }
 
+static void pca9543_class_init(ObjectClass *klass, void *data)
+{
+    Pca954xClass *s = PCA954X_CLASS(klass);
+    s->nchans = PCA9543_CHANNEL_COUNT;
+}
+
 static void pca9546_class_init(ObjectClass *klass, void *data)
 {
     Pca954xClass *s = PCA954X_CLASS(klass);
hw/i2c/i2c_mux_pca954x.c +5 -0
@@ -268,6 +275,11 @@ static const TypeInfo pca954x_info[] = {
         .class_init    = pca954x_class_init,
         .abstract      = true,
     },
+    {
+        .name          = TYPE_PCA9543,
+        .parent        = TYPE_PCA954X,
+        .class_init    = pca9543_class_init,
+    },
     {
         .name          = TYPE_PCA9546,
         .parent        = TYPE_PCA954X,
include/hw/i2c/i2c_mux_pca954x.h +1 -1
index 8aaf9bbc39..91e2ffd0a2 100644
@@ -3,6 +3,7 @@
 
 #include "hw/i2c/i2c.h"
 
+#define TYPE_PCA9543 "pca9543"
 #define TYPE_PCA9546 "pca9546"
 #define TYPE_PCA9548 "pca9548"
 
--

2.34.0.rc0.344.g81b53c2807-goog

Quoted 1 line

Friendly ping. The patch itself is trivial, but let me know if I've

submitted it incorrectly since I also maintain this device.

-Patrick