[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211203023728.3699610-1-suichen@google.com>
Date: Thu, 2 Dec 2021 18:37:25 -0800
From: Sui Chen <suichen@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: openbmc@...ts.ozlabs.org, linux-i2c@...r.kernel.org,
joel@....id.au, andrew@...id.au, tali.perry1@...il.com,
benjaminfair@...gle.com, krellan@...gle.com, joe@...ches.com,
Sui Chen <suichen@...gle.com>
Subject: [RFC Patch v2 0/3] I2C statistics as sysfs attributes
Add I2C statistics such as Bus Error counts and NACK counts as sysfs
attributes so they don't need to live in debugfs.
There are a few I2C statistics that are implemented in many I2C
controllers, such as bus error counts and NACK counts. Having those
statistics in sysfs will 1) allow for a unified definition across
various I2C drivers, and 2) make the statistics more ABI-stable and
available on devices with the debugfs disabled.
Overall the patch works as the following way:
1) An I2C statistics sysfs directory is created.
2) Each specific I2C driver is responsible for instantiating the
statistics available.
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 tx_complete_cnt
root@gsj:/sys/class/i2c-adapter/i2c-1/stats# cat *
0
100000
0
0
0
0
53
Sui Chen (2):
i2c debug counters as sysfs attributes
add npcm7xx debug counters as sysfs attributes
Tali Perry (1):
i2c: npcm7xx: add tx_complete counter
drivers/i2c/busses/i2c-npcm7xx.c | 13 ++++
drivers/i2c/i2c-core-base.c | 2 +
drivers/i2c/i2c-dev.c | 103 +++++++++++++++++++++++++++++++
include/linux/i2c.h | 27 ++++++++
4 files changed, 145 insertions(+)
--
2.34.0.384.gca35af8252-goog
Powered by blists - more mailing lists