<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/drivers/i2c, branch v5.3.8</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630</title>
<updated>2019-10-11T16:36:48+00:00</updated>
<author>
<name>Lee Jones</name>
<email>lee.jones@linaro.org</email>
</author>
<published>2019-09-05T19:24:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=d6b8b9e651fc502542b61e067bb97aac3901828f'/>
<id>d6b8b9e651fc502542b61e067bb97aac3901828f</id>
<content type='text'>
[ Upstream commit 127068abe85bf3dee50df51cb039a5a987a4a666 ]

We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
a rather horrific bug.  When I2C HID devices are being scanned for at
boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
When it does, the laptop reboots and the user never sees the OS.

Attempts are being made to debug the reason for the spontaneous reboot.
No luck so far, hence the requirement for this hot-fix.  This workaround
will be removed once we have a viable fix.

Signed-off-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Tested-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 127068abe85bf3dee50df51cb039a5a987a4a666 ]

We have a production-level laptop (Lenovo Yoga C630) which is exhibiting
a rather horrific bug.  When I2C HID devices are being scanned for at
boot-time the QCom Geni based I2C (Serial Engine) attempts to use DMA.
When it does, the laptop reboots and the user never sees the OS.

Attempts are being made to debug the reason for the spontaneous reboot.
No luck so far, hence the requirement for this hot-fix.  This workaround
will be removed once we have a viable fix.

Signed-off-by: Lee Jones &lt;lee.jones@linaro.org&gt;
Tested-by: Bjorn Andersson &lt;bjorn.andersson@linaro.org&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: tegra: Move suspend handling to NOIRQ phase</title>
<updated>2019-10-07T17:01:40+00:00</updated>
<author>
<name>Jon Hunter</name>
<email>jonathanh@nvidia.com</email>
</author>
<published>2019-09-10T09:29:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=de8d059ffbd669ca00311548b8851341eb89ee5f'/>
<id>de8d059ffbd669ca00311548b8851341eb89ee5f</id>
<content type='text'>
[ Upstream commit 8ebf15e9c869e764b3aab4928938ee68c0e2bd6d ]

Commit acc8abcb2a9c ("i2c: tegra: Add suspend-resume support") added
suspend support for the Tegra I2C driver and following this change on
Tegra30 the following WARNING is seen on entering suspend ...

 WARNING: CPU: 2 PID: 689 at /dvs/git/dirty/git-master_l4t-upstream/kernel/drivers/i2c/i2c-core.h:54 __i2c_transfer+0x35c/0x70c
 i2c i2c-4: Transfer while suspended
 Modules linked in: brcmfmac brcmutil
 CPU: 2 PID: 689 Comm: rtcwake Not tainted 5.3.0-rc7-g089cf7f6ecb2 #1
 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
 [&lt;c0112264&gt;] (unwind_backtrace) from [&lt;c010ca94&gt;] (show_stack+0x10/0x14)
 [&lt;c010ca94&gt;] (show_stack) from [&lt;c0a77024&gt;] (dump_stack+0xb4/0xc8)
 [&lt;c0a77024&gt;] (dump_stack) from [&lt;c0124198&gt;] (__warn+0xe0/0xf8)
 [&lt;c0124198&gt;] (__warn) from [&lt;c01241f8&gt;] (warn_slowpath_fmt+0x48/0x6c)
 [&lt;c01241f8&gt;] (warn_slowpath_fmt) from [&lt;c06f6c40&gt;] (__i2c_transfer+0x35c/0x70c)
 [&lt;c06f6c40&gt;] (__i2c_transfer) from [&lt;c06f7048&gt;] (i2c_transfer+0x58/0xf4)
 [&lt;c06f7048&gt;] (i2c_transfer) from [&lt;c06f7130&gt;] (i2c_transfer_buffer_flags+0x4c/0x70)
 [&lt;c06f7130&gt;] (i2c_transfer_buffer_flags) from [&lt;c05bee78&gt;] (regmap_i2c_write+0x14/0x30)
 [&lt;c05bee78&gt;] (regmap_i2c_write) from [&lt;c05b9cac&gt;] (_regmap_raw_write_impl+0x35c/0x868)
 [&lt;c05b9cac&gt;] (_regmap_raw_write_impl) from [&lt;c05b984c&gt;] (_regmap_update_bits+0xe4/0xec)
 [&lt;c05b984c&gt;] (_regmap_update_bits) from [&lt;c05bad04&gt;] (regmap_update_bits_base+0x50/0x74)
 [&lt;c05bad04&gt;] (regmap_update_bits_base) from [&lt;c04d453c&gt;] (regulator_disable_regmap+0x44/0x54)
 [&lt;c04d453c&gt;] (regulator_disable_regmap) from [&lt;c04cf9d4&gt;] (_regulator_do_disable+0xf8/0x268)
 [&lt;c04cf9d4&gt;] (_regulator_do_disable) from [&lt;c04d1694&gt;] (_regulator_disable+0xf4/0x19c)
 [&lt;c04d1694&gt;] (_regulator_disable) from [&lt;c04d1770&gt;] (regulator_disable+0x34/0x64)
 [&lt;c04d1770&gt;] (regulator_disable) from [&lt;c04d2310&gt;] (regulator_bulk_disable+0x28/0xb4)
 [&lt;c04d2310&gt;] (regulator_bulk_disable) from [&lt;c0495cd4&gt;] (tegra_pcie_power_off+0x64/0xa8)
 [&lt;c0495cd4&gt;] (tegra_pcie_power_off) from [&lt;c0495f74&gt;] (tegra_pcie_pm_suspend+0x25c/0x3f4)
 [&lt;c0495f74&gt;] (tegra_pcie_pm_suspend) from [&lt;c05af48c&gt;] (dpm_run_callback+0x38/0x1d4)
 [&lt;c05af48c&gt;] (dpm_run_callback) from [&lt;c05afe30&gt;] (__device_suspend_noirq+0xc0/0x2b8)
 [&lt;c05afe30&gt;] (__device_suspend_noirq) from [&lt;c05b1c24&gt;] (dpm_noirq_suspend_devices+0x100/0x37c)
 [&lt;c05b1c24&gt;] (dpm_noirq_suspend_devices) from [&lt;c05b1ebc&gt;] (dpm_suspend_noirq+0x1c/0x48)
 [&lt;c05b1ebc&gt;] (dpm_suspend_noirq) from [&lt;c017d2c0&gt;] (suspend_devices_and_enter+0x1d0/0xa00)
 [&lt;c017d2c0&gt;] (suspend_devices_and_enter) from [&lt;c017dd10&gt;] (pm_suspend+0x220/0x74c)
 [&lt;c017dd10&gt;] (pm_suspend) from [&lt;c017c2c8&gt;] (state_store+0x6c/0xc8)
 [&lt;c017c2c8&gt;] (state_store) from [&lt;c02ef398&gt;] (kernfs_fop_write+0xe8/0x1c4)
 [&lt;c02ef398&gt;] (kernfs_fop_write) from [&lt;c0271e38&gt;] (__vfs_write+0x2c/0x1c4)
 [&lt;c0271e38&gt;] (__vfs_write) from [&lt;c02748dc&gt;] (vfs_write+0xa4/0x184)
 [&lt;c02748dc&gt;] (vfs_write) from [&lt;c0274b7c&gt;] (ksys_write+0x9c/0xdc)
 [&lt;c0274b7c&gt;] (ksys_write) from [&lt;c0101000&gt;] (ret_fast_syscall+0x0/0x54)
 Exception stack(0xe9f21fa8 to 0xe9f21ff0)
 1fa0:                   0000006c 004b2438 00000004 004b2438 00000004 00000000
 1fc0: 0000006c 004b2438 004b1228 00000004 00000004 00000004 0049e78c 004b1228
 1fe0: 00000004 be9809b8 b6f0bc0b b6e96206

The problem is that the Tegra PCIe driver indirectly uses I2C for
controlling some regulators and the I2C driver is now being suspended
before the PCIe driver causing the PCIe suspend to fail. The Tegra PCIe
driver is suspended during the NOIRQ phase and this cannot be changed
due to other dependencies. Therefore, we also need to move the suspend
handling for the Tegra I2C driver to the NOIRQ phase as well.

In order to move the I2C suspend handling to the NOIRQ phase we also
need to avoid calling pm_runtime_get/put() because per commit
1e2ef05bb8cf ("PM: Limit race conditions between runtime PM and system
sleep (v2)") these cannot be called early in resume. The function
tegra_i2c_init(), called during resume, calls pm_runtime_get/put() and
so move these calls outside of tegra_i2c_init(), so this function can
be used during the NOIRQ resume phase.

Fixes: acc8abcb2a9c ("i2c: tegra: Add suspend-resume support")

Signed-off-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Acked-by: Thierry Reding &lt;treding@nvidia.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 8ebf15e9c869e764b3aab4928938ee68c0e2bd6d ]

Commit acc8abcb2a9c ("i2c: tegra: Add suspend-resume support") added
suspend support for the Tegra I2C driver and following this change on
Tegra30 the following WARNING is seen on entering suspend ...

 WARNING: CPU: 2 PID: 689 at /dvs/git/dirty/git-master_l4t-upstream/kernel/drivers/i2c/i2c-core.h:54 __i2c_transfer+0x35c/0x70c
 i2c i2c-4: Transfer while suspended
 Modules linked in: brcmfmac brcmutil
 CPU: 2 PID: 689 Comm: rtcwake Not tainted 5.3.0-rc7-g089cf7f6ecb2 #1
 Hardware name: NVIDIA Tegra SoC (Flattened Device Tree)
 [&lt;c0112264&gt;] (unwind_backtrace) from [&lt;c010ca94&gt;] (show_stack+0x10/0x14)
 [&lt;c010ca94&gt;] (show_stack) from [&lt;c0a77024&gt;] (dump_stack+0xb4/0xc8)
 [&lt;c0a77024&gt;] (dump_stack) from [&lt;c0124198&gt;] (__warn+0xe0/0xf8)
 [&lt;c0124198&gt;] (__warn) from [&lt;c01241f8&gt;] (warn_slowpath_fmt+0x48/0x6c)
 [&lt;c01241f8&gt;] (warn_slowpath_fmt) from [&lt;c06f6c40&gt;] (__i2c_transfer+0x35c/0x70c)
 [&lt;c06f6c40&gt;] (__i2c_transfer) from [&lt;c06f7048&gt;] (i2c_transfer+0x58/0xf4)
 [&lt;c06f7048&gt;] (i2c_transfer) from [&lt;c06f7130&gt;] (i2c_transfer_buffer_flags+0x4c/0x70)
 [&lt;c06f7130&gt;] (i2c_transfer_buffer_flags) from [&lt;c05bee78&gt;] (regmap_i2c_write+0x14/0x30)
 [&lt;c05bee78&gt;] (regmap_i2c_write) from [&lt;c05b9cac&gt;] (_regmap_raw_write_impl+0x35c/0x868)
 [&lt;c05b9cac&gt;] (_regmap_raw_write_impl) from [&lt;c05b984c&gt;] (_regmap_update_bits+0xe4/0xec)
 [&lt;c05b984c&gt;] (_regmap_update_bits) from [&lt;c05bad04&gt;] (regmap_update_bits_base+0x50/0x74)
 [&lt;c05bad04&gt;] (regmap_update_bits_base) from [&lt;c04d453c&gt;] (regulator_disable_regmap+0x44/0x54)
 [&lt;c04d453c&gt;] (regulator_disable_regmap) from [&lt;c04cf9d4&gt;] (_regulator_do_disable+0xf8/0x268)
 [&lt;c04cf9d4&gt;] (_regulator_do_disable) from [&lt;c04d1694&gt;] (_regulator_disable+0xf4/0x19c)
 [&lt;c04d1694&gt;] (_regulator_disable) from [&lt;c04d1770&gt;] (regulator_disable+0x34/0x64)
 [&lt;c04d1770&gt;] (regulator_disable) from [&lt;c04d2310&gt;] (regulator_bulk_disable+0x28/0xb4)
 [&lt;c04d2310&gt;] (regulator_bulk_disable) from [&lt;c0495cd4&gt;] (tegra_pcie_power_off+0x64/0xa8)
 [&lt;c0495cd4&gt;] (tegra_pcie_power_off) from [&lt;c0495f74&gt;] (tegra_pcie_pm_suspend+0x25c/0x3f4)
 [&lt;c0495f74&gt;] (tegra_pcie_pm_suspend) from [&lt;c05af48c&gt;] (dpm_run_callback+0x38/0x1d4)
 [&lt;c05af48c&gt;] (dpm_run_callback) from [&lt;c05afe30&gt;] (__device_suspend_noirq+0xc0/0x2b8)
 [&lt;c05afe30&gt;] (__device_suspend_noirq) from [&lt;c05b1c24&gt;] (dpm_noirq_suspend_devices+0x100/0x37c)
 [&lt;c05b1c24&gt;] (dpm_noirq_suspend_devices) from [&lt;c05b1ebc&gt;] (dpm_suspend_noirq+0x1c/0x48)
 [&lt;c05b1ebc&gt;] (dpm_suspend_noirq) from [&lt;c017d2c0&gt;] (suspend_devices_and_enter+0x1d0/0xa00)
 [&lt;c017d2c0&gt;] (suspend_devices_and_enter) from [&lt;c017dd10&gt;] (pm_suspend+0x220/0x74c)
 [&lt;c017dd10&gt;] (pm_suspend) from [&lt;c017c2c8&gt;] (state_store+0x6c/0xc8)
 [&lt;c017c2c8&gt;] (state_store) from [&lt;c02ef398&gt;] (kernfs_fop_write+0xe8/0x1c4)
 [&lt;c02ef398&gt;] (kernfs_fop_write) from [&lt;c0271e38&gt;] (__vfs_write+0x2c/0x1c4)
 [&lt;c0271e38&gt;] (__vfs_write) from [&lt;c02748dc&gt;] (vfs_write+0xa4/0x184)
 [&lt;c02748dc&gt;] (vfs_write) from [&lt;c0274b7c&gt;] (ksys_write+0x9c/0xdc)
 [&lt;c0274b7c&gt;] (ksys_write) from [&lt;c0101000&gt;] (ret_fast_syscall+0x0/0x54)
 Exception stack(0xe9f21fa8 to 0xe9f21ff0)
 1fa0:                   0000006c 004b2438 00000004 004b2438 00000004 00000000
 1fc0: 0000006c 004b2438 004b1228 00000004 00000004 00000004 0049e78c 004b1228
 1fe0: 00000004 be9809b8 b6f0bc0b b6e96206

The problem is that the Tegra PCIe driver indirectly uses I2C for
controlling some regulators and the I2C driver is now being suspended
before the PCIe driver causing the PCIe suspend to fail. The Tegra PCIe
driver is suspended during the NOIRQ phase and this cannot be changed
due to other dependencies. Therefore, we also need to move the suspend
handling for the Tegra I2C driver to the NOIRQ phase as well.

In order to move the I2C suspend handling to the NOIRQ phase we also
need to avoid calling pm_runtime_get/put() because per commit
1e2ef05bb8cf ("PM: Limit race conditions between runtime PM and system
sleep (v2)") these cannot be called early in resume. The function
tegra_i2c_init(), called during resume, calls pm_runtime_get/put() and
so move these calls outside of tegra_i2c_init(), so this function can
be used during the NOIRQ resume phase.

Fixes: acc8abcb2a9c ("i2c: tegra: Add suspend-resume support")

Signed-off-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Acked-by: Thierry Reding &lt;treding@nvidia.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c-cht-wc: Fix lockdep warning</title>
<updated>2019-10-07T17:01:30+00:00</updated>
<author>
<name>Hans de Goede</name>
<email>hdegoede@redhat.com</email>
</author>
<published>2019-08-13T10:03:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=22a5fd6c1a0a0a3c3f619780ec43461a331e18f2'/>
<id>22a5fd6c1a0a0a3c3f619780ec43461a331e18f2</id>
<content type='text'>
[ Upstream commit 232219b9a464c2479c98aa589acb1bd3383ae9d6 ]

When the kernel is build with lockdep support and the i2c-cht-wc driver is
used, the following warning is shown:

[   66.674334] ======================================================
[   66.674337] WARNING: possible circular locking dependency detected
[   66.674340] 5.3.0-rc4+ #83 Not tainted
[   66.674342] ------------------------------------------------------
[   66.674345] systemd-udevd/1232 is trying to acquire lock:
[   66.674349] 00000000a74dab07 (intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock){+.+.}, at: regmap_write+0x31/0x70
[   66.674360]
               but task is already holding lock:
[   66.674362] 00000000d44a85b7 (i2c_register_adapter){+.+.}, at: i2c_smbus_xfer+0x49/0xf0
[   66.674370]
               which lock already depends on the new lock.

[   66.674371]
               the existing dependency chain (in reverse order) is:
[   66.674374]
               -&gt; #1 (i2c_register_adapter){+.+.}:
[   66.674381]        rt_mutex_lock_nested+0x46/0x60
[   66.674384]        i2c_smbus_xfer+0x49/0xf0
[   66.674387]        i2c_smbus_read_byte_data+0x45/0x70
[   66.674391]        cht_wc_byte_reg_read+0x35/0x50
[   66.674394]        _regmap_read+0x63/0x1a0
[   66.674396]        _regmap_update_bits+0xa8/0xe0
[   66.674399]        regmap_update_bits_base+0x63/0xa0
[   66.674403]        regmap_irq_update_bits.isra.0+0x3b/0x50
[   66.674406]        regmap_add_irq_chip+0x592/0x7a0
[   66.674409]        devm_regmap_add_irq_chip+0x89/0xed
[   66.674412]        cht_wc_probe+0x102/0x158
[   66.674415]        i2c_device_probe+0x95/0x250
[   66.674419]        really_probe+0xf3/0x380
[   66.674422]        driver_probe_device+0x59/0xd0
[   66.674425]        device_driver_attach+0x53/0x60
[   66.674428]        __driver_attach+0x92/0x150
[   66.674431]        bus_for_each_dev+0x7d/0xc0
[   66.674434]        bus_add_driver+0x14d/0x1f0
[   66.674437]        driver_register+0x6d/0xb0
[   66.674440]        i2c_register_driver+0x45/0x80
[   66.674445]        do_one_initcall+0x60/0x2f4
[   66.674450]        kernel_init_freeable+0x20d/0x2b4
[   66.674453]        kernel_init+0xa/0x10c
[   66.674457]        ret_from_fork+0x3a/0x50
[   66.674459]
               -&gt; #0 (intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock){+.+.}:
[   66.674465]        __lock_acquire+0xe07/0x1930
[   66.674468]        lock_acquire+0x9d/0x1a0
[   66.674472]        __mutex_lock+0xa8/0x9a0
[   66.674474]        regmap_write+0x31/0x70
[   66.674480]        cht_wc_i2c_adap_smbus_xfer+0x72/0x240 [i2c_cht_wc]
[   66.674483]        __i2c_smbus_xfer+0x1a3/0x640
[   66.674486]        i2c_smbus_xfer+0x67/0xf0
[   66.674489]        i2c_smbus_read_byte_data+0x45/0x70
[   66.674494]        bq24190_probe+0x26b/0x410 [bq24190_charger]
[   66.674497]        i2c_device_probe+0x189/0x250
[   66.674500]        really_probe+0xf3/0x380
[   66.674503]        driver_probe_device+0x59/0xd0
[   66.674506]        device_driver_attach+0x53/0x60
[   66.674509]        __driver_attach+0x92/0x150
[   66.674512]        bus_for_each_dev+0x7d/0xc0
[   66.674515]        bus_add_driver+0x14d/0x1f0
[   66.674518]        driver_register+0x6d/0xb0
[   66.674521]        i2c_register_driver+0x45/0x80
[   66.674524]        do_one_initcall+0x60/0x2f4
[   66.674528]        do_init_module+0x5c/0x230
[   66.674531]        load_module+0x2707/0x2a20
[   66.674534]        __do_sys_init_module+0x188/0x1b0
[   66.674537]        do_syscall_64+0x5c/0xb0
[   66.674541]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   66.674543]
               other info that might help us debug this:

[   66.674545]  Possible unsafe locking scenario:

[   66.674547]        CPU0                    CPU1
[   66.674548]        ----                    ----
[   66.674550]   lock(i2c_register_adapter);
[   66.674553]                                lock(intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock);
[   66.674556]                                lock(i2c_register_adapter);
[   66.674559]   lock(intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock);
[   66.674561]
                *** DEADLOCK ***

The problem is that the CHT Whiskey Cove PMIC's builtin i2c-adapter is
itself a part of an i2c-client (the PMIC). This means that transfers done
through it take adapter-&gt;bus_lock twice, once for the parent i2c-adapter
and once for its own bus_lock. Lockdep does not like this nested locking.

To make lockdep happy in the case of busses with muxes, the i2c-core's
i2c_adapter_lock_bus function calls:

 rt_mutex_lock_nested(&amp;adapter-&gt;bus_lock, i2c_adapter_depth(adapter));

But i2c_adapter_depth only works when the direct parent of the adapter is
another adapter, as it is only meant for muxes. In this case there is an
i2c-client and MFD instantiated platform_device in the parent-&gt;child chain
between the 2 devices.

This commit overrides the default i2c_lock_operations, passing a hardcoded
depth of 1 to rt_mutex_lock_nested, making lockdep happy.

Note that if there were to be a mux attached to the i2c-wc-cht adapter,
this would break things again since the i2c-mux code expects the
root-adapter to have a locking depth of 0. But the i2c-wc-cht adapter
always has only 1 client directly attached in the form of the charger IC
paired with the CHT Whiskey Cove PMIC.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[ Upstream commit 232219b9a464c2479c98aa589acb1bd3383ae9d6 ]

When the kernel is build with lockdep support and the i2c-cht-wc driver is
used, the following warning is shown:

[   66.674334] ======================================================
[   66.674337] WARNING: possible circular locking dependency detected
[   66.674340] 5.3.0-rc4+ #83 Not tainted
[   66.674342] ------------------------------------------------------
[   66.674345] systemd-udevd/1232 is trying to acquire lock:
[   66.674349] 00000000a74dab07 (intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock){+.+.}, at: regmap_write+0x31/0x70
[   66.674360]
               but task is already holding lock:
[   66.674362] 00000000d44a85b7 (i2c_register_adapter){+.+.}, at: i2c_smbus_xfer+0x49/0xf0
[   66.674370]
               which lock already depends on the new lock.

[   66.674371]
               the existing dependency chain (in reverse order) is:
[   66.674374]
               -&gt; #1 (i2c_register_adapter){+.+.}:
[   66.674381]        rt_mutex_lock_nested+0x46/0x60
[   66.674384]        i2c_smbus_xfer+0x49/0xf0
[   66.674387]        i2c_smbus_read_byte_data+0x45/0x70
[   66.674391]        cht_wc_byte_reg_read+0x35/0x50
[   66.674394]        _regmap_read+0x63/0x1a0
[   66.674396]        _regmap_update_bits+0xa8/0xe0
[   66.674399]        regmap_update_bits_base+0x63/0xa0
[   66.674403]        regmap_irq_update_bits.isra.0+0x3b/0x50
[   66.674406]        regmap_add_irq_chip+0x592/0x7a0
[   66.674409]        devm_regmap_add_irq_chip+0x89/0xed
[   66.674412]        cht_wc_probe+0x102/0x158
[   66.674415]        i2c_device_probe+0x95/0x250
[   66.674419]        really_probe+0xf3/0x380
[   66.674422]        driver_probe_device+0x59/0xd0
[   66.674425]        device_driver_attach+0x53/0x60
[   66.674428]        __driver_attach+0x92/0x150
[   66.674431]        bus_for_each_dev+0x7d/0xc0
[   66.674434]        bus_add_driver+0x14d/0x1f0
[   66.674437]        driver_register+0x6d/0xb0
[   66.674440]        i2c_register_driver+0x45/0x80
[   66.674445]        do_one_initcall+0x60/0x2f4
[   66.674450]        kernel_init_freeable+0x20d/0x2b4
[   66.674453]        kernel_init+0xa/0x10c
[   66.674457]        ret_from_fork+0x3a/0x50
[   66.674459]
               -&gt; #0 (intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock){+.+.}:
[   66.674465]        __lock_acquire+0xe07/0x1930
[   66.674468]        lock_acquire+0x9d/0x1a0
[   66.674472]        __mutex_lock+0xa8/0x9a0
[   66.674474]        regmap_write+0x31/0x70
[   66.674480]        cht_wc_i2c_adap_smbus_xfer+0x72/0x240 [i2c_cht_wc]
[   66.674483]        __i2c_smbus_xfer+0x1a3/0x640
[   66.674486]        i2c_smbus_xfer+0x67/0xf0
[   66.674489]        i2c_smbus_read_byte_data+0x45/0x70
[   66.674494]        bq24190_probe+0x26b/0x410 [bq24190_charger]
[   66.674497]        i2c_device_probe+0x189/0x250
[   66.674500]        really_probe+0xf3/0x380
[   66.674503]        driver_probe_device+0x59/0xd0
[   66.674506]        device_driver_attach+0x53/0x60
[   66.674509]        __driver_attach+0x92/0x150
[   66.674512]        bus_for_each_dev+0x7d/0xc0
[   66.674515]        bus_add_driver+0x14d/0x1f0
[   66.674518]        driver_register+0x6d/0xb0
[   66.674521]        i2c_register_driver+0x45/0x80
[   66.674524]        do_one_initcall+0x60/0x2f4
[   66.674528]        do_init_module+0x5c/0x230
[   66.674531]        load_module+0x2707/0x2a20
[   66.674534]        __do_sys_init_module+0x188/0x1b0
[   66.674537]        do_syscall_64+0x5c/0xb0
[   66.674541]        entry_SYSCALL_64_after_hwframe+0x49/0xbe
[   66.674543]
               other info that might help us debug this:

[   66.674545]  Possible unsafe locking scenario:

[   66.674547]        CPU0                    CPU1
[   66.674548]        ----                    ----
[   66.674550]   lock(i2c_register_adapter);
[   66.674553]                                lock(intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock);
[   66.674556]                                lock(i2c_register_adapter);
[   66.674559]   lock(intel_soc_pmic_chtwc:167:(&amp;cht_wc_regmap_cfg)-&gt;lock);
[   66.674561]
                *** DEADLOCK ***

The problem is that the CHT Whiskey Cove PMIC's builtin i2c-adapter is
itself a part of an i2c-client (the PMIC). This means that transfers done
through it take adapter-&gt;bus_lock twice, once for the parent i2c-adapter
and once for its own bus_lock. Lockdep does not like this nested locking.

To make lockdep happy in the case of busses with muxes, the i2c-core's
i2c_adapter_lock_bus function calls:

 rt_mutex_lock_nested(&amp;adapter-&gt;bus_lock, i2c_adapter_depth(adapter));

But i2c_adapter_depth only works when the direct parent of the adapter is
another adapter, as it is only meant for muxes. In this case there is an
i2c-client and MFD instantiated platform_device in the parent-&gt;child chain
between the 2 devices.

This commit overrides the default i2c_lock_operations, passing a hardcoded
depth of 1 to rt_mutex_lock_nested, making lockdep happy.

Note that if there were to be a mux attached to the i2c-wc-cht adapter,
this would break things again since the i2c-mux code expects the
root-adapter to have a locking depth of 0. But the i2c-wc-cht adapter
always has only 1 client directly attached in the form of the charger IC
paired with the CHT Whiskey Cove PMIC.

Signed-off-by: Hans de Goede &lt;hdegoede@redhat.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: riic: Clear NACK in tend isr</title>
<updated>2019-10-05T13:12:36+00:00</updated>
<author>
<name>Chris Brandt</name>
<email>chris.brandt@renesas.com</email>
</author>
<published>2019-09-26T12:19:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=6bc7cc6a78a544df678972b89803a3a9efa7b6d7'/>
<id>6bc7cc6a78a544df678972b89803a3a9efa7b6d7</id>
<content type='text'>
commit a71e2ac1f32097fbb2beab098687a7a95c84543e upstream.

The NACKF flag should be cleared in INTRIICNAKI interrupt processing as
description in HW manual.

This issue shows up quickly when PREEMPT_RT is applied and a device is
probed that is not plugged in (like a touchscreen controller). The result
is endless interrupts that halt system boot.

Fixes: 310c18a41450 ("i2c: riic: add driver")
Cc: stable@vger.kernel.org
Reported-by: Chien Nguyen &lt;chien.nguyen.eb@rvc.renesas.com&gt;
Signed-off-by: Chris Brandt &lt;chris.brandt@renesas.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit a71e2ac1f32097fbb2beab098687a7a95c84543e upstream.

The NACKF flag should be cleared in INTRIICNAKI interrupt processing as
description in HW manual.

This issue shows up quickly when PREEMPT_RT is applied and a device is
probed that is not plugged in (like a touchscreen controller). The result
is endless interrupts that halt system boot.

Fixes: 310c18a41450 ("i2c: riic: add driver")
Cc: stable@vger.kernel.org
Reported-by: Chien Nguyen &lt;chien.nguyen.eb@rvc.renesas.com&gt;
Signed-off-by: Chris Brandt &lt;chris.brandt@renesas.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: mediatek: disable zero-length transfers for mt8183</title>
<updated>2019-08-30T13:06:17+00:00</updated>
<author>
<name>Hsin-Yi Wang</name>
<email>hsinyi@chromium.org</email>
</author>
<published>2019-08-22T09:45:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=abf4923e97c3abbbd1e59f0e13c7c214c93c6aaa'/>
<id>abf4923e97c3abbbd1e59f0e13c7c214c93c6aaa</id>
<content type='text'>
Quoting from mt8183 datasheet, the number of transfers to be
transferred in one transaction should be set to bigger than 1,
so we should forbid zero-length transfer and update functionality.

Reported-by: Alexandru M Stan &lt;amstan@chromium.org&gt;
Signed-off-by: Hsin-Yi Wang &lt;hsinyi@chromium.org&gt;
Reviewed-by: Qii Wang &lt;qii.wang@mediatek.com&gt;
[wsa: shortened commit message a little]
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Quoting from mt8183 datasheet, the number of transfers to be
transferred in one transaction should be set to bigger than 1,
so we should forbid zero-length transfer and update functionality.

Reported-by: Alexandru M Stan &lt;amstan@chromium.org&gt;
Signed-off-by: Hsin-Yi Wang &lt;hsinyi@chromium.org&gt;
Reviewed-by: Qii Wang &lt;qii.wang@mediatek.com&gt;
[wsa: shortened commit message a little]
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: iproc: Stop advertising support of SMBUS quick cmd</title>
<updated>2019-08-30T12:58:18+00:00</updated>
<author>
<name>Lori Hikichi</name>
<email>lori.hikichi@broadcom.com</email>
</author>
<published>2019-08-08T03:37:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=b3d604d405166edfd4e1e6053409b85008f4f56d'/>
<id>b3d604d405166edfd4e1e6053409b85008f4f56d</id>
<content type='text'>
The driver does not support the SMBUS Quick command so remove the
flag that indicates that level of support.
By default the i2c_detect tool uses the quick command to try and
detect devices at some bus addresses.  If the quick command is used
then we will not detect the device, even though it is present.

Fixes: e6e5dd3566e0 (i2c: iproc: Add Broadcom iProc I2C Driver)
Signed-off-by: Lori Hikichi &lt;lori.hikichi@broadcom.com&gt;
Signed-off-by: Rayagonda Kokatanur &lt;rayagonda.kokatanur@broadcom.com&gt;
Reviewed-by: Ray Jui &lt;ray.jui@broadcom.com&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>
The driver does not support the SMBUS Quick command so remove the
flag that indicates that level of support.
By default the i2c_detect tool uses the quick command to try and
detect devices at some bus addresses.  If the quick command is used
then we will not detect the device, even though it is present.

Fixes: e6e5dd3566e0 (i2c: iproc: Add Broadcom iProc I2C Driver)
Signed-off-by: Lori Hikichi &lt;lori.hikichi@broadcom.com&gt;
Signed-off-by: Rayagonda Kokatanur &lt;rayagonda.kokatanur@broadcom.com&gt;
Reviewed-by: Ray Jui &lt;ray.jui@broadcom.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: piix4: Fix port selection for AMD Family 16h Model 30h</title>
<updated>2019-08-29T20:17:04+00:00</updated>
<author>
<name>Andrew Cooks</name>
<email>andrew.cooks@opengear.com</email>
</author>
<published>2019-08-02T12:52:46+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c7c06a1532f3fe106687ac82a13492c6a619ff1c'/>
<id>c7c06a1532f3fe106687ac82a13492c6a619ff1c</id>
<content type='text'>
Family 16h Model 30h SMBus controller needs the same port selection fix
as described and fixed in commit 0fe16195f891 ("i2c: piix4: Fix SMBus port
selection for AMD Family 17h chips")

commit 6befa3fde65f ("i2c: piix4: Support alternative port selection
register") also fixed the port selection for Hudson2, but unfortunately
this is not the exact same device and the AMD naming and PCI Device IDs
aren't particularly helpful here.

The SMBus port selection register is common to the following Families
and models, as documented in AMD's publicly available BIOS and Kernel
Developer Guides:

 50742 - Family 15h Model 60h-6Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)
 55072 - Family 15h Model 70h-7Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)
 52740 - Family 16h Model 30h-3Fh (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS)

The Hudson2 PCI Device ID (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) is shared
between Bolton FCH and Family 16h Model 30h, but the location of the
SmBus0Sel port selection bits are different:

 51192 - Bolton Register Reference Guide

We distinguish between Bolton and Family 16h Model 30h using the PCI
Revision ID:

  Bolton is device 0x780b, revision 0x15
  Family 16h Model 30h is device 0x780b, revision 0x1F
  Family 15h Model 60h and 70h are both device 0x790b, revision 0x4A.

The following additional public AMD BKDG documents were checked and do
not share the same port selection register:

 42301 - Family 15h Model 00h-0Fh doesn't mention any
 42300 - Family 15h Model 10h-1Fh doesn't mention any
 49125 - Family 15h Model 30h-3Fh doesn't mention any

 48751 - Family 16h Model 00h-0Fh uses the previously supported
         index register SB800_PIIX4_PORT_IDX_ALT at 0x2e

Signed-off-by: Andrew Cooks &lt;andrew.cooks@opengear.com&gt;
Signed-off-by: Jean Delvare &lt;jdelvare@suse.de&gt;
Cc: stable@vger.kernel.org [v4.6+]
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Family 16h Model 30h SMBus controller needs the same port selection fix
as described and fixed in commit 0fe16195f891 ("i2c: piix4: Fix SMBus port
selection for AMD Family 17h chips")

commit 6befa3fde65f ("i2c: piix4: Support alternative port selection
register") also fixed the port selection for Hudson2, but unfortunately
this is not the exact same device and the AMD naming and PCI Device IDs
aren't particularly helpful here.

The SMBus port selection register is common to the following Families
and models, as documented in AMD's publicly available BIOS and Kernel
Developer Guides:

 50742 - Family 15h Model 60h-6Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)
 55072 - Family 15h Model 70h-7Fh (PCI_DEVICE_ID_AMD_KERNCZ_SMBUS)
 52740 - Family 16h Model 30h-3Fh (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS)

The Hudson2 PCI Device ID (PCI_DEVICE_ID_AMD_HUDSON2_SMBUS) is shared
between Bolton FCH and Family 16h Model 30h, but the location of the
SmBus0Sel port selection bits are different:

 51192 - Bolton Register Reference Guide

We distinguish between Bolton and Family 16h Model 30h using the PCI
Revision ID:

  Bolton is device 0x780b, revision 0x15
  Family 16h Model 30h is device 0x780b, revision 0x1F
  Family 15h Model 60h and 70h are both device 0x790b, revision 0x4A.

The following additional public AMD BKDG documents were checked and do
not share the same port selection register:

 42301 - Family 15h Model 00h-0Fh doesn't mention any
 42300 - Family 15h Model 10h-1Fh doesn't mention any
 49125 - Family 15h Model 30h-3Fh doesn't mention any

 48751 - Family 16h Model 00h-0Fh uses the previously supported
         index register SB800_PIIX4_PORT_IDX_ALT at 0x2e

Signed-off-by: Andrew Cooks &lt;andrew.cooks@opengear.com&gt;
Signed-off-by: Jean Delvare &lt;jdelvare@suse.de&gt;
Cc: stable@vger.kernel.org [v4.6+]
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: designware: Synchronize IRQs when unregistering slave client</title>
<updated>2019-08-29T18:47:42+00:00</updated>
<author>
<name>Jarkko Nikula</name>
<email>jarkko.nikula@linux.intel.com</email>
</author>
<published>2019-08-15T13:52:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c486dcd2f1bbdd524a1e0149734b79e4ae329650'/>
<id>c486dcd2f1bbdd524a1e0149734b79e4ae329650</id>
<content type='text'>
Make sure interrupt handler i2c_dw_irq_handler_slave() has finished
before clearing the the dev-&gt;slave pointer in i2c_dw_unreg_slave().

There is possibility for a race if i2c_dw_irq_handler_slave() is running
on another CPU while clearing the dev-&gt;slave pointer.

Reported-by: Krzysztof Adamski &lt;krzysztof.adamski@nokia.com&gt;
Reported-by: Wolfram Sang &lt;wsa@the-dreams.de&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>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make sure interrupt handler i2c_dw_irq_handler_slave() has finished
before clearing the the dev-&gt;slave pointer in i2c_dw_unreg_slave().

There is possibility for a race if i2c_dw_irq_handler_slave() is running
on another CPU while clearing the dev-&gt;slave pointer.

Reported-by: Krzysztof Adamski &lt;krzysztof.adamski@nokia.com&gt;
Reported-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Signed-off-by: Jarkko Nikula &lt;jarkko.nikula@linux.intel.com&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: i801: Avoid memory leak in check_acpi_smo88xx_device()</title>
<updated>2019-08-29T18:46:48+00:00</updated>
<author>
<name>Andy Shevchenko</name>
<email>andriy.shevchenko@linux.intel.com</email>
</author>
<published>2019-08-16T13:17:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=01641b266da33e2cc57b4ea1767ba3e24ce0846b'/>
<id>01641b266da33e2cc57b4ea1767ba3e24ce0846b</id>
<content type='text'>
check_acpi_smo88xx_device() utilizes acpi_get_object_info() which in its turn
allocates a buffer. User is responsible to clean allocated resources. The last
has been missed in the original code. Fix it here.

While here, replace !ACPI_SUCCESS() with ACPI_FAILURE().

Fixes: 19b07cb4a187 ("i2c: i801: Register optional lis3lv02d I2C device on Dell machines")
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Pali Rohár &lt;pali.rohar@gmail.com&gt;
Reviewed-by: Jean Delvare &lt;jdelvare@suse.de&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>
check_acpi_smo88xx_device() utilizes acpi_get_object_info() which in its turn
allocates a buffer. User is responsible to clean allocated resources. The last
has been missed in the original code. Fix it here.

While here, replace !ACPI_SUCCESS() with ACPI_FAILURE().

Fixes: 19b07cb4a187 ("i2c: i801: Register optional lis3lv02d I2C device on Dell machines")
Signed-off-by: Andy Shevchenko &lt;andriy.shevchenko@linux.intel.com&gt;
Reviewed-by: Pali Rohár &lt;pali.rohar@gmail.com&gt;
Reviewed-by: Jean Delvare &lt;jdelvare@suse.de&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>i2c: make i2c_unregister_device() ERR_PTR safe</title>
<updated>2019-08-29T18:38:11+00:00</updated>
<author>
<name>Wolfram Sang</name>
<email>wsa+renesas@sang-engineering.com</email>
</author>
<published>2019-08-19T20:48:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=689f535843ac2633b395cfc494446326d03efab6'/>
<id>689f535843ac2633b395cfc494446326d03efab6</id>
<content type='text'>
We are moving towards returning ERR_PTRs when i2c_new_*_device() calls
fail. Make sure its counterpart for unregistering handles ERR_PTRs as
well.

Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&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>
We are moving towards returning ERR_PTRs when i2c_new_*_device() calls
fail. Make sure its counterpart for unregistering handles ERR_PTRs as
well.

Signed-off-by: Wolfram Sang &lt;wsa+renesas@sang-engineering.com&gt;
Reviewed-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
</pre>
</div>
</content>
</entry>
</feed>
