[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211109225321.618688-3-suichen@google.com>
Date: Tue, 9 Nov 2021 14:53:21 -0800
From: Sui Chen <suichen@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: Sui Chen <suichen@...gle.com>, Tali Perry <tali.perry1@...il.com>
Subject: [RFC Patch Resend 2/2] add npcm7xx debug counters as sysfs attributes
This change adds npcm7xx debug counters as sysfs attributes using the
i2c_adapter_stats_register_counter function.
Signed-off-by: Sui Chen <suichen@...gle.com>
Reviewed-by: Tali Perry <tali.perry1@...il.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 2ad166355ec9b..def044207cae2 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2224,6 +2224,14 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
debugfs_create_u64("rec_fail_cnt", 0444, d, &bus->rec_fail_cnt);
debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt);
+ /* register debug counters in sysfs */
+ i2c_adapter_stats_register_counter(&bus->adap, "ber_cnt", &bus->ber_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "nack_cnt", &bus->nack_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "rec_succ_cnt", &bus->rec_succ_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "rec_fail_cnt", &bus->rec_fail_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "timeout_cnt", &bus->timeout_cnt);
+ i2c_adapter_stats_register_counter(&bus->adap, "i2c_speed", &bus->bus_freq);
+
bus->debugfs = d;
}
--
2.34.0.rc0.344.g81b53c2807-goog
Powered by blists - more mailing lists