[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211221174344.1249202-4-suichen@google.com>
Date: Tue, 21 Dec 2021 09:43:44 -0800
From: Sui Chen <suichen@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: linux-i2c@...r.kernel.org, openbmc@...ts.ozlabs.org,
joel@....id.au, andrew@...id.au, tali.perry1@...il.com,
benjaminfair@...gle.com, krellan@...gle.com,
Sui Chen <suichen@...gle.com>
Subject: [RFC Patch v3 3/3] 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 | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index cc7abd0b870be..c3ba5f3d33af1 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -2228,6 +2228,15 @@ static void npcm_i2c_init_debugfs(struct platform_device *pdev,
debugfs_create_u64("timeout_cnt", 0444, d, &bus->timeout_cnt);
debugfs_create_u64("tx_complete_cnt", 0444, d, &bus->tx_complete_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);
+ i2c_adapter_stats_register_counter(&bus->adap, "tx_complete_cnt", &bus->tx_complete_cnt);
+
bus->debugfs = d;
}
--
2.34.1.307.g9b7440fafd-goog
Powered by blists - more mailing lists