Skip to content

Commit 8169443

Browse files
PatrickRudolphwsakernel
authored andcommitted
i2c: muxes: pca954x: Add MAX735x/MAX736x support
Add support for the following Maxim chips using the existing PCA954x driver: - MAX7356 - MAX7357 - MAX7358 - MAX7367 - MAX7368 - MAX7369 All added Maxim chips behave like the PCA954x, where a single SMBUS byte write selects up to 8 channels to be bridged to the primary bus. While the MAX7357/MAX7358 have interrupt support, they don't act as interrupt controller like the PCA9545 does. Thus don't enable IRQ support and handle them like the PCA9548. Tested using the MAX7357. Signed-off-by: Patrick Rudolph <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Acked-by: Peter Rosin <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent dde2c69 commit 8169443

File tree

2 files changed

+69
-4
lines changed

2 files changed

+69
-4
lines changed

drivers/i2c/muxes/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ config I2C_MUX_PCA9541
6565
will be called i2c-mux-pca9541.
6666

6767
config I2C_MUX_PCA954x
68-
tristate "NXP PCA954x and PCA984x I2C Mux/switches"
68+
tristate "NXP PCA954x/PCA984x and Maxim MAX735x/MAX736x I2C Mux/switches"
6969
depends on GPIOLIB || COMPILE_TEST
7070
help
71-
If you say yes here you get support for the NXP PCA954x
72-
and PCA984x I2C mux/switch devices.
71+
If you say yes here you get support for NXP PCA954x/PCA984x
72+
and Maxim MAX735x/MAX736x I2C mux/switch devices.
7373

7474
This driver can also be built as a module. If so, the module
7575
will be called i2c-mux-pca954x.

drivers/i2c/muxes/i2c-mux-pca954x.c

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
* PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547,
1212
* PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849.
1313
*
14+
* It's also compatible to Maxims MAX735x I2C switch chips, which are controlled
15+
* as the NXP PCA9548 and the MAX736x chips that act like the PCA9544.
16+
*
17+
* This includes the:
18+
* MAX7356, MAX7357, MAX7358, MAX7367, MAX7368 and MAX7369
19+
*
1420
* These chips are all controlled via the I2C bus itself, and all have a
1521
* single 8-bit register. The upstream "parent" bus fans out to two,
1622
* four, or eight downstream busses or channels; which of these
@@ -51,6 +57,12 @@
5157
#define PCA954X_IRQ_OFFSET 4
5258

5359
enum pca_type {
60+
max_7356,
61+
max_7357,
62+
max_7358,
63+
max_7367,
64+
max_7368,
65+
max_7369,
5466
pca_9540,
5567
pca_9542,
5668
pca_9543,
@@ -90,8 +102,49 @@ struct pca954x {
90102
raw_spinlock_t lock;
91103
};
92104

93-
/* Provide specs for the PCA954x types we know about */
105+
/* Provide specs for the MAX735x, PCA954x and PCA984x types we know about */
94106
static const struct chip_desc chips[] = {
107+
[max_7356] = {
108+
.nchans = 8,
109+
.muxtype = pca954x_isswi,
110+
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
111+
},
112+
[max_7357] = {
113+
.nchans = 8,
114+
.muxtype = pca954x_isswi,
115+
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
116+
/*
117+
* No interrupt controller support. The interrupt
118+
* provides information about stuck channels.
119+
*/
120+
},
121+
[max_7358] = {
122+
.nchans = 8,
123+
.muxtype = pca954x_isswi,
124+
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
125+
/*
126+
* No interrupt controller support. The interrupt
127+
* provides information about stuck channels.
128+
*/
129+
},
130+
[max_7367] = {
131+
.nchans = 4,
132+
.muxtype = pca954x_isswi,
133+
.has_irq = 1,
134+
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
135+
},
136+
[max_7368] = {
137+
.nchans = 4,
138+
.muxtype = pca954x_isswi,
139+
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
140+
},
141+
[max_7369] = {
142+
.nchans = 4,
143+
.enable = 0x4,
144+
.muxtype = pca954x_ismux,
145+
.has_irq = 1,
146+
.id = { .manufacturer_id = I2C_DEVICE_ID_NONE },
147+
},
95148
[pca_9540] = {
96149
.nchans = 2,
97150
.enable = 0x4,
@@ -177,6 +230,12 @@ static const struct chip_desc chips[] = {
177230
};
178231

179232
static const struct i2c_device_id pca954x_id[] = {
233+
{ "max7356", max_7356 },
234+
{ "max7357", max_7357 },
235+
{ "max7358", max_7358 },
236+
{ "max7367", max_7367 },
237+
{ "max7368", max_7368 },
238+
{ "max7369", max_7369 },
180239
{ "pca9540", pca_9540 },
181240
{ "pca9542", pca_9542 },
182241
{ "pca9543", pca_9543 },
@@ -194,6 +253,12 @@ static const struct i2c_device_id pca954x_id[] = {
194253
MODULE_DEVICE_TABLE(i2c, pca954x_id);
195254

196255
static const struct of_device_id pca954x_of_match[] = {
256+
{ .compatible = "maxim,max7356", .data = &chips[max_7356] },
257+
{ .compatible = "maxim,max7357", .data = &chips[max_7357] },
258+
{ .compatible = "maxim,max7358", .data = &chips[max_7358] },
259+
{ .compatible = "maxim,max7367", .data = &chips[max_7367] },
260+
{ .compatible = "maxim,max7368", .data = &chips[max_7368] },
261+
{ .compatible = "maxim,max7369", .data = &chips[max_7369] },
197262
{ .compatible = "nxp,pca9540", .data = &chips[pca_9540] },
198263
{ .compatible = "nxp,pca9542", .data = &chips[pca_9542] },
199264
{ .compatible = "nxp,pca9543", .data = &chips[pca_9543] },

0 commit comments

Comments
 (0)