[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211109225321.618688-1-suichen@google.com>
Date: Tue, 9 Nov 2021 14:53:19 -0800
From: Sui Chen <suichen@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: Sui Chen <suichen@...gle.com>,
OpenBMC Mailing List <openbmc@...ts.ozlabs.org>,
linux-i2c <linux-i2c@...r.kernel.org>,
Joel Stanley <joel@....id.au>,
Andrew Jeffery <andrew@...id.au>,
Tali Perry <tali.perry1@...il.com>,
Benjamin Fair <benjaminfair@...gle.com>,
Josh Lehan <krellan@...gle.com>
Subject: [RFC Patch Resend 0/2] I2C statistics as sysfs attributes
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@...ts.ozlabs.org>
CC: linux-i2c <linux-i2c@...r.kernel.org>
CC: linux-kernel <linux-kernel@...r.kernel.org>
CC: Joel Stanley <joel@....id.au>
CC: Andrew Jeffery <andrew@...id.au>
CC: Tali Perry <tali.perry1@...il.com>
CC: Benjamin Fair <benjaminfair@...gle.com>
CC: Josh Lehan <krellan@...gle.com>
--
2.34.0.rc0.344.g81b53c2807-goog
Powered by blists - more mailing lists