qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/i2c: add pca9543 support to mux


From: Patrick Venture
Subject: Re: [PATCH] hw/i2c: add pca9543 support to mux
Date: Thu, 18 Nov 2021 09:21:44 -0800



On Mon, Nov 8, 2021 at 1:58 PM Patrick Venture <venture@google.com> wrote:
Adds support for the 2 channel pca9543 i2c switch.

Signed-off-by: Patrick Venture <venture@google.com>
---
 hw/i2c/i2c_mux_pca954x.c         | 12 ++++++++++++
 include/hw/i2c/i2c_mux_pca954x.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/hw/i2c/i2c_mux_pca954x.c b/hw/i2c/i2c_mux_pca954x.c
index 847c59921c..36a5c8cb31 100644
--- a/hw/i2c/i2c_mux_pca954x.c
+++ b/hw/i2c/i2c_mux_pca954x.c
@@ -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,
diff --git a/include/hw/i2c/i2c_mux_pca954x.h b/include/hw/i2c/i2c_mux_pca954x.h
index 8aaf9bbc39..91e2ffd0a2 100644
--- a/include/hw/i2c/i2c_mux_pca954x.h
+++ b/include/hw/i2c/i2c_mux_pca954x.h
@@ -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

Friendly ping. The patch itself is trivial, but let me know if I've submitted it incorrectly since I also maintain this device.

-Patrick

reply via email to

[Prev in Thread] Current Thread [Next in Thread]