<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers/i2c/i2c-mux.c, branch v4.14</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>i2c: mux: only print failure message on error</title>
<updated>2017-05-15T16:49:11+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2017-05-15T07:03:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9fce894d03a98ec8e8e8106a964644633d2772ee'/>
<id>9fce894d03a98ec8e8e8106a964644633d2772ee</id>
<content type='text'>
As is, a failure message is printed unconditionally, which is confusing.
And noisy.

Fixes: 8d4d159f25a7 ("i2c: mux: provide more info on failure in i2c_mux_add_adapter")
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As is, a failure message is printed unconditionally, which is confusing.
And noisy.

Fixes: 8d4d159f25a7 ("i2c: mux: provide more info on failure in i2c_mux_add_adapter")
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: mux: provide more info on failure in i2c_mux_add_adapter</title>
<updated>2017-04-03T12:07:31+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2017-04-03T07:28:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8d4d159f25a79bdaf1f8ae5536471ba9b26b26c2'/>
<id>8d4d159f25a79bdaf1f8ae5536471ba9b26b26c2</id>
<content type='text'>
No callers then need to report any further info, thus reducing both the
amount of code and the log noise.

Reviewed-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
No callers then need to report any further info, thus reducing both the
amount of code and the log noise.

Reviewed-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: add missing of_node_put in i2c_mux_del_adapters</title>
<updated>2017-03-03T09:50:28+00:00</updated>
<author>
<name>Qi Hou</name>
<email>qi.hou@windriver.com</email>
</author>
<published>2017-03-03T07:57:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=2e1e4949f9dfb053122785cd73540bb1e61f768b'/>
<id>2e1e4949f9dfb053122785cd73540bb1e61f768b</id>
<content type='text'>
Refcount of of_node is increased with of_node_get() in i2c_mux_add_adapter().
It must be decreased with of_node_put() in i2c_mux_del_adapters().

Cc: stable@vger.kernel.org
Signed-off-by: Qi Hou &lt;qi.hou@windriver.com&gt;
Reviewed-by: Zhang Xiao &lt;xiao.zhang@windriver.com&gt;
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refcount of of_node is increased with of_node_get() in i2c_mux_add_adapter().
It must be decreased with of_node_put() in i2c_mux_del_adapters().

Cc: stable@vger.kernel.org
Signed-off-by: Qi Hou &lt;qi.hou@windriver.com&gt;
Reviewed-by: Zhang Xiao &lt;xiao.zhang@windriver.com&gt;
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: move locking operations to their own struct</title>
<updated>2016-08-30T20:56:14+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2016-08-25T21:07:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=d1ed7985b9a6b85ea38a330108c51ec83381c01b'/>
<id>d1ed7985b9a6b85ea38a330108c51ec83381c01b</id>
<content type='text'>
This makes it trivial to constify them, so do that.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes it trivial to constify them, so do that.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Acked-by: Daniel Vetter &lt;daniel.vetter@ffwll.ch&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge branch 'i2c-mux-dt-3' of https://github.com/peda-r/i2c-mux into i2c/for-4.9</title>
<updated>2016-08-25T22:49:37+00:00</updated>
<author>
<name>Wolfram Sang</name>
<email>wsa@the-dreams.de</email>
</author>
<published>2016-08-25T22:49:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6d54f1446dbe1c595e8af2e750d0e82c6697c936'/>
<id>6d54f1446dbe1c595e8af2e750d0e82c6697c936</id>
<content type='text'>
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: mux: add support for 'i2c-mux', 'i2c-arb' and 'i2c-gate' DT subnodes</title>
<updated>2016-08-25T20:11:02+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2016-07-09T19:53:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b2d57b56047b99f2992fc958d7ac5ead283e9088'/>
<id>b2d57b56047b99f2992fc958d7ac5ead283e9088</id>
<content type='text'>
Backwards compatibility is preserved; the subnodes are in practice
optional.

However, the mux core needs to know what subnode it should examine, so add
a couple of new flags for i2c_mux_alloc for this purpose.

The rule is that if the mux core finds a 'reg' property in the appropriate
subnode, e.g. if 'reg' exists in the 'i2c-mux' subnode, then the mux core
will assume that this is an old style entry and not an i2c-mux subnode
(correspondingly for arbitrators and gates with 'i2c-arb' and 'i2c-gate').

Reviewed-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Backwards compatibility is preserved; the subnodes are in practice
optional.

However, the mux core needs to know what subnode it should examine, so add
a couple of new flags for i2c_mux_alloc for this purpose.

The rule is that if the mux core finds a 'reg' property in the appropriate
subnode, e.g. if 'reg' exists in the 'i2c-mux' subnode, then the mux core
will assume that this is an old style entry and not an i2c-mux subnode
(correspondingly for arbitrators and gates with 'i2c-arb' and 'i2c-gate').

Reviewed-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: add i2c_trylock_bus wrapper, use it</title>
<updated>2016-08-25T16:02:14+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2016-06-29T13:04:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fb79e09a74faf39fbeee975e0ead442b7b7f6aac'/>
<id>fb79e09a74faf39fbeee975e0ead442b7b7f6aac</id>
<content type='text'>
This unifies usage with i2c_lock_bus and i2c_unlock_bus, and paves the
way for the next patch which looks a bit saner with this preparatory
work taken care of beforehand.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This unifies usage with i2c_lock_bus and i2c_unlock_bus, and paves the
way for the next patch which looks a bit saner with this preparatory
work taken care of beforehand.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: mux: relax locking of the top i2c adapter during mux-locked muxing</title>
<updated>2016-05-04T20:39:17+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2016-05-04T20:15:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6ef91fcca8a8ba3df9810a4cc6cd6a9d3f21bf45'/>
<id>6ef91fcca8a8ba3df9810a4cc6cd6a9d3f21bf45</id>
<content type='text'>
With a i2c topology like the following

                       GPIO ---|  ------ BAT1
                        |      v /
   I2C  -----+----------+---- MUX
             |                   \
           EEPROM                 ------ BAT2

there is a locking problem with the GPIO controller since it is a client
on the same i2c bus that it muxes. Transfers to the mux clients (e.g. BAT1)
will lock the whole i2c bus prior to attempting to switch the mux to the
correct i2c segment. In the above case, the GPIO device is an I/O expander
with an i2c interface, and since the GPIO subsystem knows nothing (and
rightfully so) about the lockless needs of the i2c mux code, this results
in a deadlock when the GPIO driver issues i2c transfers to modify the
mux.

So, observing that while it is needed to have the i2c bus locked during the
actual MUX update in order to avoid random garbage on the slave side, it
is not strictly a must to have it locked over the whole sequence of a full
select-transfer-deselect mux client operation. The mux itself needs to be
locked, so transfers to clients behind the mux are serialized, and the mux
needs to be stable during all i2c traffic (otherwise individual mux slave
segments might see garbage, or worse).

Introduce this new locking concept as "mux-locked" muxes, and call the
pre-existing mux locking scheme "parent-locked".

Modify the i2c mux locking so that muxes that are "mux-locked" locks only
the muxes on the parent adapter instead of the whole i2c bus when there is
a transfer to the slave side of the mux. This lock serializes transfers to
the slave side of the muxes on the parent adapter.

Add code to i2c-mux-gpio and i2c-mux-pinctrl that checks if all involved
gpio/pinctrl devices have a parent that is an i2c adapter in the same
adapter tree that is muxed, and request a "mux-locked mux" if that is the
case.

Modify the select-transfer-deselect code for "mux-locked" muxes so
that each of the select-transfer-deselect ops locks the mux parent
adapter individually.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With a i2c topology like the following

                       GPIO ---|  ------ BAT1
                        |      v /
   I2C  -----+----------+---- MUX
             |                   \
           EEPROM                 ------ BAT2

there is a locking problem with the GPIO controller since it is a client
on the same i2c bus that it muxes. Transfers to the mux clients (e.g. BAT1)
will lock the whole i2c bus prior to attempting to switch the mux to the
correct i2c segment. In the above case, the GPIO device is an I/O expander
with an i2c interface, and since the GPIO subsystem knows nothing (and
rightfully so) about the lockless needs of the i2c mux code, this results
in a deadlock when the GPIO driver issues i2c transfers to modify the
mux.

So, observing that while it is needed to have the i2c bus locked during the
actual MUX update in order to avoid random garbage on the slave side, it
is not strictly a must to have it locked over the whole sequence of a full
select-transfer-deselect mux client operation. The mux itself needs to be
locked, so transfers to clients behind the mux are serialized, and the mux
needs to be stable during all i2c traffic (otherwise individual mux slave
segments might see garbage, or worse).

Introduce this new locking concept as "mux-locked" muxes, and call the
pre-existing mux locking scheme "parent-locked".

Modify the i2c mux locking so that muxes that are "mux-locked" locks only
the muxes on the parent adapter instead of the whole i2c bus when there is
a transfer to the slave side of the mux. This lock serializes transfers to
the slave side of the muxes on the parent adapter.

Add code to i2c-mux-gpio and i2c-mux-pinctrl that checks if all involved
gpio/pinctrl devices have a parent that is an i2c adapter in the same
adapter tree that is muxed, and request a "mux-locked mux" if that is the
case.

Modify the select-transfer-deselect code for "mux-locked" muxes so
that each of the select-transfer-deselect ops locks the mux parent
adapter individually.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: muxes always lock the parent adapter</title>
<updated>2016-05-04T20:28:31+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2016-05-04T20:15:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fa96f0cb9b37a1a296d18f7bde63b0910852303e'/>
<id>fa96f0cb9b37a1a296d18f7bde63b0910852303e</id>
<content type='text'>
Instead of checking for i2c parent adapters for every lock/unlock, simply
override the locking for muxes to always lock/unlock the parent adapter
directly.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead of checking for i2c parent adapters for every lock/unlock, simply
override the locking for muxes to always lock/unlock the parent adapter
directly.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: mux: drop old unused i2c-mux api</title>
<updated>2016-04-22T13:00:19+00:00</updated>
<author>
<name>Peter Rosin</name>
<email>peda@axentia.se</email>
</author>
<published>2016-03-02T14:14:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=23fe440c59b9f08afe108e7ec7b6714cb2a3b955'/>
<id>23fe440c59b9f08afe108e7ec7b6714cb2a3b955</id>
<content type='text'>
All i2c mux users are using an explicit i2c mux core, drop support
for implicit i2c mux cores.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
All i2c mux users are using an explicit i2c mux core, drop support
for implicit i2c mux cores.

Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
</feed>
