mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i2c: designware: demote arbitration lost message to debug level
@ 2026-11-24 12:59 WangYuli
  2026-11-24 15:57 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: WangYuli @ 2026-11-24 12:59 UTC (permalink / raw)
  To: andriy.shevchenko, westeri, andi.shyti
  Cc: linux-i2c, linux-kernel, shinya.kuribayashi, ben-linux, WangYuli, stable

From: WangYuli <wangyl5933@chinaunicom.cn>

On a MECHREVO XINGYAO 14 (Ryzen AI 9 H 365) the DesignWare controller
behind AMDI0010:01 repeatedly reports arbitration loss on the touchpad
bus while the system runs on battery:

    [162434.524491] i2c_designware AMDI0010:01: i2c_dw_handle_tx_abort: lost arbitration
    [162437.878670] i2c_designware AMDI0010:01: i2c_dw_handle_tx_abort: lost arbitration
    [162452.208445] i2c_designware AMDI0010:01: i2c_dw_handle_tx_abort: lost arbitration
    ...

Up to 94 messages within one hour were recorded, while the touchpad
remained usable during testing.

Losing arbitration is a defined part of the I2C protocol [1], and the
I2C core already handles it by retrying the transfer [2].  The driver
logs each aborted attempt before the I2C core determines the final
transfer result, so at error level these messages flood the log.

Log the arbitration-loss reason at debug level.

The driver continues to return -EAGAIN, allowing the I2C core to retry
the transfer within the adapter's retry and timeout limits.  The log
level of the other abort reasons and all return values stay unchanged;
in particular NACK-type aborts are already reported at debug level.

This follows the practice of i2c-imx (commit 1de67a3dee7a ("i2c: imx:
Check for I2SR_IAL after every byte")), i2c-mpc (commit 1538d82f4647
("i2c: mpc: Interrupt driven transfer")) and i2c-synquacer
(commit 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C
controller")), which report arbitration loss at debug level.

As a consequence, the arbitration-loss message is also hidden for the
last attempt of a transfer whose retries are exhausted.  Arbitration
losses remain available through dynamic debug, and the final result of
a transfer through the i2c_result tracepoint.

NOTE: The cause of the arbitration loss on this machine is still unknown.

[1] UM10204 "I2C-bus specification and user manual" Rev 7.0
    (1 October 2021), section 3.1.8 "Arbitration": "No information is
    lost during the arbitration process. A controller that loses the
    arbitration [...] must restart its transaction when the bus is free."
    It is the I2C-bus protocol specification, which NXP maintains as
    successor of Philips Semiconductors, and which the kernel I2C
    documentation itself references (Documentation/i2c/summary.rst):
    https://www.nxp.com/docs/en/user-guide/UM10204.pdf
[2] Documentation/i2c/fault-codes.rst: "EAGAIN: Returned by I2C
    adapters when they lose arbitration in master transmit mode".

Fixes: ce6eb574a1d9 ("i2c-designware: Tx abort cleanups")
Cc: stable@vger.kernel.org
Signed-off-by: WangYuli <wangyl5933@chinaunicom.cn>
---
 drivers/i2c/busses/i2c-designware-common.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index a1eca6cd4b75..93256f3786a5 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -783,8 +783,15 @@ int i2c_dw_handle_tx_abort(struct dw_i2c_dev *dev)
 		return -EREMOTEIO;
 	}
 
-	for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources))
-		dev_err(dev->dev, "%s: %s\n", __func__, abort_sources[i]);
+	for_each_set_bit(i, &abort_source, ARRAY_SIZE(abort_sources)) {
+		/* Avoid arbitration loss noise. */
+		if (i == ARB_LOST)
+			dev_dbg(dev->dev,
+				"%s: %s\n", __func__, abort_sources[i]);
+		else
+			dev_err(dev->dev,
+				"%s: %s\n", __func__, abort_sources[i]);
+	}
 
 	if (abort_source & DW_IC_TX_ARB_LOST)
 		return -EAGAIN;
-- 
2.55.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: designware: demote arbitration lost message to debug level
  2026-11-24 12:59 [PATCH] i2c: designware: demote arbitration lost message to debug level WangYuli
@ 2026-11-24 15:57 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-11-24 15:57 UTC (permalink / raw)
  To: WangYuli
  Cc: westeri, andi.shyti, linux-i2c, linux-kernel, shinya.kuribayashi,
	ben-linux, WangYuli, stable

On Tue, Nov 24, 2026 at 08:59:56PM +0800, WangYuli wrote:
> 
> On a MECHREVO XINGYAO 14 (Ryzen AI 9 H 365) the DesignWare controller
> behind AMDI0010:01 repeatedly reports arbitration loss on the touchpad
> bus while the system runs on battery:
> 
>     [162434.524491] i2c_designware AMDI0010:01: i2c_dw_handle_tx_abort: lost arbitration
>     [162437.878670] i2c_designware AMDI0010:01: i2c_dw_handle_tx_abort: lost arbitration
>     [162452.208445] i2c_designware AMDI0010:01: i2c_dw_handle_tx_abort: lost arbitration
>     ...
> 
> Up to 94 messages within one hour were recorded, while the touchpad
> remained usable during testing.

What is the speed used for this touchpad? 400kHz?

> Losing arbitration is a defined part of the I2C protocol [1], and the
> I2C core already handles it by retrying the transfer [2].  The driver
> logs each aborted attempt before the I2C core determines the final
> transfer result, so at error level these messages flood the log.
> 
> Log the arbitration-loss reason at debug level.

With this on debug level the observation of the possible issue is made harder.

> The driver continues to return -EAGAIN, allowing the I2C core to retry
> the transfer within the adapter's retry and timeout limits.  The log
> level of the other abort reasons and all return values stay unchanged;
> in particular NACK-type aborts are already reported at debug level.
> 
> This follows the practice of i2c-imx (commit 1de67a3dee7a ("i2c: imx:
> Check for I2SR_IAL after every byte")), i2c-mpc (commit 1538d82f4647
> ("i2c: mpc: Interrupt driven transfer")) and i2c-synquacer
> (commit 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C
> controller")), which report arbitration loss at debug level.
> 
> As a consequence, the arbitration-loss message is also hidden for the
> last attempt of a transfer whose retries are exhausted.  Arbitration
> losses remain available through dynamic debug, and the final result of
> a transfer through the i2c_result tracepoint.
> 
> NOTE: The cause of the arbitration loss on this machine is still unknown.

What's the typo of the touchpad? Or are there more i2c peripherals that also
loose arbitration from time to time?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 12:59 [PATCH] i2c: designware: demote arbitration lost message to debug level WangYuli
2026-11-24 15:57 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®