* [PATCH] hw/i2c: add pca9543 support to mux
@ 2021-11-08 21:58 Patrick Venture
2021-11-18 17:21 ` Patrick Venture
0 siblings, 1 reply; 2+ messages in thread
From: Patrick Venture @ 2021-11-08 21:58 UTC (permalink / raw)
To: cminyard; +Cc: qemu-arm, qemu-devel, wuhaotsh, Patrick Venture
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hw/i2c: add pca9543 support to mux
2021-11-08 21:58 [PATCH] hw/i2c: add pca9543 support to mux Patrick Venture
@ 2021-11-18 17:21 ` Patrick Venture
0 siblings, 0 replies; 2+ messages in thread
From: Patrick Venture @ 2021-11-18 17:21 UTC (permalink / raw)
To: cminyard; +Cc: qemu-arm, qemu-devel, wuhaotsh
[-- Attachment #1: Type: text/plain, Size: 2076 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 2815 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-18 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 21:58 [PATCH] hw/i2c: add pca9543 support to mux Patrick Venture
2021-11-18 17:21 ` Patrick Venture
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.