Skip to content

Commit 50d438f

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Some I2C driver bugfixes (and one documentation fix)" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: i2c-mux-pca954x: fix deselect enabling for device-tree i2c: digicolor: use clk_disable_unprepare instead of clk_unprepare i2c: mux: fix up dependencies i2c: Documentation: i2c-topology: fix minor whitespace nit i2c: mux: demux-pinctrl: make drivers with no pinctrl work again
2 parents dce9ce3 + ad092de commit 50d438f

File tree

6 files changed

+26
-8
lines changed

6 files changed

+26
-8
lines changed

Documentation/i2c/i2c-topology

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ Two parent-locked sibling muxes
326326

327327
This is a good topology.
328328

329-
.--------.
329+
.--------.
330330
.----------. .--| dev D1 |
331331
| parent- |--' '--------'
332332
.--| locked | .--------.
@@ -350,7 +350,7 @@ Mux-locked and parent-locked sibling muxes
350350

351351
This is a good topology.
352352

353-
.--------.
353+
.--------.
354354
.----------. .--| dev D1 |
355355
| mux- |--' '--------'
356356
.--| locked | .--------.

drivers/i2c/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ config I2C_CHARDEV
5959

6060
config I2C_MUX
6161
tristate "I2C bus multiplexing support"
62-
depends on HAS_IOMEM
6362
help
6463
Say Y here if you want the I2C core to support the ability to
6564
handle multiplexed I2C bus topologies, by presenting each

drivers/i2c/busses/i2c-digicolor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ static int dc_i2c_probe(struct platform_device *pdev)
347347

348348
ret = i2c_add_adapter(&i2c->adap);
349349
if (ret < 0) {
350-
clk_unprepare(i2c->clk);
350+
clk_disable_unprepare(i2c->clk);
351351
return ret;
352352
}
353353

drivers/i2c/muxes/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ config I2C_MUX_PINCTRL
6363

6464
config I2C_MUX_REG
6565
tristate "Register-based I2C multiplexer"
66+
depends on HAS_IOMEM
6667
help
6768
If you say yes to this option, support will be included for a
6869
register based I2C multiplexer. This driver provides access to

drivers/i2c/muxes/i2c-demux-pinctrl.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,28 @@ static int i2c_demux_activate_master(struct i2c_demux_pinctrl_priv *priv, u32 ne
6969
goto err_with_revert;
7070
}
7171

72-
p = devm_pinctrl_get_select(adap->dev.parent, priv->bus_name);
72+
/*
73+
* Check if there are pinctrl states at all. Note: we cant' use
74+
* devm_pinctrl_get_select() because we need to distinguish between
75+
* the -ENODEV from devm_pinctrl_get() and pinctrl_lookup_state().
76+
*/
77+
p = devm_pinctrl_get(adap->dev.parent);
7378
if (IS_ERR(p)) {
7479
ret = PTR_ERR(p);
75-
goto err_with_put;
80+
/* continue if just no pinctrl states (e.g. i2c-gpio), otherwise exit */
81+
if (ret != -ENODEV)
82+
goto err_with_put;
83+
} else {
84+
/* there are states. check and use them */
85+
struct pinctrl_state *s = pinctrl_lookup_state(p, priv->bus_name);
86+
87+
if (IS_ERR(s)) {
88+
ret = PTR_ERR(s);
89+
goto err_with_put;
90+
}
91+
ret = pinctrl_select_state(p, s);
92+
if (ret < 0)
93+
goto err_with_put;
7694
}
7795

7896
priv->chan[new_chan].parent_adap = adap;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ static int pca954x_probe(struct i2c_client *client,
268268
/* discard unconfigured channels */
269269
break;
270270
idle_disconnect_pd = pdata->modes[num].deselect_on_exit;
271-
data->deselect |= (idle_disconnect_pd
272-
|| idle_disconnect_dt) << num;
273271
}
272+
data->deselect |= (idle_disconnect_pd ||
273+
idle_disconnect_dt) << num;
274274

275275
ret = i2c_mux_add_adapter(muxc, force, num, class);
276276

0 commit comments

Comments
 (0)