<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/i2c, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-11-29T19:04:21Z</updated>
<entry>
<title>Revert "i2c: octeon: thunderx: Limit register access retries"</title>
<updated>2016-11-29T19:04:21Z</updated>
<author>
<name>Jan Glauber</name>
<email>jglauber@cavium.com</email>
</author>
<published>2016-11-14T18:50:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=dfa2ccc30e6556bd526f54f0e16fc9e5af4293cb'/>
<id>urn:sha1:dfa2ccc30e6556bd526f54f0e16fc9e5af4293cb</id>
<content type='text'>
This reverts commit 70121f7f3725 ("i2c: octeon: thunderx: Limit register access retries").
Using readq_poll_timeout instead of __raw_readq triggers the following
debug warning:

[   78.871568] ipmi_ssif: Trying hotmod-specified SSIF interface at i2c address 0x12, adapter Cavium ThunderX i2c adapter at 0000:01:09.4, slave address 0x0
[   78.886107] do not call blocking ops when !TASK_RUNNING; state=2 set at [&lt;fffffc00080e0088&gt;] prepare_to_wait_event+0x58/0x10c
[   78.897436] ------------[ cut here ]------------
[   78.902050] WARNING: CPU: 6 PID: 2235 at kernel/sched/core.c:7718 __might_sleep+0x80/0x88

[...]

[   79.133553] [&lt;fffffc00080c3aac&gt;] __might_sleep+0x80/0x88
[   79.138862] [&lt;fffffc0000e30138&gt;] octeon_i2c_test_iflg+0x4c/0xbc [i2c_thunderx]
[   79.146077] [&lt;fffffc0000e30958&gt;] octeon_i2c_test_ready+0x18/0x70 [i2c_thunderx]
[   79.153379] [&lt;fffffc0000e30b04&gt;] octeon_i2c_wait+0x154/0x1a4 [i2c_thunderx]
[   79.160334] [&lt;fffffc0000e310bc&gt;] octeon_i2c_xfer+0xf4/0xf60 [i2c_thunderx]

Signed-off-by: Jan Glauber &lt;jglauber@cavium.com&gt;
Acked-by: Steven J. Hill &lt;steven.hill@cavium.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>Revert "i2c: designware: do not disable adapter after transfer"</title>
<updated>2016-11-25T22:23:25Z</updated>
<author>
<name>Jarkko Nikula</name>
<email>jarkko.nikula@linux.intel.com</email>
</author>
<published>2016-11-25T15:22:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=89119f08354b628548118cacd686a7700372ad19'/>
<id>urn:sha1:89119f08354b628548118cacd686a7700372ad19</id>
<content type='text'>
This reverts commit 0317e6c0f1dc1ba86b8d9dccc010c5e77b8355fa.

Srinivas reported recently touchscreen and touchpad stopped working in
Haswell based machine in Linux 4.9-rc series with timeout errors from
i2c_designware:

[   16.508013] i2c_designware INT33C3:00: controller timed out
[   16.508302] i2c_hid i2c-MSFT0001:02: failed to change power setting.
[   17.532016] i2c_designware INT33C3:00: controller timed out
[   18.556022] i2c_designware INT33C3:00: controller timed out
[   18.556315] i2c_hid i2c-ATML1000:00: failed to retrieve report from device.

I managed to reproduce similar errors on another Haswell based machine
where touchscreen initialization fails maybe in every 1/5 - 1/2 boots.
Since root cause for these errors is not clear yet and debugging is
ongoing it's better to revert this commit as we are near to release.

Reported-by: Srinivas Pandruvada &lt;srinivas.pandruvada@linux.intel.com&gt;
Signed-off-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: designware: fix rx fifo depth tracking</title>
<updated>2016-11-24T15:18:15Z</updated>
<author>
<name>Russell King</name>
<email>rmk+kernel@armlinux.org.uk</email>
</author>
<published>2016-11-18T19:40:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4d6d5f1d08d2138dc43b28966eb6200e3db2e623'/>
<id>urn:sha1:4d6d5f1d08d2138dc43b28966eb6200e3db2e623</id>
<content type='text'>
When loading the TX fifo to receive bytes on the I2C bus, we incorrectly
count the number of bytes:

	rx_limit = dev-&gt;rx_fifo_depth - dw_readl(dev, DW_IC_RXFLR);

	while (buf_len &gt; 0 &amp;&amp; tx_limit &gt; 0 &amp;&amp; rx_limit &gt; 0) {
		if (rx_limit - dev-&gt;rx_outstanding &lt;= 0)
			break;
		rx_limit--;
		dev-&gt;rx_outstanding++;
	}

DW_IC_RXFLR indicates how many bytes are available to be read in the
FIFO, dev-&gt;rx_fifo_depth is the FIFO size, and dev-&gt;rx_outstanding is
the number of bytes that we've requested to be read so far, but which
have not been read.

Firstly, increasing dev-&gt;rx_outstanding and decreasing rx_limit and then
comparing them results in each byte consuming "two" bytes in this
tracking, so this is obviously wrong.

Secondly, the number of bytes that _could_ be received into the FIFO at
any time is the number of bytes we have so far requested but not yet
read from the FIFO - in other words dev-&gt;rx_outstanding.

So, in order to request enough bytes to fill the RX FIFO, we need to
request dev-&gt;rx_fifo_depth - dev-&gt;rx_outstanding bytes.

Modifying the code thusly results in us reaching the maximum number of
bytes outstanding each time we queue more "receive" operations, provided
the transfer allows that to happen.

Signed-off-by: Russell King &lt;rmk+kernel@armlinux.org.uk&gt;
Reviewed-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Acked-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: designware: report short transfers</title>
<updated>2016-11-24T15:17:34Z</updated>
<author>
<name>Russell King</name>
<email>rmk+kernel@armlinux.org.uk</email>
</author>
<published>2016-11-18T19:40:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2bf413d56b7de72ab800a6edb009177e5669b929'/>
<id>urn:sha1:2bf413d56b7de72ab800a6edb009177e5669b929</id>
<content type='text'>
Rather than reporting success for a short transfer due to interrupt
latency, report an error both to the caller, as well as to the kernel
log.

Signed-off-by: Russell King &lt;rmk+kernel@armlinux.org.uk&gt;
Reviewed-by: Mika Westerberg &lt;mika.westerberg@linux.intel.com&gt;
Acked-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: i2c-mux-pca954x: fix deselect enabling for device-tree</title>
<updated>2016-11-19T20:49:29Z</updated>
<author>
<name>Alex Hemme</name>
<email>ahemme@cisco.com</email>
</author>
<published>2016-11-19T09:48:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad092de60f865c1ad94221bd06d381ecea446cc8'/>
<id>urn:sha1:ad092de60f865c1ad94221bd06d381ecea446cc8</id>
<content type='text'>
Deselect functionality can be ignored for device-trees with
"i2c-mux-idle-disconnect" entries if no platform_data is available.
By enabling the deselect functionality outside the platform_data
block the logic works as it did in previous kernels.

Fixes: 7fcac9807175 ("i2c: i2c-mux-pca954x: convert to use an explicit i2c mux core")
Cc: &lt;stable@vger.kernel.org&gt; # v4.7+
Signed-off-by: Alex Hemme &lt;ahemme@cisco.com&gt;
Signed-off-by: Ziyang Wu &lt;ziywu@cisco.com&gt;
[touched up a few minor issues /peda]
Signed-off-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: digicolor: use clk_disable_unprepare instead of clk_unprepare</title>
<updated>2016-11-18T00:48:01Z</updated>
<author>
<name>Wei Yongjun</name>
<email>weiyongjun1@huawei.com</email>
</author>
<published>2016-10-29T16:31:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=68d85d0e03eab60c238ebe673c7cea1cf70275d4'/>
<id>urn:sha1:68d85d0e03eab60c238ebe673c7cea1cf70275d4</id>
<content type='text'>
since clk_prepare_enable() is used to get i2c-&gt;clk, we should
use clk_disable_unprepare() to release it for the error path.

Signed-off-by: Wei Yongjun &lt;weiyongjun1@huawei.com&gt;
Acked-by: Baruch Siach &lt;baruch@tkos.co.il&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: mux: fix up dependencies</title>
<updated>2016-11-14T17:23:30Z</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2016-11-14T14:34:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=93d710a65ef02fb7fd48ae207e78f460bd7a6089'/>
<id>urn:sha1:93d710a65ef02fb7fd48ae207e78f460bd7a6089</id>
<content type='text'>
We get the following build error from UM Linux after adding
an entry to drivers/iio/gyro/Kconfig that issues "select I2C_MUX":

ERROR: "devm_ioremap_resource"
   [drivers/i2c/muxes/i2c-mux-reg.ko] undefined!
ERROR: "of_address_to_resource"
   [drivers/i2c/muxes/i2c-mux-reg.ko] undefined!

It appears that the I2C mux core code depends on HAS_IOMEM
for historical reasons, while CONFIG_I2C_MUX_REG does *not*
have a direct dependency on HAS_IOMEM.

This creates a situation where a allyesconfig or allmodconfig
for UM Linux will select I2C_MUX, and will implicitly enable
I2C_MUX_REG as well, and the compilation will fail for the
register driver.

Fix this up by making I2C_MUX_REG depend on HAS_IOMEM and
removing the dependency from I2C_MUX.

Reported-by: kbuild test robot &lt;fengguang.wu@intel.com&gt;
Reported-by: Jonathan Cameron &lt;jic23@jic23.retrosnub.co.uk&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Acked-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Acked-by: Peter Rosin &lt;peda@axentia.se&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>i2c: mux: demux-pinctrl: make drivers with no pinctrl work again</title>
<updated>2016-11-10T20:12:47Z</updated>
<author>
<name>Wolfram Sang</name>
<email>wsa+renesas@sang-engineering.com</email>
</author>
<published>2016-11-06T20:20:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d052db11c153cfb469f13a4121966f30ecb57c66'/>
<id>urn:sha1:d052db11c153cfb469f13a4121966f30ecb57c66</id>
<content type='text'>
Some drivers like i2c-gpio do not have dedicated pinctrl states. They
broke when error checking for pinctrl was added. Detect them now, and in
their case, simply skip over pinctrl configuration.

Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
</entry>
<entry>
<title>i2c: core: fix NULL pointer dereference under race condition</title>
<updated>2016-11-04T19:36:58Z</updated>
<author>
<name>Vladimir Zapolskiy</name>
<email>vladimir_zapolskiy@mentor.com</email>
</author>
<published>2016-10-31T19:46:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=147b36d5b70c083cc76770c47d60b347e8eaf231'/>
<id>urn:sha1:147b36d5b70c083cc76770c47d60b347e8eaf231</id>
<content type='text'>
Race condition between registering an I2C device driver and
deregistering an I2C adapter device which is assumed to manage that
I2C device may lead to a NULL pointer dereference due to the
uninitialized list head of driver clients.

The root cause of the issue is that the I2C bus may know about the
registered device driver and thus it is matched by bus_for_each_drv(),
but the list of clients is not initialized and commonly it is NULL,
because I2C device drivers define struct i2c_driver as static and
clients field is expected to be initialized by I2C core:

  i2c_register_driver()             i2c_del_adapter()
    driver_register()                 ...
      bus_add_driver()                ...
        ...                           bus_for_each_drv(..., __process_removed_adapter)
      ...                               i2c_do_del_adapter()
    ...                                   list_for_each_entry_safe(..., &amp;driver-&gt;clients, ...)
    INIT_LIST_HEAD(&amp;driver-&gt;clients);

To solve the problem it is sufficient to do clients list head
initialization before calling driver_register().

The problem was found while using an I2C device driver with a sluggish
registration routine on a bus provided by a physically detachable I2C
master controller, but practically the oops may be reproduced under
the race between arbitraty I2C device driver registration and managing
I2C bus device removal e.g. by unbinding the latter over sysfs:

% echo 21a4000.i2c &gt; /sys/bus/platform/drivers/imx-i2c/unbind
  Unable to handle kernel NULL pointer dereference at virtual address 00000000
  Internal error: Oops: 17 [#1] SMP ARM
  CPU: 2 PID: 533 Comm: sh Not tainted 4.9.0-rc3+ #61
  Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
  task: e5ada400 task.stack: e4936000
  PC is at i2c_do_del_adapter+0x20/0xcc
  LR is at __process_removed_adapter+0x14/0x1c
  Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
  Control: 10c5387d  Table: 35bd004a  DAC: 00000051
  Process sh (pid: 533, stack limit = 0xe4936210)
  Stack: (0xe4937d28 to 0xe4938000)
  Backtrace:
  [&lt;c0667be0&gt;] (i2c_do_del_adapter) from [&lt;c0667cc0&gt;] (__process_removed_adapter+0x14/0x1c)
  [&lt;c0667cac&gt;] (__process_removed_adapter) from [&lt;c0516998&gt;] (bus_for_each_drv+0x6c/0xa0)
  [&lt;c051692c&gt;] (bus_for_each_drv) from [&lt;c06685ec&gt;] (i2c_del_adapter+0xbc/0x284)
  [&lt;c0668530&gt;] (i2c_del_adapter) from [&lt;bf0110ec&gt;] (i2c_imx_remove+0x44/0x164 [i2c_imx])
  [&lt;bf0110a8&gt;] (i2c_imx_remove [i2c_imx]) from [&lt;c051a838&gt;] (platform_drv_remove+0x2c/0x44)
  [&lt;c051a80c&gt;] (platform_drv_remove) from [&lt;c05183d8&gt;] (__device_release_driver+0x90/0x12c)
  [&lt;c0518348&gt;] (__device_release_driver) from [&lt;c051849c&gt;] (device_release_driver+0x28/0x34)
  [&lt;c0518474&gt;] (device_release_driver) from [&lt;c0517150&gt;] (unbind_store+0x80/0x104)
  [&lt;c05170d0&gt;] (unbind_store) from [&lt;c0516520&gt;] (drv_attr_store+0x28/0x34)
  [&lt;c05164f8&gt;] (drv_attr_store) from [&lt;c0298acc&gt;] (sysfs_kf_write+0x50/0x54)
  [&lt;c0298a7c&gt;] (sysfs_kf_write) from [&lt;c029801c&gt;] (kernfs_fop_write+0x100/0x214)
  [&lt;c0297f1c&gt;] (kernfs_fop_write) from [&lt;c0220130&gt;] (__vfs_write+0x34/0x120)
  [&lt;c02200fc&gt;] (__vfs_write) from [&lt;c0221088&gt;] (vfs_write+0xa8/0x170)
  [&lt;c0220fe0&gt;] (vfs_write) from [&lt;c0221e74&gt;] (SyS_write+0x4c/0xa8)
  [&lt;c0221e28&gt;] (SyS_write) from [&lt;c0108a20&gt;] (ret_fast_syscall+0x0/0x1c)

Signed-off-by: Vladimir Zapolskiy &lt;vladimir_zapolskiy@mentor.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Cc: stable@kernel.org
</content>
</entry>
<entry>
<title>i2c: imx: defer probe if bus recovery GPIOs are not ready</title>
<updated>2016-10-25T10:15:00Z</updated>
<author>
<name>Stefan Agner</name>
<email>stefan@agner.ch</email>
</author>
<published>2016-09-27T00:18:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=533169d164c6b4c8571d0d48779f6ff6be593d72'/>
<id>urn:sha1:533169d164c6b4c8571d0d48779f6ff6be593d72</id>
<content type='text'>
Some SoC might load the GPIO driver after the I2C driver and
using the I2C bus recovery mechanism via GPIOs. In this case
it is crucial to defer probing if the GPIO request functions
do so, otherwise the I2C driver gets loaded without recovery
mechanisms enabled.

Signed-off-by: Stefan Agner &lt;stefan@agner.ch&gt;
Acked-by: Uwe Kleine-König &lt;u.kleine-koenig@pengutronix.de&gt;
Acked-by: Li Yang &lt;leoyang.li@nxp.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Cc: stable@kernel.org
</content>
</entry>
</feed>
