mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Guzman <Dmitry.Guzman@mobileye.com>
To: Andi Shyti <andi.shyti@kernel.org>,
	 Steven Rostedt <rostedt@goodmis.org>,
	 Masami Hiramatsu <mhiramat@kernel.org>,
	 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	 Linus Walleij <linusw@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-trace-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	 Dmitry Guzman <Dmitry.Guzman@mobileye.com>
Subject: [PATCH 0/7] I2C - detailed transfer reporting in case of a fault
Date: Tue, 23 Jun 2026 19:31:47 +0300	[thread overview]
Message-ID: <20260623-i2c-fault-reporting-v1-0-6db1a8aabf18@mobileye.com> (raw)

The existing API has function `i2c_xfer` that transfers one or more
messages, and it only returns a single error code if the transfer was
failed. It doesn't allow to know how many of the messages were
transferred successfully, neither how many bytes were transferred in the
message that caused the fault, and also it drops all data received from
target device before the fault. There is a comment about this in
drivers/i2c/i2c-core-base.c: "REVISIT the fault reporting model here is
weak".

This patch series implements new API function `i2c_xfer_v2` that does
the same as `i2c_xfer` but also returns detailed transfer report, including
number of messages and bytes transferred before the fault. This also allows
client to get the bytes read from the target before the fault occurred.

For user space clients, new ioctl `I2C_RDWR_V2` is introduced.

In this patchset, the introduced functionality is implemented in
`i2c-nomadik` driver. Several other improvements in this driver related
to fault handling are also included in this patchset. It has been tested
on EyeQ6H-EPM6 board.

The implementation is split up into patches:

Patch #1 Introduce callback `xfer_v2` in struct `i2c_algorithm`,
	 function `i2c_xfer_v2`, ioctl `I2C_RDWR_V2`, structures for I2C
	 transfer reporting and implement all driver-independent functionality.
Patch #2 Optimize struct layout in `i2c-nomadik`.
Patch #3 Remove automatic retransfer in `i2c-nomadik`.
Patch #4 Fix error codes returned by `xfer` callback in `i2c-nomadik`.
Patch #5 Replace `dev_err` with `dev_dbg` on I2C faults in `i2c-nomadik`.
Patch #6 Add quirks that describe some limitations of `i2c-nomadik`.
Patch #7 Add support for `xfer_v2` in `i2c-nomadik`.

Signed-off-by: Dmitry Guzman <Dmitry.Guzman@mobileye.com>
---
Dmitry Guzman (7):
      i2c: add I2C_XFER_V2 - support for detailed transfer reporting
      i2c: nomadik: optimize layout of struct nmk_i2c_dev
      i2c: nomadik: do not try to retransmit I2C message series on errors
      i2c: nomadik: return proper fault codes
      i2c: nomadik: change print level for fault messages to debug
      i2c: nomadik: add quirks max_len=2047 and no_zero_len_read
      i2c: nomadik: add support for I2C_XFER_V2 - detailed fault reporting

 Documentation/i2c/dev-interface.rst |  46 ++++++++++++++++
 drivers/i2c/busses/i2c-nomadik.c    | 105 ++++++++++++++++++++++++-----------
 drivers/i2c/i2c-core-base.c         | 107 +++++++++++++++++++++++++-----------
 drivers/i2c/i2c-dev.c               |  79 ++++++++++++++++++++++----
 include/linux/i2c.h                 |  12 ++++
 include/trace/events/i2c.h          |   6 +-
 include/uapi/linux/i2c-dev.h        |   9 +++
 include/uapi/linux/i2c.h            |  21 +++++++
 8 files changed, 306 insertions(+), 79 deletions(-)
---
base-commit: 502d801f0ab03e4f32f9a33d203154ce84887921
change-id: 20260623-i2c-fault-reporting-9236c9affc2d

Best regards,
-- 
Dmitry Guzman <Dmitry.Guzman@mobileye.com>


             reply	other threads:[~2026-06-23 16:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23 16:31 Dmitry Guzman [this message]
2026-06-23 16:31 ` [PATCH 1/7] i2c: add I2C_XFER_V2 - support for detailed transfer reporting Dmitry Guzman
2026-06-23 16:31 ` [PATCH 2/7] i2c: nomadik: optimize layout of struct nmk_i2c_dev Dmitry Guzman
2026-06-24 22:36   ` Linus Walleij
2026-07-01 13:46     ` Dmitry Guzman
2026-06-23 16:31 ` [PATCH 3/7] i2c: nomadik: do not try to retransmit I2C message series on errors Dmitry Guzman
2026-06-24 22:51   ` Linus Walleij
2026-06-23 16:31 ` [PATCH 4/7] i2c: nomadik: return proper fault codes Dmitry Guzman
2026-06-24 22:53   ` Linus Walleij
2026-06-23 16:31 ` [PATCH 5/7] i2c: nomadik: change print level for fault messages to debug Dmitry Guzman
2026-06-24 22:54   ` Linus Walleij
2026-06-23 16:31 ` [PATCH 6/7] i2c: nomadik: add quirks max_len=2047 and no_zero_len_read Dmitry Guzman
2026-06-24 22:55   ` Linus Walleij
2026-06-23 16:31 ` [PATCH 7/7] i2c: nomadik: add support for I2C_XFER_V2 - detailed fault reporting Dmitry Guzman
2026-06-24 22:56   ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260623-i2c-fault-reporting-v1-0-6db1a8aabf18@mobileye.com \
    --to=dmitry.guzman@mobileye.com \
    --cc=andi.shyti@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®