23 Jul, 2019
2 commits
-
Fix build warning when CONFIG_PM_SLEEP=n, the warning message is:
drivers/i2c/busses/i2c-imx-lpi2c.c:515:20: warning: ‘lpi2c_imx_isr’ defined but not used [-Wunused-function]
static irqreturn_t lpi2c_imx_isr(int irq, void *dev_id)
^~~~~~~~~~~~~Signed-off-by: Clark Wang
-
Fix build warning when CONFIG_PM_SLEEP=n, the warning message is:
drivers/i2c/busses/i2c-imx.c:1299:12: warning: ‘i2c_imx_resume’ defined but not used [-Wunused-function]
static int i2c_imx_resume(struct device *dev)
^~~~~~~~~~~~~~
drivers/i2c/busses/i2c-imx.c:1293:12: warning: ‘i2c_imx_suspend’ defined but not used [-Wunused-function]
static int i2c_imx_suspend(struct device *dev)
^~~~~~~~~~~~~~~Signed-off-by: Clark Wang
19 Jul, 2019
6 commits
-
The bug is when using i2cdetect in DomU, some i2c device will be
skiped, fixed this through add I2C_FUNC_SMBUS_QUICK functionality.Signed-off-by: Flynn xu
(cherry picked from commit b0aa11bdc74e6cb15b18dc704d554364da1fe39a) -
Fixes build warning introduced by
90e818a0abcc("MLK-20342 i2c: xen-i2cback/front: Add i2c_smbus interface")Signed-off-by: Peng Fan
(cherry picked from commit 0c3f35ec9f5a78c6706eb0f58b96cc2524a6ab2a) -
Add smbus_xfer interface in xen-i2cback/front driver.
Reviewed-by: Peng Fan
Signed-off-by: Flynn xu
(cherry picked from commit 5344f6c8efe9cabe72fbf6bd12fdb393a45a64c0) -
Fix uninitalized variable
Signed-off-by: Flynn xu
Reviewed-by: Peng Fan
(cherry picked from commit a33b23fe75d79ef6f72faa6c94ac6bda6fab3919) -
Fix Coverity id 5186949 5187047, uninitialized variables.
Signed-off-by: Peng Fan
(cherry picked from commit 3bd3e95a644c0f07479c471f3d8f6d98e99343e4) -
When req.num_msg is less than 2, also need initialze num_msg.
Also modify the if/else if to use num_msgSigned-off-by: Peng Fan
(cherry picked from commit 0ce331ed4a1dbbe8c1be4ee69e0f4d8f46c8fc53)
17 May, 2019
1 commit
-
The way of getting private imx_i2c_struct in i2c_imx_clk_notifier_call()
is incorrect, should use clk_change_nb element to get correct address
and avoid below kernel dump during POST_RATE_CHANGE notify by clk
framework:Unable to handle kernel paging request at virtual address 03ef1488
pgd = (ptrval)
[03ef1488] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: events reduce_bus_freq_handler
PC is at i2c_imx_set_clk+0x10/0xb8
LR is at i2c_imx_clk_notifier_call+0x20/0x28
pc : [] lr : [] psr: a0080013
sp : bf399dd8 ip : bf3432ac fp : bf7c1dc0
r10: 00000002 r9 : 00000000 r8 : 00000000
r7 : 03ef1480 r6 : bf399e50 r5 : ffffffff r4 : 00000000
r3 : bf025300 r2 : bf399e50 r1 : 00b71b00 r0 : bf399be8
Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 10c5387d Table: 4e03004a DAC: 00000051
Process kworker/2:1 (pid: 38, stack limit = 0x(ptrval))
Stack: (0xbf399dd8 to 0xbf39a000)
9dc0: 806a89e4 00000000
9de0: ffffffff bf399e50 00000002 806a8a04 806a89e4 80142900 ffffffff 00000000
9e00: bf34ef18 bf34ef04 00000000 ffffffff bf399e50 80142d84 00000000 bf399e6c
9e20: bf34ef00 80f214c4 bf025300 00000002 80f08d08 bf017480 00000000 80142df0
9e40: 00000000 80166ed8 80c27638 8045de58 bf352340 03ef1480 00b71b00 0f82e242
9e60: bf025300 00000002 03ef1480 80f60e5c 00000001 8045edf0 00000002 8045eb08
9e80: bf025300 00000002 03ef1480 8045ee10 03ef1480 8045eb08 bf01be40 00000002
9ea0: 03ef1480 8045ee10 07de2900 8045eb08 bf01b780 00000002 07de2900 8045ee10
9ec0: 80c27898 bf399ee4 bf020a80 00000002 1f78a400 8045ee10 80f60e5c 80460514
9ee0: 80f60e5c bf01b600 bf01b480 80460460 0f82e242 bf383a80 bf383a00 80f60e5c
9f00: 00000000 bf7c1dc0 80f60e70 80460564 80f60df0 80f60d24 80f60df0 8011e72c
9f20: 00000000 80f60df0 80f60e6c bf7c4f00 00000000 8011e7ac bf274000 8013bd84
9f40: bf7c1dd8 80f03d00 bf274000 bf7c1dc0 bf274014 bf7c1dd8 80f03d00 bf398000
9f60: 00000008 8013bfb4 00000000 bf25d100 bf25d0c0 00000000 bf274000 8013bf88
9f80: bf25d11c bf0cfebc 00000000 8014140c bf25d0c0 801412ec 00000000 00000000
9fa0: 00000000 00000000 00000000 801010e8 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[] (i2c_imx_set_clk) from [] (i2c_imx_clk_notifier_call+0x20/0x28)
[] (i2c_imx_clk_notifier_call) from [] (notifier_call_chain+0x44/0x84)
[] (notifier_call_chain) from [] (__srcu_notifier_call_chain+0x44/0x98)
[] (__srcu_notifier_call_chain) from [] (srcu_notifier_call_chain+0x18/0x20)
[] (srcu_notifier_call_chain) from [] (__clk_notify+0x78/0xa4)
[] (__clk_notify) from [] (__clk_recalc_rates+0x60/0xb4)
[] (__clk_recalc_rates) from [] (__clk_recalc_rates+0x80/0xb4)
Code: e92d40f8 e5903298 e59072a0 e1530001 (e5975008)
---[ end trace fc7f5514b97b6cbb ]---Fixes: 90ad2cbe88c2 ("i2c: imx: use clk notifier for rate changes")
Signed-off-by: Anson Huang
Reviewed-by: Dong Aisheng
Signed-off-by: Wolfram Sang
Cc: stable@kernel.org(cherry picked from commit d386bb9042f4629bf62cdc5952ea8aab225f24a7)
02 May, 2019
1 commit
-
"i2c_clk_rate / 2" might be zero when the i2c_clk_rate gets the clock is
0 or 1, so add a judgment to avoid the denominator is equal to 0.Signed-off-by: Clark Wang
[Arul: Add support to check return value everywhere in the driver]
Signed-off-by: Arulpandiyan VadivelSigned-off-by: Shrikant Bobade
(cherry picked from commit d382de595bffc0975ab7c0582e08dd4f7afc0c1a)
18 Apr, 2019
18 commits
-
Add compatible string for i.MX8QM's LPI2C module. Some i2c device nodes
in dts file only use "fsl,imx8qm-lpi2c" now.Signed-off-by: Clark Wang
-
use subsys_initcall for i2c driver to improve i2c driver probe priority
Signed-off-by: Gao Pan
(cherry picked from commit 3661eef81a308dab2bfae3790c045ae2d2fd3f49) -
According the e7805 in Errata, the SCK low level period should be less
than 1.3us.The other series platform use this same IP can match the errata, and
ensure the low level period longer than 1.3us when the speed set to
400KHz. However, only at imx7d platform, the low level period is less
than 1.3us in the same situation.Therefore, limit the maximum transfer speed to 384KHz when probe at
imx7d platform.Signed-off-by: Clark Wang
(cherry picked from commit 19f553846e872b5c379b37ed029132b79566cab0) -
For some chips may need long time to get the response from M4 sometimes,
enlarge timeout to 500ms.Add a judgement to check if the received data is the current transfer
wanted.Signed-off-by: Clark Wang
(cherry picked from commit 222e201b520cbd01b611fc45ae2f6b2f0b9d73a1) -
I2c_lock_bus function in i2c-core-base will not stop the transfer to
different devices on different buses at the same time.Since the multiple rpmsg i2c buses share one rpmsg channel, so it has to
add mutex to protect rpmsg resource accessing.Signed-off-by: Clark Wang
(cherry picked from commit d592afe9018e193f675b8c710fb1e66e44851ec8) -
The alias ID must be defined in device tree, because
that will be used as BUS ID to Cortex M4. If the alias ID
not defined, linux kernel will automatically allocate one
ID which might not be the same number used in Cortex M4 and
Cortex M4 will not send msg to I2C controller.So let's add BUG_ON to catch issue as earlier as possible to avoid
wasting efforts.Signed-off-by: Peng Fan
Reviewed-by: Clark Wang
(cherry picked from commit b9ff20355040d4bece8357a0af31bc5fca191cee) -
Add virtual i2c driver to send SRTM i2c messages to M4.
Each virtual I2C bus has a specal bus id, which is abstracted by M4.
Each SRTM message include a bus id for the bus which the device is on.Virtual i2c rpmsg bus will bind rpbus nodes with compatible string
"fsl,i2c-rpbus". And "rpmsg-i2c-channel" will probe only one rpmsg
channel for all rpbuses.This virtual i2c driver depends on CONFIG_I2C and CONFIG_RPMSG.
Signed-off-by: Clark Wang
(cherry picked from commit 9feeac93a7d91ce67537a8a6c67e624eb7986a01) -
During porting commit ede264acf031 ("MLK-14982-1 imx8: lpi2c: add ipg
clk for lpi2c driver") which replaced the single clk
with clk_ipg and clk_per was skipped.Part of the code was later added in commit 96dbdd8c3d0b ("MLK-16713 i2c:
imx-lpi2c: add runtime pm support") except the "clk" field was kept and
clk_get calls were not updated.Fix imx7ulp boot by fetching both clocks.
Fixes: 96dbdd8c3d0b ("MLK-16713 i2c: imx-lpi2c: add runtime pm support")
Signed-off-by: Leonard Crestez
Acked-by: Fugang Duan -
Add i2c backend frontend support.
The transaction only support one msg each time.
The frontend sends a request to backend, backend use i2c_transfer
to do real transaction to hardware and return the results to frontend.Now i2cdump/get/set works.
In domu cfg file, use
"vi2c = ['backend=0,be-adapter=5a800000.i2c,addr=0x51;0x44']" to
create a dummy controller in frontend and allowed slaves in backend.Currently the slave address check not added, it will be supported in
furture patch.Signed-off-by: Peng Fan
(cherry picked from commit f061dcc3d37b618d461b78f73b4d6aa0fd453bf9)
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar -
add debug message when i2c peripheral clk rate is 0, then
directly return -EINVAL.Signed-off-by: Gao Pan
Reviewed-by: Andy Duan
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar -
Manage irq resource request/release in runtime pm to save irq domain's
power.Signed-off-by: Frank Li
Signed-off-by: Fugang Duan
Tested-by: Guoniu.Zhou
Reviewed-by: Frank Li
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar -
- Add runtime pm support to dynamicly manage the ipg and per clocks.
- Put the suspend to suspend_noirq.
- Call .pm_runtime_force_suspend() to force runtime pm suspended
in .suspend_noirq().BuildInfo:
- SCFW 88456c73, IMX-MKIMAGE 06bc2767, ATF a438801
- U-Boot 2017.03-imx_v2017.03_4.9.51_imx8_beta1+g7953d47Signed-off-by: Fugang Duan
Signed-off-by: Gao Pan
Reviewed-by: Anson HuangDuring 4.14 rebase added pm_runtime_get_sync/pm_runtime_put around
the reading of LPI2C_PARAM.Signed-off-by: Leonard Crestez
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar -
When we do system suspend, the runtime pm will be disabled, but we need
to control the PMIC to power on/off the regulator, if the runtime pm is
disabled, if will failed to request runtime wakeup. So data transfer will
failed.Signed-off-by: Bai Ping
Signed-off-by: Gao Pan
Signed-off-by: Vipul Kumar -
restore pin setting for i2c in suspend/resume
Signed-off-by: Gao Pan
(cherry picked from commit 8aed73af218f25e0677b8980b3706246dd68790d)
Signed-off-by: Robin GongConflicts:
drivers/i2c/busses/i2c-imx.c
Signed-off-by: Vipul Kumar -
Due to the eviation i2c clk settings, the result may less than
100KBps. As a result, some i2c slave works in wrong condition.This patch changes i2c bitrate to 200KBps
Signed-off-by: Gao Pan
Signed-off-by: Vipul Kumar -
A NACK flag in ISR means i2c bus error. In such codition,
there is no need to do read/write operation. It's better
to return ISR directly and then stop i2c transfer.Signed-off-by: Gao Pan
(cherry-pick from 839d59e48b6fdbd882776a48a88ce26ff14d8b86)
Signed-off-by: Vipul Kumar -
restore pin setting for i2c in suspend/resume
Signed-off-by: Gao Pan
(Vipul: Fixed merge conflicts)
Signed-off-by: Vipul Kumar -
The i2c irq is masked when pcie starts a i2c transfer process
during noirq suspend stage. As a result, i2c transfer fails.
To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.Signed-off-by: Gao Pan
Signed-off-by: Fugang Duan
Signed-off-by: Vipul Kumar
06 Apr, 2019
1 commit
-
[ Upstream commit e814e688413aabd7b0d75e2a8ed1caa472951dec ]
If an I2C adapter doesn't match the provided device tree node, also try
matching the parent's device tree node. This allows finding an adapter
based on the device node of the parent device that was used to register
it.This fixes a regression on Tegra124-based Chromebooks (Nyan) where the
eDP controller registers an I2C adapter that is used to read to EDID.
After commit 993a815dcbb2 ("dt-bindings: panel: Add missing .txt
suffix") this stopped working because the I2C adapter could no longer
be found. The approach in this patch fixes the regression without
introducing the issues that the above commit solved.Fixes: 17ab7806de0c ("drm: don't link DP aux i2c adapter to the hardware device node")
Signed-off-by: Thierry Reding
Tested-by: Tristan Bastian
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin
24 Mar, 2019
3 commits
-
commit f4e3f4ae1d9c9330de355f432b69952e8cef650c upstream.
Tegra186 and prior supports maximum 4K bytes per packet transfer
including 12 bytes of packet header.This patch fixes max write length limit to account packet header
size for transfers.Cc: stable@vger.kernel.org # 4.4+
Reviewed-by: Dmitry Osipenko
Signed-off-by: Sowjanya Komatineni
Signed-off-by: Wolfram Sang
Signed-off-by: Greg Kroah-Hartman -
[ Upstream commit f275a4659484716259cc46268d9043424e51cf0f ]
The driver's interrupt handler checks whether a message is currently
being handled with the curr_msg pointer. When it is NULL, the interrupt
is considered to be unexpected. Similarly, the i2c_start_transfer
routine checks for the remaining number of messages to handle in
num_msgs.However, these values are never cleared and always keep the message and
number relevant to the latest transfer (which might be done already and
the underlying message memory might have been freed).When an unexpected interrupt hits with the DONE bit set, the isr will
then try to access the flags field of the curr_msg structure, leading
to a fatal page fault.The msg_buf and msg_buf_remaining fields are also never cleared at the
end of the transfer, which can lead to similar pitfalls.Fix these issues by introducing a cleanup function and always calling
it after a transfer is finished.Fixes: e2474541032d ("i2c: bcm2835: Fix hang for writing messages larger than 16 bytes")
Signed-off-by: Paul Kocialkowski
Acked-by: Stefan Wahren
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin -
[ Upstream commit d358def706880defa4c9e87381c5bf086a97d5f9 ]
In case the hold bit is not needed we are carrying the old values.
Fix the same by resetting the bit when not needed.Fixes the sporadic i2c bus lockups on National Instruments
Zynq-based devices.Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller")
Reported-by: Kyle Roeschley
Acked-by: Michal Simek
Signed-off-by: Shubhrajyoti Datta
Tested-by: Kyle Roeschley
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin
14 Mar, 2019
1 commit
-
[ Upstream commit c6e2bd956936d925748581e4d0294f10f1d92f2c ]
We currently get the following error with pixcir_ts driver during a
suspend resume cycle:omap_i2c 4802a000.i2c: controller timed out
pixcir_ts 1-005c: pixcir_int_enable: can't read reg 0x34 : -110
pixcir_ts 1-005c: Failed to disable interrupt generation: -110
pixcir_ts 1-005c: Failed to stop
dpm_run_callback(): pixcir_i2c_ts_resume+0x0/0x98
[pixcir_i2c_ts] returns -110
PM: Device 1-005c failed to resume: error -110And at least am437x based devices with pixcir_ts will fail to resume
to a touchscreen that is configured as the wakeup-source in device
tree for these devices.This is because pixcir_ts tries to reconfigure it's registers for
noirq suspend which fails. This also leaves i2c-omap in enabled state
for suspend.Let's fix the pixcir_ts issue and make sure i2c-omap is suspended by
adding SET_NOIRQ_SYSTEM_SLEEP_PM_OPS.Let's also get rid of some ifdefs while at it and replace them with
__maybe_unused as SET_RUNTIME_PM_OPS and SET_NOIRQ_SYSTEM_SLEEP_PM_OPS
already deal with the various PM Kconfig options.Reported-by: Keerthy
Signed-off-by: Tony Lindgren
Acked-by: Vignesh R
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin
13 Feb, 2019
3 commits
-
[ Upstream commit 51243b73455f2d12cb82abffa7bc9028aec656e0 ]
Similarly to R-Car E3, RZ/G2E doesn't come with automatic
transmission registers, as such it is not considered compatible
with the existing fallback bindings.Add SoC specific binding compatibility to allow for later
support for automatic transmission.Signed-off-by: Fabrizio Castro
Reviewed-by: Geert Uytterhoeven
Reviewed-by: Simon Horman
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin -
[ Upstream commit 4f5c85fe3a60ace555d09898166af372547f97fc ]
It was observed that when using seqentional mode contrary to the
documentation, the SS bit (which is supposed to only be set if
automatic/sequence command completed normally), is sometimes set
together with NA (NAK in address phase) causing transfer to falsely be
considered successful.My assumption is that this does not happen during manual mode since the
controller is stopping its work the moment it sets NA/ND bit in status
register. This is not the case in Automatic/Sequentional mode where it
is still working to send STOP condition and the actual status we get
depends on the time when the ISR is run.This patch changes the order of checking status bits in ISR - error
conditions are checked first and only if none of them occurred, the
transfer may be considered successful. This is required to introduce
using of sequentional mode in next patch.Signed-off-by: Krzysztof Adamski
Reviewed-by: Alexander Sverdlin
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin -
[ Upstream commit 5eb316e636eb298c204f5b368526d4480b63c0ba ]
Add support for the IIC code for the r8a77990 (R-Car E3).
It is not considered compatible with existing fallback bindings
due to the documented absence of automatic transmission registers.These registers are currently not used by the driver and
thus the provides the same behaviour for "renesas,iic-r8a77990" and
"renesas,rcar-gen3-iic". The point of declaring incompatibility is
to allow for automatic transmission register support to be added to
"renesas,iic-r8a77990" and "renesas,rcar-gen3-iic" in future.Signed-off-by: Simon Horman
Reviewed-by: Geert Uytterhoeven
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin
17 Jan, 2019
1 commit
-
commit 6ebec961d59bccf65d08b13fc1ad4e6272a89338 upstream.
If adapter->retries is set to a minus value from user space via ioctl,
it will make __i2c_transfer and __i2c_smbus_xfer skip the calling to
adapter->algo->master_xfer and adapter->algo->smbus_xfer that is
registered by the underlying bus drivers, and return value 0 to all the
callers. The bus driver will never be accessed anymore by all users,
besides, the users may still get successful return value without any
error or information log print out.If adapter->timeout is set to minus value from user space via ioctl,
it will make the retrying loop in __i2c_transfer and __i2c_smbus_xfer
always break after the the first try, due to the time_after always
returns true.Signed-off-by: Yi Zeng
[wsa: minor grammar updates to commit message]
Signed-off-by: Wolfram Sang
Cc: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman
21 Dec, 2018
3 commits
-
[ Upstream commit ece27a337d42a3197935711997f2880f0957ed7e ]
Currently, the clock duty is set as tLOW/tHIGH = 1/1. For Fast-mode,
tLOW is set to 1.25 us while the I2C spec requires tLOW >= 1.3 us.tLOW/tHIGH = 5/4 would meet both Standard-mode and Fast-mode:
Standard-mode: tLOW = 5.56 us, tHIGH = 4.44 us
Fast-mode: tLOW = 1.39 us, tHIGH = 1.11 usSigned-off-by: Masahiro Yamada
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin -
[ Upstream commit 8469636ab5d8c77645b953746c10fda6983a8830 ]
Currently, the clock duty is set as tLOW/tHIGH = 1/1. For Fast-mode,
tLOW is set to 1.25 us while the I2C spec requires tLOW >= 1.3 us.tLOW/tHIGH = 5/4 would meet both Standard-mode and Fast-mode:
Standard-mode: tLOW = 5.56 us, tHIGH = 4.44 us
Fast-mode: tLOW = 1.39 us, tHIGH = 1.11 usSigned-off-by: Masahiro Yamada
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin -
[ Upstream commit 0544ee4b1ad574aec3b6379af5f5cdee42840971 ]
Some AMD based HP laptops have a SMB0001 ACPI device node which does not
define any methods.This leads to the following error in dmesg:
[ 5.222731] cmi: probe of SMB0001:00 failed with error -5
This commit makes acpi_smbus_cmi_add() return -ENODEV instead in this case
silencing the error. In case of a failure of the i2c_add_adapter() call
this commit now propagates the error from that call instead of -EIO.Signed-off-by: Hans de Goede
Signed-off-by: Wolfram Sang
Signed-off-by: Sasha Levin