hw/i2c: add pca9543 i2c-mux switch
PATCH 1/1 hw/i2c: add pca9543 i2c-mux switch
Add pca9543 2-channel i2c-mux switch support.
--- 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
@@ -30,6 +30,7 @@#define PCA9548_CHANNEL_COUNT 8#define PCA9546_CHANNEL_COUNT 4 +#define PCA9543_CHANNEL_COUNT 2/* * struct Pca954xState - The pca954x state object.
@@ -172,6 +173,12 @@ I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_t channel)return pca954x->bus[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);
@@ -246,6 +253,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
@@ -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.31.1
Quoted 4 lines · Potin Lai
Add pca9543 2-channel i2c-mux switch support.
Signed-off-by Potin Lai <[email protected]>
Quoted 60 lines
--- 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@@ -30,6 +30,7 @@#define PCA9548_CHANNEL_COUNT 8#define PCA9546_CHANNEL_COUNT 4 +#define PCA9543_CHANNEL_COUNT 2/* * struct Pca954xState - The pca954x state object. @@ -172,6 +173,12 @@ I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_t channel)return pca954x->bus[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@@ -246,6 +253,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@@ -3,6 +3,7 @@#include "hw/i2c/i2c.h" +#define TYPE_PCA9543 "pca9543"#define TYPE_PCA9546 "pca9546"#define TYPE_PCA9548 "pca9548" --2.31.1
Quoted 3 lines · Potin Lai
Add pca9543 2-channel i2c-mux switch support.
Signed-off-by Potin Lai <[email protected]>
Looks good to me.
Quoted 58 lines
--- 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@@ -30,6 +30,7 @@#define PCA9548_CHANNEL_COUNT 8#define PCA9546_CHANNEL_COUNT 4 +#define PCA9543_CHANNEL_COUNT 2/* * struct Pca954xState - The pca954x state object. @@ -172,6 +173,12 @@ I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_t channel)return pca954x->bus[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);@@ -246,6 +253,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@@ -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.31.1
Quoted 61 lines · Corey Minyard
Quoted 3 lines · Potin Lai
Add pca9543 2-channel i2c-mux switch support.
Signed-off-by Potin Lai <[email protected]>Looks good to me.
Acked-by Corey Minyard <[email protected]>hw/i2c/i2c_mux_pca954x.c I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_t
Quoted 18 lines
--- 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 +1
-0@@ -30,6 +30,7 @@#define PCA9548_CHANNEL_COUNT 8#define PCA9546_CHANNEL_COUNT 4 +#define PCA9543_CHANNEL_COUNT 2/* * struct Pca954xState - The pca954x state object. @@ -172,6 +173,12 @@ I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_tchannel)
Review
Quoted 25 lines
hw/i2c/i2c_mux_pca954x.c +11
-0return pca954x->bus[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);@@ -246,6 +253,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,(quoted diff) +0
-0
b/include/hw/i2c/i2c_mux_pca954x.hQuoted 7 lines
index
3dd25ec983..1da5508ed5100644include/hw/i2c/i2c_mux_pca954x.h +0
-0@@ -3,6 +3,7 @@#include "hw/i2c/i2c.h"
Quoted 8 lines
Quoted 8 lines
include/hw/i2c/i2c_mux_pca954x.h +1
-1+#define TYPE_PCA9543 "pca9543"#define TYPE_PCA9546 "pca9546"#define TYPE_PCA9548 "pca9548" --2.31.1
Corey, can you include this in a pull email? I don't quite have that set up at present, Titus is going to help me figure it out.
Patrick
Quoted 67 lines · Patrick Venture
Quoted 65 lines · Corey Minyard
Quoted 3 lines · Potin Lai
Add pca9543 2-channel i2c-mux switch support.
Signed-off-by Potin Lai <[email protected]>Looks good to me.
Acked-by Corey Minyard <[email protected]>hw/i2c/i2c_mux_pca954x.c I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_t
Quoted 18 lines
--- 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 +1
-0@@ -30,6 +30,7 @@#define PCA9548_CHANNEL_COUNT 8#define PCA9546_CHANNEL_COUNT 4 +#define PCA9543_CHANNEL_COUNT 2/* * struct Pca954xState - The pca954x state object. @@ -172,6 +173,12 @@ I2CBus *pca954x_i2c_get_bus(I2CSlave *mux, uint8_tchannel)
Review
Quoted 25 lines
hw/i2c/i2c_mux_pca954x.c +11
-0return pca954x->bus[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);@@ -246,6 +253,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,(quoted diff) +0
-0
b/include/hw/i2c/i2c_mux_pca954x.hQuoted 11 lines
index
3dd25ec983..1da5508ed5100644include/hw/i2c/i2c_mux_pca954x.h +1
-0@@ -3,6 +3,7 @@#include "hw/i2c/i2c.h" +#define TYPE_PCA9543 "pca9543"#define TYPE_PCA9546 "pca9546"#define TYPE_PCA9548 "pca9548"
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
--
2.31.1Corey, can you include this in a pull email? I don't quite have that set up at present, Titus is going to help me figure it out.
Ok, I'm running tests now, I'll get a pull request in assuming everything is ok.
-corey