linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sui Chen <suichen@google.com>
To: linux-kernel@vger.kernel.org
Cc: Sui Chen <suichen@google.com>,
	OpenBMC Mailing List <openbmc@lists.ozlabs.org>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
	Tali Perry <tali.perry1@gmail.com>,
	Benjamin Fair <benjaminfair@google.com>,
	Josh Lehan <krellan@google.com>
Subject: [RFC Patch Resend 0/2] I2C statistics as sysfs attributes
Date: Tue,  9 Nov 2021 14:53:19 -0800	[thread overview]
Message-ID: <20211109225321.618688-1-suichen@google.com> (raw)

Add I2C statistics such as Bus Error counts and NACK counts as sysfs
attributes.

I2C statistics such as bus error counts and NACK counts, are
implemented in many I2C controllers.

Some drivers already populate the counters in debugfs. Having those
statistics in sysfs can enable for a unified definition across various
I2C drivers, make the statistics more ABI-stable.

Overall the patch works in the following way:
1) A sysfs directory for I2C statistics is created for an i2c_adapter.
2) Each specific I2C driver can optionally instantiate each of the
statistics individually.

Test Process:
1. Clone the OpenBMC repository
2. `devtool modify`and apply patch to the linux-nuvoton recipe
3. Build image for quanta-gsj
4. Build QEMU
5. Run the image-bmc image in QEMU

Results:
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# ls
ber_cnt       i2c_speed     nack_cnt      rec_fail_cnt  rec_succ_cnt
timeout_cnt
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# cat *
0
100000
0
0
0
0

Sui Chen (2):
  i2c debug counters as sysfs attributes
  add npcm7xx debug counters as sysfs attributes

 drivers/i2c/busses/i2c-npcm7xx.c |  8 +++
 drivers/i2c/i2c-core-base.c      |  2 +
 drivers/i2c/i2c-dev.c            | 98 ++++++++++++++++++++++++++++++++
 include/linux/i2c.h              | 26 +++++++++
 4 files changed, 134 insertions(+)

(Previously sent to linux-i2c, resending to linux-kernel with
CCed correspondents)

CC: OpenBMC Mailing List <openbmc@lists.ozlabs.org>
CC: linux-i2c <linux-i2c@vger.kernel.org>
CC: linux-kernel <linux-kernel@vger.kernel.org>
CC: Joel Stanley <joel@jms.id.au>
CC: Andrew Jeffery <andrew@aj.id.au>
CC: Tali Perry <tali.perry1@gmail.com>
CC: Benjamin Fair <benjaminfair@google.com>
CC: Josh Lehan <krellan@google.com>


-- 
2.34.0.rc0.344.g81b53c2807-goog


             reply	other threads:[~2021-11-09 22:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 22:53 Sui Chen [this message]
2021-11-09 22:53 ` [RFC Patch Resend 1/2] i2c debug counters as sysfs attributes Sui Chen
2021-11-09 23:13   ` Joe Perches
2021-11-09 22:53 ` [RFC Patch Resend 2/2] add npcm7xx " Sui Chen

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=20211109225321.618688-1-suichen@google.com \
    --to=suichen@google.com \
    --cc=andrew@aj.id.au \
    --cc=benjaminfair@google.com \
    --cc=joel@jms.id.au \
    --cc=krellan@google.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=tali.perry1@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).