Skip to content

Commit

Permalink
Merge branch 'i2c-mux/for-next' of https://github.com/peda-r/i2c-mux
Browse files Browse the repository at this point in the history
…into i2c/for-4.12

Pull in changes from the i2c-mux subsubsystem:

"Here are a new LTC4306/5 driver, a fix needed by the RT kernel and some
error message cleanup."
  • Loading branch information
Wolfram Sang committed Apr 16, 2017
2 parents cda816d + dbed8a8 commit 69e620f
Show file tree
Hide file tree
Showing 12 changed files with 421 additions and 30 deletions.
61 changes: 61 additions & 0 deletions Documentation/devicetree/bindings/i2c/i2c-mux-ltc4306.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
* Linear Technology / Analog Devices I2C bus switch

Required Properties:

- compatible: Must contain one of the following.
"lltc,ltc4305", "lltc,ltc4306"
- reg: The I2C address of the device.

The following required properties are defined externally:

- Standard I2C mux properties. See i2c-mux.txt in this directory.
- I2C child bus nodes. See i2c-mux.txt in this directory.

Optional Properties:

- enable-gpios: Reference to the GPIO connected to the enable input.
- i2c-mux-idle-disconnect: Boolean; if defined, forces mux to disconnect all
children in idle state. This is necessary for example, if there are several
multiplexers on the bus and the devices behind them use same I2C addresses.
- gpio-controller: Marks the device node as a GPIO Controller.
- #gpio-cells: Should be two. The first cell is the pin number and
the second cell is used to specify flags.
See ../gpio/gpio.txt for more information.
- ltc,downstream-accelerators-enable: Enables the rise time accelerators
on the downstream port.
- ltc,upstream-accelerators-enable: Enables the rise time accelerators
on the upstream port.

Example:

ltc4306: i2c-mux@4a {
compatible = "lltc,ltc4306";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x4a>;

gpio-controller;
#gpio-cells = <2>;

i2c@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;

eeprom@50 {
compatible = "at,24c02";
reg = <0x50>;
};
};

i2c@1 {
#address-cells = <1>;
#size-cells = <0>;
reg = <1>;

eeprom@50 {
compatible = "at,24c02";
reg = <0x50>;
};
};
};
8 changes: 8 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -7698,6 +7698,14 @@ S: Maintained
F: Documentation/hwmon/ltc4261
F: drivers/hwmon/ltc4261.c

LTC4306 I2C MULTIPLEXER DRIVER
M: Michael Hennerich <michael.hennerich@analog.com>
W: http://ez.analog.com/community/linux-device-drivers
L: linux-i2c@vger.kernel.org
S: Supported
F: drivers/i2c/muxes/i2c-mux-ltc4306.c
F: Documentation/devicetree/bindings/i2c/i2c-mux-ltc4306.txt

LTP (Linux Test Project)
M: Mike Frysinger <vapier@gentoo.org>
M: Cyril Hrubis <chrubis@suse.cz>
Expand Down
9 changes: 6 additions & 3 deletions drivers/i2c/i2c-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,13 +395,16 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,
if (force_nr) {
priv->adap.nr = force_nr;
ret = i2c_add_numbered_adapter(&priv->adap);
dev_err(&parent->dev,
"failed to add mux-adapter %u as bus %u (error=%d)\n",
chan_id, force_nr, ret);
} else {
ret = i2c_add_adapter(&priv->adap);
dev_err(&parent->dev,
"failed to add mux-adapter %u (error=%d)\n",
chan_id, ret);
}
if (ret < 0) {
dev_err(&parent->dev,
"failed to add mux-adapter (error=%d)\n",
ret);
kfree(priv);
return ret;
}
Expand Down
11 changes: 11 additions & 0 deletions drivers/i2c/muxes/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ config I2C_MUX_GPIO
This driver can also be built as a module. If so, the module
will be called i2c-mux-gpio.

config I2C_MUX_LTC4306
tristate "LTC LTC4306/5 I2C multiplexer"
select GPIOLIB
select REGMAP_I2C
help
If you say yes here you get support for the Analog Devices
LTC4306 or LTC4305 I2C mux/switch devices.

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

config I2C_MUX_PCA9541
tristate "NXP PCA9541 I2C Master Selector"
help
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/muxes/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ARB_GPIO_CHALLENGE) += i2c-arb-gpio-challenge.o
obj-$(CONFIG_I2C_DEMUX_PINCTRL) += i2c-demux-pinctrl.o

obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o
obj-$(CONFIG_I2C_MUX_LTC4306) += i2c-mux-ltc4306.o
obj-$(CONFIG_I2C_MUX_MLXCPLD) += i2c-mux-mlxcpld.o
obj-$(CONFIG_I2C_MUX_PCA9541) += i2c-mux-pca9541.o
obj-$(CONFIG_I2C_MUX_PCA954x) += i2c-mux-pca954x.o
Expand Down
4 changes: 1 addition & 3 deletions drivers/i2c/muxes/i2c-arb-gpio-challenge.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,8 @@ static int i2c_arbitrator_probe(struct platform_device *pdev)

/* Actually add the mux adapter */
ret = i2c_mux_add_adapter(muxc, 0, 0, 0);
if (ret) {
dev_err(dev, "Failed to add adapter\n");
if (ret)
i2c_put_adapter(muxc->parent);
}

return ret;
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/i2c/muxes/i2c-mux-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,8 @@ static int i2c_mux_gpio_probe(struct platform_device *pdev)
unsigned int class = mux->data.classes ? mux->data.classes[i] : 0;

ret = i2c_mux_add_adapter(muxc, nr, mux->data.values[i], class);
if (ret) {
dev_err(&pdev->dev, "Failed to add adapter %d\n", i);
if (ret)
goto add_adapter_failed;
}
}

dev_info(&pdev->dev, "%d port mux on %s adapter\n",
Expand Down
Loading

0 comments on commit 69e620f

Please sign in to comment.